malachite_nz/integer_vector/arithmetic/mod.rs
1// Copyright © 2026 Mikhail Hogrefe
2//
3// This file is part of Malachite.
4//
5// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
6// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
7// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
8
9/// Implementations of [`AbsSquared`](malachite_base::num::arithmetic::traits::AbsSquared), the
10/// squared norm of a vector: the sum of the squares of its elements.
11pub mod abs_squared;
12/// Implementations of [`Add`](core::ops::Add) and [`AddAssign`](core::ops::AddAssign), for adding
13/// vectors.
14pub mod add;
15/// Adding a multiple of one vector to another, by implementations of
16/// [`AddMul`](malachite_base::num::arithmetic::traits::AddMul) and
17/// [`AddMulAssign`](malachite_base::num::arithmetic::traits::AddMulAssign).
18///
19/// # add_mul
20/// ```
21/// use core::str::FromStr;
22/// use malachite_base::num::arithmetic::traits::AddMul;
23/// use malachite_base::num::basic::traits::{NegativeOne, One, Zero};
24/// use malachite_nz::integer::Integer;
25/// use malachite_nz::integer_vector::IntegerVector;
26///
27/// assert_eq!(
28/// IntegerVector::from_str("()")
29/// .unwrap()
30/// .add_mul(IntegerVector::from_str("()").unwrap(), Integer::from(5))
31/// .to_string(),
32/// "()"
33/// );
34/// assert_eq!(
35/// IntegerVector::from_str("(1, -2, 3)")
36/// .unwrap()
37/// .add_mul(
38/// IntegerVector::from_str("(4, 5, -6)").unwrap(),
39/// Integer::ZERO
40/// )
41/// .to_string(),
42/// "(1, -2, 3)"
43/// );
44/// assert_eq!(
45/// IntegerVector::from_str("(1, -2, 3)")
46/// .unwrap()
47/// .add_mul(IntegerVector::from_str("(4, 5, -6)").unwrap(), Integer::ONE)
48/// .to_string(),
49/// "(5, 3, -3)"
50/// );
51/// assert_eq!(
52/// IntegerVector::from_str("(1, -2, 3)")
53/// .unwrap()
54/// .add_mul(
55/// IntegerVector::from_str("(4, 5, -6)").unwrap(),
56/// Integer::NEGATIVE_ONE
57/// )
58/// .to_string(),
59/// "(-3, -7, 9)"
60/// );
61/// assert_eq!(
62/// (&IntegerVector::from_str("(1, -2, 3)").unwrap())
63/// .add_mul(
64/// &IntegerVector::from_str("(4, 5, -6)").unwrap(),
65/// &Integer::from(10)
66/// )
67/// .to_string(),
68/// "(41, 48, -57)"
69/// );
70/// assert_eq!(
71/// IntegerVector::from_str("(1, 0)")
72/// .unwrap()
73/// .add_mul(
74/// &IntegerVector::from_str("(18446744073709551615, -1)").unwrap(),
75/// &Integer::from_str("18446744073709551617").unwrap()
76/// )
77/// .to_string(),
78/// "(340282366920938463463374607431768211456, -18446744073709551617)"
79/// );
80/// ```
81///
82/// # add_mul_assign
83/// ```
84/// use core::str::FromStr;
85/// use malachite_base::num::arithmetic::traits::AddMulAssign;
86/// use malachite_nz::integer::Integer;
87/// use malachite_nz::integer_vector::IntegerVector;
88///
89/// let mut v = IntegerVector::from_str("(1, -2, 3)").unwrap();
90/// v.add_mul_assign(
91/// IntegerVector::from_str("(4, 5, -6)").unwrap(),
92/// Integer::from(10),
93/// );
94/// assert_eq!(v.to_string(), "(41, 48, -57)");
95/// ```
96pub mod add_mul;
97/// Implementations of [`AddMulShl`](malachite_base::num::arithmetic::traits::AddMulShl) and
98/// [`AddMulShlAssign`](malachite_base::num::arithmetic::traits::AddMulShlAssign), for adding a
99/// scalar multiple of one vector, shifted left, to another.
100pub mod add_mul_shl;
101/// Implementations of [`BalancedMod`](malachite_base::num::arithmetic::traits::BalancedMod) and
102/// [`BalancedModAssign`](malachite_base::num::arithmetic::traits::BalancedModAssign), which reduce
103/// every element of a vector to the representative closest to zero modulo a number.
104pub mod balanced_mod;
105/// Implementations of
106/// [`BalancedModPowerOf2`](malachite_base::num::arithmetic::traits::BalancedModPowerOf2) and
107/// [`BalancedModPowerOf2Assign`](
108/// malachite_base::num::arithmetic::traits::BalancedModPowerOf2Assign), which reduce every element
109/// of a vector to the representative closest to zero modulo a power of 2.
110pub mod balanced_mod_power_of_2;
111/// Implementations of [`CanonicalPrimitivePart`](
112/// malachite_base::num::arithmetic::traits::CanonicalPrimitivePart),
113/// [`CanonicalPrimitivePartAssign`](
114/// malachite_base::num::arithmetic::traits::CanonicalPrimitivePartAssign), and
115/// [`ContentAndCanonicalPrimitivePart`](
116/// malachite_base::num::arithmetic::traits::ContentAndCanonicalPrimitivePart), which compute the
117/// primitive part of a vector with its first nonzero element made positive.
118pub mod canonical_primitive_part;
119/// Implementations of
120/// [`CanonicalizeSign`](malachite_base::num::arithmetic::traits::CanonicalizeSign) and
121/// [`CanonicalizeSignAssign`](malachite_base::num::arithmetic::traits::CanonicalizeSignAssign),
122/// which negate a vector if its pivot is negative.
123pub mod canonicalize_sign;
124/// Implementations of [`Content`](malachite_base::num::arithmetic::traits::Content),
125/// [`PrimitivePart`](malachite_base::num::arithmetic::traits::PrimitivePart),
126/// [`PrimitivePartAssign`](malachite_base::num::arithmetic::traits::PrimitivePartAssign), and
127/// [`ContentAndPrimitivePart`](malachite_base::num::arithmetic::traits::ContentAndPrimitivePart),
128/// which compute the GCD of a vector's elements and the vector divided by it.
129pub mod content;
130/// Implementations of [`ContentChained`](malachite_base::num::arithmetic::traits::ContentChained),
131/// which computes the GCD of a number and a vector's elements.
132pub mod content_chained;
133/// Exact division of a vector by a scalar, by implementations of
134/// [`DivExact`](malachite_base::num::arithmetic::traits::DivExact) and
135/// [`DivExactAssign`](malachite_base::num::arithmetic::traits::DivExactAssign).
136///
137/// # div_exact
138/// ```
139/// use core::str::FromStr;
140/// use malachite_base::num::arithmetic::traits::DivExact;
141/// use malachite_base::num::basic::traits::{NegativeOne, One};
142/// use malachite_nz::integer::Integer;
143/// use malachite_nz::integer_vector::IntegerVector;
144///
145/// assert_eq!(
146/// IntegerVector::from_str("()")
147/// .unwrap()
148/// .div_exact(Integer::from(5))
149/// .to_string(),
150/// "()"
151/// );
152/// assert_eq!(
153/// IntegerVector::from_str("(0, -6, 255)")
154/// .unwrap()
155/// .div_exact(Integer::ONE)
156/// .to_string(),
157/// "(0, -6, 255)"
158/// );
159/// assert_eq!(
160/// IntegerVector::from_str("(0, -6, 255)")
161/// .unwrap()
162/// .div_exact(Integer::NEGATIVE_ONE)
163/// .to_string(),
164/// "(0, 6, -255)"
165/// );
166/// assert_eq!(
167/// (&IntegerVector::from_str("(0, -6, 255)").unwrap())
168/// .div_exact(Integer::from(-3))
169/// .to_string(),
170/// "(0, 2, -85)"
171/// );
172/// assert_eq!(
173/// (&IntegerVector::from_str("(-3802951800684688204490109616128, 6)").unwrap())
174/// .div_exact(Integer::from(3))
175/// .to_string(),
176/// "(-1267650600228229401496703205376, 2)"
177/// );
178/// ```
179///
180/// # div_exact_assign
181/// ```
182/// use core::str::FromStr;
183/// use malachite_base::num::arithmetic::traits::DivExactAssign;
184/// use malachite_nz::integer::Integer;
185/// use malachite_nz::integer_vector::IntegerVector;
186///
187/// let mut v = IntegerVector::from_str("(0, -6, 255)").unwrap();
188/// v.div_exact_assign(Integer::from(-3));
189/// assert_eq!(v.to_string(), "(0, 2, -85)");
190/// ```
191pub mod div_exact;
192/// Implementations of [`Dot`](malachite_base::num::arithmetic::traits::Dot), the dot product of two
193/// vectors.
194pub mod dot;
195#[doc(hidden)]
196pub mod dot_general;
197/// Implementations of [`DotSign`](malachite_base::num::arithmetic::traits::DotSign), the sign of
198/// the dot product of two vectors.
199pub mod dot_sign;
200/// An implementation of [`ElementLcm`](malachite_base::num::arithmetic::traits::ElementLcm), the
201/// LCM of the elements.
202pub mod element_lcm;
203/// An implementation of
204/// [`ElementProduct`](malachite_base::num::arithmetic::traits::ElementProduct), the product of the
205/// elements.
206pub mod element_product;
207/// An implementation of [`ElementSum`](malachite_base::num::arithmetic::traits::ElementSum), the
208/// sum of the elements.
209pub mod element_sum;
210/// Implementations of [`EntrywiseAbs`](malachite_base::num::arithmetic::traits::EntrywiseAbs),
211/// [`EntrywiseAbsAssign`](malachite_base::num::arithmetic::traits::EntrywiseAbsAssign), and
212/// [`EntrywiseUnsignedAbs`](malachite_base::num::arithmetic::traits::EntrywiseUnsignedAbs), which
213/// replace every element of a vector by its absolute value.
214pub mod entrywise_abs;
215/// Dividing every element of a vector by a scalar and rounding each quotient, by implementations of
216/// [`EntrywiseDivRound`](malachite_base::num::arithmetic::traits::EntrywiseDivRound) and
217/// [`EntrywiseDivRoundAssign`](malachite_base::num::arithmetic::traits::EntrywiseDivRoundAssign).
218///
219/// # entrywise_div_round
220/// ```
221/// use core::str::FromStr;
222/// use malachite_base::num::arithmetic::traits::EntrywiseDivRound;
223/// use malachite_base::num::basic::traits::Two;
224/// use malachite_base::rounding_modes::RoundingMode::*;
225/// use malachite_nz::integer::Integer;
226/// use malachite_nz::integer_vector::IntegerVector;
227///
228/// assert_eq!(
229/// IntegerVector::from_str("(-3, -1, 1, 3)")
230/// .unwrap()
231/// .entrywise_div_round(Integer::TWO, Floor)
232/// .to_string(),
233/// "(-2, -1, 0, 1)"
234/// );
235/// assert_eq!(
236/// (&IntegerVector::from_str("(-3, -1, 1, 3)").unwrap())
237/// .entrywise_div_round(Integer::TWO, Down)
238/// .to_string(),
239/// "(-1, 0, 0, 1)"
240/// );
241/// assert_eq!(
242/// (&IntegerVector::from_str("(-3, -1, 1, 3)").unwrap())
243/// .entrywise_div_round(Integer::TWO, Ceiling)
244/// .to_string(),
245/// "(-1, 0, 1, 2)"
246/// );
247/// assert_eq!(
248/// IntegerVector::from_str("(-3, -1, 1, 3)")
249/// .unwrap()
250/// .entrywise_div_round(Integer::TWO, Nearest)
251/// .to_string(),
252/// "(-2, 0, 0, 2)"
253/// );
254/// assert_eq!(
255/// (&IntegerVector::from_str("(3, -6, 255)").unwrap())
256/// .entrywise_div_round(Integer::from(-3), Exact)
257/// .to_string(),
258/// "(-1, 2, -85)"
259/// );
260/// ```
261///
262/// # entrywise_div_round_assign
263/// ```
264/// use core::str::FromStr;
265/// use malachite_base::num::arithmetic::traits::EntrywiseDivRoundAssign;
266/// use malachite_base::num::basic::traits::Two;
267/// use malachite_base::rounding_modes::RoundingMode::*;
268/// use malachite_nz::integer::Integer;
269/// use malachite_nz::integer_vector::IntegerVector;
270///
271/// let mut v = IntegerVector::from_str("(-3, -1, 1, 3)").unwrap();
272/// v.entrywise_div_round_assign(Integer::TWO, Floor);
273/// assert_eq!(v.to_string(), "(-2, -1, 0, 1)");
274/// ```
275pub mod entrywise_div_round;
276/// Left-shifting a vector (multiplying it by a power of 2) and rounding every element, by
277/// implementations of
278/// [`EntrywiseShlRound`](malachite_base::num::arithmetic::traits::EntrywiseShlRound) and
279/// [`EntrywiseShlRoundAssign`](malachite_base::num::arithmetic::traits::EntrywiseShlRoundAssign).
280///
281/// # entrywise_shl_round
282/// ```
283/// use core::str::FromStr;
284/// use malachite_base::num::arithmetic::traits::EntrywiseShlRound;
285/// use malachite_base::rounding_modes::RoundingMode::*;
286/// use malachite_nz::integer_vector::IntegerVector;
287///
288/// assert_eq!(
289/// (IntegerVector::from_str("(-1, 2, -3, 5)")
290/// .unwrap()
291/// .entrywise_shl_round(-1i8, Floor))
292/// .to_string(),
293/// "(-1, 1, -2, 2)"
294/// );
295/// assert_eq!(
296/// (IntegerVector::from_str("(-1, 2, -3, 5)")
297/// .unwrap()
298/// .entrywise_shl_round(-1i16, Down))
299/// .to_string(),
300/// "(0, 1, -1, 2)"
301/// );
302/// assert_eq!(
303/// (&IntegerVector::from_str("(-1, 2, -3, 5)")
304/// .unwrap()
305/// .entrywise_shl_round(-1i32, Nearest))
306/// .to_string(),
307/// "(0, 1, -2, 2)"
308/// );
309/// assert_eq!(
310/// (IntegerVector::from_str("(4, -8, 12)")
311/// .unwrap()
312/// .entrywise_shl_round(-2i64, Exact))
313/// .to_string(),
314/// "(1, -2, 3)"
315/// );
316/// assert_eq!(
317/// (&IntegerVector::from_str("(1, -2, 3)")
318/// .unwrap()
319/// .entrywise_shl_round(2i8, Exact))
320/// .to_string(),
321/// "(4, -8, 12)"
322/// );
323/// ```
324///
325/// # entrywise_shl_round_assign
326/// ```
327/// use core::str::FromStr;
328/// use malachite_base::num::arithmetic::traits::EntrywiseShlRoundAssign;
329/// use malachite_base::rounding_modes::RoundingMode::*;
330/// use malachite_nz::integer_vector::IntegerVector;
331///
332/// let mut v = IntegerVector::from_str("(-1, 2, -3, 5)").unwrap();
333/// v.entrywise_shl_round_assign(-1i8, Down);
334/// assert_eq!(v.to_string(), "(0, 1, -1, 2)");
335/// let mut v = IntegerVector::from_str("(1, -2, 3)").unwrap();
336/// v.entrywise_shl_round_assign(2i32, Exact);
337/// assert_eq!(v.to_string(), "(4, -8, 12)");
338/// ```
339pub mod entrywise_shl_round;
340/// Right-shifting a vector (dividing it by a power of 2) and rounding every element, by
341/// implementations of
342/// [`EntrywiseShrRound`](malachite_base::num::arithmetic::traits::EntrywiseShrRound) and
343/// [`EntrywiseShrRoundAssign`](malachite_base::num::arithmetic::traits::EntrywiseShrRoundAssign).
344///
345/// # entrywise_shr_round
346/// ```
347/// use core::str::FromStr;
348/// use malachite_base::num::arithmetic::traits::EntrywiseShrRound;
349/// use malachite_base::rounding_modes::RoundingMode::*;
350/// use malachite_nz::integer_vector::IntegerVector;
351///
352/// assert_eq!(
353/// (IntegerVector::from_str("(-1, 2, -3, 5)")
354/// .unwrap()
355/// .entrywise_shr_round(1u8, Floor))
356/// .to_string(),
357/// "(-1, 1, -2, 2)"
358/// );
359/// assert_eq!(
360/// (IntegerVector::from_str("(-1, 2, -3, 5)")
361/// .unwrap()
362/// .entrywise_shr_round(1u16, Down))
363/// .to_string(),
364/// "(0, 1, -1, 2)"
365/// );
366/// assert_eq!(
367/// (IntegerVector::from_str("(-1, 2, -3, 5)")
368/// .unwrap()
369/// .entrywise_shr_round(1u32, Ceiling))
370/// .to_string(),
371/// "(0, 1, -1, 3)"
372/// );
373/// assert_eq!(
374/// (&IntegerVector::from_str("(-1, 2, -3, 5)")
375/// .unwrap()
376/// .entrywise_shr_round(1u64, Up))
377/// .to_string(),
378/// "(-1, 1, -2, 3)"
379/// );
380/// assert_eq!(
381/// (IntegerVector::from_str("(-1, 2, -3, 5)")
382/// .unwrap()
383/// .entrywise_shr_round(1u8, Nearest))
384/// .to_string(),
385/// "(0, 1, -2, 2)"
386/// );
387/// assert_eq!(
388/// (IntegerVector::from_str("(4, -8, 12)")
389/// .unwrap()
390/// .entrywise_shr_round(2u16, Exact))
391/// .to_string(),
392/// "(1, -2, 3)"
393/// );
394/// assert_eq!(
395/// (IntegerVector::from_str("(-1, 2, -3, 5)")
396/// .unwrap()
397/// .entrywise_shr_round(1i8, Down))
398/// .to_string(),
399/// "(0, 1, -1, 2)"
400/// );
401/// assert_eq!(
402/// (&IntegerVector::from_str("(1, -2, 3)")
403/// .unwrap()
404/// .entrywise_shr_round(-2i16, Exact))
405/// .to_string(),
406/// "(4, -8, 12)"
407/// );
408/// ```
409///
410/// # entrywise_shr_round_assign
411/// ```
412/// use core::str::FromStr;
413/// use malachite_base::num::arithmetic::traits::EntrywiseShrRoundAssign;
414/// use malachite_base::rounding_modes::RoundingMode::*;
415/// use malachite_nz::integer_vector::IntegerVector;
416///
417/// let mut v = IntegerVector::from_str("(-1, 2, -3, 5)").unwrap();
418/// v.entrywise_shr_round_assign(1u8, Down);
419/// assert_eq!(v.to_string(), "(0, 1, -1, 2)");
420/// let mut v = IntegerVector::from_str("(-1, 2, -3, 5)").unwrap();
421/// v.entrywise_shr_round_assign(1i32, Nearest);
422/// assert_eq!(v.to_string(), "(0, 1, -2, 2)");
423/// ```
424pub mod entrywise_shr_round;
425/// An implementation of [`Height`](malachite_base::num::arithmetic::traits::Height) and
426/// [`HeightRef`](malachite_base::num::arithmetic::traits::HeightRef), the largest height of any
427/// element.
428pub mod height;
429/// An implementation of [`L1Norm`](malachite_base::num::arithmetic::traits::L1Norm), the sum of the
430/// absolute values of the elements.
431pub mod l1_norm;
432#[doc(hidden)]
433pub mod max_bits;
434#[doc(hidden)]
435pub mod max_limbs;
436/// Implementations of [`Mod`](malachite_base::num::arithmetic::traits::Mod),
437/// [`Rem`](core::ops::Rem), and [`RemAssign`](core::ops::RemAssign), for reducing every element of
438/// a vector modulo a number.
439pub mod mod_op;
440/// Implementations of [`ModPowerOf2`](malachite_base::num::arithmetic::traits::ModPowerOf2),
441/// [`RemPowerOf2`](malachite_base::num::arithmetic::traits::RemPowerOf2), and
442/// [`RemPowerOf2Assign`](malachite_base::num::arithmetic::traits::RemPowerOf2Assign), for reducing
443/// every element of a vector modulo a power of 2.
444pub mod mod_power_of_2;
445/// [`IntegerVector::multi_balanced_crt`](super::IntegerVector::multi_balanced_crt), which combines
446/// vectors of residues modulo many word-sized moduli into balanced representatives by the Chinese
447/// remainder theorem.
448pub mod multi_crt;
449/// Implementations of [`Neg`](core::ops::Neg) and
450/// [`NegAssign`](malachite_base::num::arithmetic::traits::NegAssign), for negating a vector.
451pub mod neg;
452/// Implementations of [`Div`](core::ops::Div) and [`DivAssign`](core::ops::DivAssign), for dividing
453/// a vector by a scalar.
454///
455/// # div
456/// ```
457/// use core::str::FromStr;
458/// use malachite_base::num::basic::traits::{NegativeOne, One, Two};
459/// use malachite_nz::integer::Integer;
460/// use malachite_nz::integer_vector::IntegerVector;
461///
462/// assert_eq!(
463/// (IntegerVector::from_str("()").unwrap() / Integer::from(5)).to_string(),
464/// "()"
465/// );
466/// assert_eq!(
467/// (IntegerVector::from_str("(0, -7, 255)").unwrap() / Integer::ONE).to_string(),
468/// "(0, -7, 255)"
469/// );
470/// assert_eq!(
471/// (IntegerVector::from_str("(0, -7, 255)").unwrap() / Integer::NEGATIVE_ONE).to_string(),
472/// "(0, 7, -255)"
473/// );
474/// assert_eq!(
475/// (&IntegerVector::from_str("(0, -7, 255)").unwrap() / Integer::TWO).to_string(),
476/// "(0, -3, 127)"
477/// );
478/// assert_eq!(
479/// (&IntegerVector::from_str("(0, -7, 255)").unwrap() / Integer::from(-2)).to_string(),
480/// "(0, 3, -127)"
481/// );
482/// ```
483///
484/// # div_assign
485/// ```
486/// use core::str::FromStr;
487/// use malachite_base::num::basic::traits::Two;
488/// use malachite_nz::integer::Integer;
489/// use malachite_nz::integer_vector::IntegerVector;
490///
491/// let mut v = IntegerVector::from_str("(0, -7, 255)").unwrap();
492/// v /= Integer::TWO;
493/// assert_eq!(v.to_string(), "(0, -3, 127)");
494/// ```
495pub mod scalar_div;
496/// Implementations of [`Mul`](core::ops::Mul) and [`MulAssign`](core::ops::MulAssign), for
497/// multiplying a vector by a scalar, with the scalar on either side.
498pub mod scalar_mul;
499/// Left-shifting a vector (multiplying it by a power of 2), by implementations of
500/// [`Shl`](core::ops::Shl) and [`ShlAssign`](core::ops::ShlAssign).
501///
502/// # shl
503/// ```
504/// use core::str::FromStr;
505/// use malachite_nz::integer_vector::IntegerVector;
506///
507/// assert_eq!(
508/// (IntegerVector::from_str("()").unwrap() << 10u8).to_string(),
509/// "()"
510/// );
511/// assert_eq!(
512/// (IntegerVector::from_str("(1, -2, 3)").unwrap() << 0u16).to_string(),
513/// "(1, -2, 3)"
514/// );
515/// assert_eq!(
516/// (IntegerVector::from_str("(1, -2, 3)").unwrap() << 2u32).to_string(),
517/// "(4, -8, 12)"
518/// );
519/// assert_eq!(
520/// (&IntegerVector::from_str("(-3, 0)").unwrap() << 100u64).to_string(),
521/// "(-3802951800684688204490109616128, 0)"
522/// );
523///
524/// assert_eq!(
525/// (IntegerVector::from_str("(1, -2, 3)").unwrap() << 2i8).to_string(),
526/// "(4, -8, 12)"
527/// );
528///
529/// assert_eq!(
530/// (&IntegerVector::from_str("(-1, 2, -3, 5)").unwrap() << -1i64).to_string(),
531/// "(-1, 1, -2, 2)"
532/// );
533/// ```
534///
535/// # shl_assign
536/// ```
537/// use core::str::FromStr;
538/// use malachite_nz::integer_vector::IntegerVector;
539///
540/// let mut v = IntegerVector::from_str("(1, -2, 3)").unwrap();
541/// v <<= 2u32;
542/// assert_eq!(v.to_string(), "(4, -8, 12)");
543///
544/// let mut v = IntegerVector::from_str("(-1, 2, -3, 5)").unwrap();
545/// v <<= -1i32;
546/// assert_eq!(v.to_string(), "(-1, 1, -2, 2)");
547/// ```
548pub mod shl;
549/// Right-shifting a vector (dividing it by a power of 2 and taking the floor), by implementations
550/// of [`Shr`](core::ops::Shr) and [`ShrAssign`](core::ops::ShrAssign).
551///
552/// # shr
553/// ```
554/// use core::str::FromStr;
555/// use malachite_nz::integer_vector::IntegerVector;
556///
557/// assert_eq!(
558/// (IntegerVector::from_str("()").unwrap() >> 10u8).to_string(),
559/// "()"
560/// );
561/// assert_eq!(
562/// (IntegerVector::from_str("(1, -2, 3)").unwrap() >> 0u16).to_string(),
563/// "(1, -2, 3)"
564/// );
565/// assert_eq!(
566/// (IntegerVector::from_str("(4, -8, 12)").unwrap() >> 2u32).to_string(),
567/// "(1, -2, 3)"
568/// );
569/// assert_eq!(
570/// (IntegerVector::from_str("(-1, 2, -3, 5)").unwrap() >> 1u8).to_string(),
571/// "(-1, 1, -2, 2)"
572/// );
573/// assert_eq!(
574/// (&IntegerVector::from_str("(-3802951800684688204490109616128, 0)").unwrap() >> 100u64)
575/// .to_string(),
576/// "(-3, 0)"
577/// );
578/// assert_eq!(
579/// (IntegerVector::from_str("(1, -2, 3)").unwrap() >> -2i8).to_string(),
580/// "(4, -8, 12)"
581/// );
582/// assert_eq!(
583/// (&IntegerVector::from_str("(-1, 2, -3, 5)").unwrap() >> 1i64).to_string(),
584/// "(-1, 1, -2, 2)"
585/// );
586/// ```
587///
588/// # shr_assign
589/// ```
590/// use core::str::FromStr;
591/// use malachite_nz::integer_vector::IntegerVector;
592///
593/// let mut v = IntegerVector::from_str("(-1, 2, -3, 5)").unwrap();
594/// v >>= 1u32;
595/// assert_eq!(v.to_string(), "(-1, 1, -2, 2)");
596/// let mut v = IntegerVector::from_str("(1, -2, 3)").unwrap();
597/// v >>= -2i32;
598/// assert_eq!(v.to_string(), "(4, -8, 12)");
599/// ```
600pub mod shr;
601/// Implementations of [`Sub`](core::ops::Sub) and [`SubAssign`](core::ops::SubAssign), for
602/// subtracting vectors.
603pub mod sub;
604/// Subtracting a multiple of one vector from another, by implementations of
605/// [`SubMul`](malachite_base::num::arithmetic::traits::SubMul) and
606/// [`SubMulAssign`](malachite_base::num::arithmetic::traits::SubMulAssign).
607///
608/// # sub_mul
609/// ```
610/// use core::str::FromStr;
611/// use malachite_base::num::arithmetic::traits::SubMul;
612/// use malachite_base::num::basic::traits::{NegativeOne, One, Zero};
613/// use malachite_nz::integer::Integer;
614/// use malachite_nz::integer_vector::IntegerVector;
615///
616/// assert_eq!(
617/// IntegerVector::from_str("()")
618/// .unwrap()
619/// .sub_mul(IntegerVector::from_str("()").unwrap(), Integer::from(5))
620/// .to_string(),
621/// "()"
622/// );
623/// assert_eq!(
624/// IntegerVector::from_str("(1, -2, 3)")
625/// .unwrap()
626/// .sub_mul(
627/// IntegerVector::from_str("(4, 5, -6)").unwrap(),
628/// Integer::ZERO
629/// )
630/// .to_string(),
631/// "(1, -2, 3)"
632/// );
633/// assert_eq!(
634/// IntegerVector::from_str("(1, -2, 3)")
635/// .unwrap()
636/// .sub_mul(IntegerVector::from_str("(4, 5, -6)").unwrap(), Integer::ONE)
637/// .to_string(),
638/// "(-3, -7, 9)"
639/// );
640/// assert_eq!(
641/// IntegerVector::from_str("(1, -2, 3)")
642/// .unwrap()
643/// .sub_mul(
644/// IntegerVector::from_str("(4, 5, -6)").unwrap(),
645/// Integer::NEGATIVE_ONE
646/// )
647/// .to_string(),
648/// "(5, 3, -3)"
649/// );
650/// assert_eq!(
651/// (&IntegerVector::from_str("(1, -2, 3)").unwrap())
652/// .sub_mul(
653/// &IntegerVector::from_str("(4, 5, -6)").unwrap(),
654/// &Integer::from(10)
655/// )
656/// .to_string(),
657/// "(-39, -52, 63)"
658/// );
659/// assert_eq!(
660/// IntegerVector::from_str("(1, 0)")
661/// .unwrap()
662/// .sub_mul(
663/// &IntegerVector::from_str("(18446744073709551615, -1)").unwrap(),
664/// &Integer::from_str("18446744073709551617").unwrap()
665/// )
666/// .to_string(),
667/// "(-340282366920938463463374607431768211454, 18446744073709551617)"
668/// );
669/// ```
670///
671/// # sub_mul_assign
672/// ```
673/// use core::str::FromStr;
674/// use malachite_base::num::arithmetic::traits::SubMulAssign;
675/// use malachite_nz::integer::Integer;
676/// use malachite_nz::integer_vector::IntegerVector;
677///
678/// let mut v = IntegerVector::from_str("(1, -2, 3)").unwrap();
679/// v.sub_mul_assign(
680/// IntegerVector::from_str("(4, 5, -6)").unwrap(),
681/// Integer::from(10),
682/// );
683/// assert_eq!(v.to_string(), "(-39, -52, 63)");
684/// ```
685pub mod sub_mul;
686/// Implementations of [`SubMulShl`](malachite_base::num::arithmetic::traits::SubMulShl) and
687/// [`SubMulShlAssign`](malachite_base::num::arithmetic::traits::SubMulShlAssign), for subtracting a
688/// scalar multiple of one vector, shifted left, from another.
689pub mod sub_mul_shl;
690/// Implementations of [`Sum`](core::iter::Sum), for adding up vectors entry by entry.
691pub mod sum;
692#[doc(hidden)]
693pub mod sum_max_bits;