21 "Arithmetic operands must have the same shape.");
39 A result(lhs.shape());
41 auto it1 = lhs.begin();
42 auto it2 = rhs.begin();
43 auto it3 = result.begin();
45 for (; it1 != lhs.end(); ++it1, ++it2, ++it3)
68 A result(lhs.shape());
70 auto it1 = lhs.begin();
71 auto it2 = rhs.begin();
72 auto it3 = result.begin();
74 for (; it1 != lhs.end(); ++it1, ++it2, ++it3)
97 A result(lhs.shape());
99 auto it1 = lhs.begin();
100 auto it2 = rhs.begin();
101 auto it3 = result.begin();
103 for (; it1 != lhs.end(); ++it1, ++it2, ++it3)
127 A result(lhs.shape());
129 auto it1 = lhs.begin();
130 auto it2 = rhs.begin();
131 auto it3 = result.begin();
133 for (; it1 != lhs.end(); ++it1, ++it2, ++it3)
135 if (*it2 ==
typename A::value_type{})
154template<Array A, Numeric Scalar>
157 A result(lhs.shape());
159 auto out = result.begin();
161 for (
auto it = lhs.begin(); it != lhs.end(); ++it, ++out)
177template<Array A, Numeric Scalar>
180 A result(lhs.shape());
182 auto out = result.begin();
184 for (
auto it = lhs.begin(); it != lhs.end(); ++it, ++out)
200template<Array A, Numeric Scalar>
203 A result(lhs.shape());
205 auto out = result.begin();
207 for (
auto it = lhs.begin(); it != lhs.end(); ++it, ++out)
225template<Array A, Numeric Scalar>
228 A result(lhs.shape());
230 auto out = result.begin();
237 for (
auto it = lhs.begin(); it != lhs.end(); ++it, ++out)
253template<Numeric Scalar, Array A>
267template<Numeric Scalar, Array A>
270 A result(rhs.shape());
272 auto out = result.begin();
274 for (
auto it = rhs.begin(); it != rhs.end(); ++it, ++out)
290template<Numeric Scalar, Array A>
306template<Numeric Scalar, Array A>
309 A result(rhs.shape());
311 auto out = result.begin();
313 for (
auto it = rhs.begin(); it != rhs.end(); ++it, ++out)
315 if (*it ==
typename A::value_type{})
398template<Array A, Numeric Scalar>
413template<Array A, Numeric Scalar>
428template<Array A, Numeric Scalar>
444template<Array A, Numeric Scalar>
461 return arr *
typename A::value_type{-1};
A & operator+=(A &lhs, const A &rhs)
Adds an array to itself in place.
A & operator*=(A &lhs, const A &rhs)
Multiplies an array by another array in place.
A & operator/=(A &lhs, const A &rhs)
Divides an array by another array in place.
A & operator-=(A &lhs, const A &rhs)
Subtracts an array from itself in place.
A operator/(const A &lhs, const A &rhs)
Divides two arrays element by element.
void require_same_arithmetic_shape(const A &lhs, const A &rhs)
Verifies that two arrays have the same shape before arithmetic.
A operator+(const A &lhs, const A &rhs)
Adds two arrays element by element.
A operator-(const A &lhs, const A &rhs)
Subtracts two arrays element by element.
A operator*(const A &lhs, const A &rhs)
Multiplies two arrays element by element.
Shared runtime validation helpers.
Signals a division by zero.
Alias for any scalar type accepted by Stratax numeric containers.
void require_same_shape(const Lhs &lhs, const Rhs &rhs, const char *message)
Requires two array-like objects to have identical size and shape.