4.2. Elementwise Functions

4.2.1. acos

Description:  Elementwise arc cosine (inverse cosine).

Syntax: 

Vector<T> acos ( Vector<T> A );
 
Matrix<T> acos ( Matrix<T> A );
 
Tensor<T> acos ( Tensor<T> A );
 

Result:  Each element of the result view is set to arc or inverse cosine of the corresponding element of the argument. For instance, if the argument is a vector, Z = acos(A) produces a result equivalent to Z(i) = acos(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = acos(A);

See Also:  asin (section 4.2.5) atan (section 4.2.6) cos (section 4.2.14) sin (section 4.2.59) tan (section 4.2.64)

4.2.2. add

Description:  Elementwise addition.

Syntax: 

Vector<T> add ( Vector<T> A Vector<T> B );
 
Vector<T> add ( T a Vector<T> B );
 
Vector<T> add ( Vector<T> A T b );
 
Matrix<T> add ( Matrix<T> A Matrix<T> B );
 
Matrix<T> add ( T a Matrix<T> B );
 
Matrix<T> add ( Matrix<T> A T b );
 
Tensor<T> add ( Tensor<T> A Tensor<T> B );
 
Tensor<T> add ( T a Tensor<T> B );
 
Tensor<T> add ( Tensor<T> A T b );
 

Operator Syntax:  Addition can also be written in operator form. add(A, B) is equivalent to A + B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the sum of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = add(A, B) produces a result equivalent to Z(i) = A(i) + B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is added to all of the elements of the other argument; for example, Z = add(A, b) produces Z(i) = A(i) + b.

Example: 

Vector<float> Z, A, B;
Z = add(A, B);

See Also:  div (section 4.2.16) mul (section 4.2.51) sub (section 4.2.63)

4.2.3. am

Description:  Elementwise addition-multiplication.

Syntax: 

Vector<T> am ( Vector<T> A Vector<T> B Vector<T> C );
 
Matrix<T> am ( Matrix<T> A Matrix<T> B Matrix<T> C );
 
Tensor<T> am ( Tensor<T> A Tensor<T> B Tensor<T> C );
 

Operator Syntax:  Addition can also be written in operator form. am(A, B, C) is equivalent to (A + B) * C.

Requirements:  It is permissible for arguments to be scalar instead of a view. Scalars are treated a view with constant value. If multiple arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the sum-product of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = am(A, B, C) produces a result equivalent to Z(i) = (A(i) + B(i)) * C(i) for all of the elements of the vector. If any of the arguments are scalar, they are processed with all of the elements of the other arguments; for example, Z = am(A, b, C) produces Z(i) = (A(i) + b) * C.

Example: 

Vector<float> Z, A, B, C;
Z = am(A, B, C);

See Also:  ma (section 4.2.41) msb (section 4.2.50) sbm (section 4.2.58)

4.2.4. arg

Description:  Elementwise phase angle of complex.

Syntax: 

Vector<T> arg ( Vector<complex<T> > A );
 
Vector<T> arg ( Matrix<complex<T> > A );
 
Vector<T> arg ( Tensor<complex<T> > A );
 

Result:  Each element of the result view is set to the phase angle of the corresponding element of the argument. For instance, if the argument is a vector, Z = arg(A) produces a result equivalent to Z(i) = atan2(imag(A(i)), real(A(i))) for all the elements of the vector.

Example: 

Vector<complex<float> > A;
Vector<float> Z;
Z = arg(A);

See Also:  imag (section 4.2.27) real (section 4.2.55)

4.2.5. asin

Description:  Elementwise arc sine (inverse sine).

Syntax: 

Vector<T> asin ( Vector<T> A );
 
Matrix<T> asin ( Matrix<T> A );
 
Tensor<T> asin ( Tensor<T> A );
 

Result:  Each element of the result view is set to arc or inverse sine of the corresponding element of the argument. For instance, if the argument is a vector, Z = asin(A) produces a result equivalent to Z(i) = asin(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = asin(A);

See Also:  acos (section 4.2.1) atan (section 4.2.6) cos (section 4.2.14) sin (section 4.2.59) tan (section 4.2.64)

4.2.6. atan

Description:  Elementwise arc tangent (inverse tangent).

Syntax: 

Vector<T> atan ( Vector<T> A );
 
Matrix<T> atan ( Matrix<T> A );
 
Tensor<T> atan ( Tensor<T> A );
 

Result:  Each element of the result view is set to arc or inverse tangent of the corresponding element of the argument. For instance, if the argument is a vector, Z = atan(A) produces a result equivalent to Z(i) = atan(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = atan(A);

See Also:  acos (section 4.2.1) asin (section 4.2.5) cos (section 4.2.14) sin (section 4.2.59) tan (section 4.2.64)

4.2.7. atan2

Description:  Elementwise arc tangent of a quotient.

Syntax: 

Vector<T> atan2 ( Vector<T> A Vector<T> B );
 
Vector<T> atan2 ( T a Vector<T> B );
 
Vector<T> atan2 ( Vector<T> A T b );
 
Matrix<T> atan2 ( Matrix<T> A Matrix<T> B );
 
Matrix<T> atan2 ( T a Matrix<T> B );
 
Matrix<T> atan2 ( Matrix<T> A T b );
 
Tensor<T> atan2 ( Tensor<T> A Tensor<T> B );
 
Tensor<T> atan2 ( T a Tensor<T> B );
 
Tensor<T> atan2 ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the arc tangent of the quotient of the elements of the two arguments. For instance, if the arguments are vectors, Z = atan2(A, B) produces a result equivalent to Z(i) = atan2(A(i), B(i)) = atan(A(i) / B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is used as part of the quotient for all of the elements of the other argument; for example, Z = atan2(A, b) produces Z(i) = atan2(A(i), b).

Example: 

Vector<float> Z, A, B;
Z = atan2(A, B);

See Also:  atan (section 4.2.6) tan (section 4.2.64)

4.2.8. band

Description:  Elementwise bitwise and.

Syntax: 

Vector<T> band ( Vector<T> A Vector<T> B );
 
Vector<T> band ( T a Vector<T> B );
 
Vector<T> band ( Vector<T> A T b );
 
Matrix<T> band ( Matrix<T> A Matrix<T> B );
 
Matrix<T> band ( T a Matrix<T> B );
 
Matrix<T> band ( Matrix<T> A T b );
 
Tensor<T> band ( Tensor<T> A Tensor<T> B );
 
Tensor<T> band ( T a Tensor<T> B );
 
Tensor<T> band ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Value type T must support bitwise conjunction (bool, char, int, and so on).

Result:  Each element of the result value is set to the bitwise and of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = band(A, B) produces a result equivalent to Z(i) = band(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is bitwise anded to all all of the elements of the other argument; for example, Z = band(A, b) produces Z(i) = band(A(i), b).

Example: 

Vector<int> Z, A, B;
Z = band(A, B);

See Also:  bnot (section 4.2.10) bor (section 4.2.9) bxor (section 4.2.11)

4.2.9. bor

Description:  Elementwise bitwise or.

Syntax: 

Vector<T> bor ( Vector<T> A Vector<T> B );
 
Vector<T> bor ( T a Vector<T> B );
 
Vector<T> bor ( Vector<T> A T b );
 
Matrix<T> bor ( Matrix<T> A Matrix<T> B );
 
Matrix<T> bor ( T a Matrix<T> B );
 
Matrix<T> bor ( Matrix<T> A T b );
 
Tensor<T> bor ( Tensor<T> A Tensor<T> B );
 
Tensor<T> bor ( T a Tensor<T> B );
 
Tensor<T> bor ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Value type T must support bitwise disjunction (bool, char, int, and so on).

Result:  Each element of the result value is set to the bitwise or of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = bor(A, B) produces a result equivalent to Z(i) = bor(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is bitwise ored to all all of the elements of the other argument; for example, Z = bor(A, b) produces Z(i) = bor(A(i), b).

Example: 

Vector<int> Z, A, B;
Z = bor(A, B);

See Also:  band (section 4.2.8) bnot (section 4.2.10) bxor (section 4.2.11)

4.2.10. bnot

Description:  Elementwise bitwise negation.

Syntax: 

Vector<T> bnot ( Vector<T> A );
 
Matrix<T> bnot ( Matrix<T> A );
 
Tensor<T> bnot ( Tensor<T> A );
 

Result:  Each element of the result view is set to bitwise negation of the corresponding element of the argument. For instance, if the argument is a vector of int, Z = bnot(A) produces a result equivalent to Z(i) = ~A(i) for all the elements of the vector. Valid only on value types supporting bitwise negation (bool, char, int, and so on).

Example: 

Vector<bool> Z, A;
Z = neg(A);

See Also:  lnot (section 4.2.35) neg (section 4.2.53)

4.2.11. bxor

Description:  Elementwise bitwise exclusive or.

Syntax: 

Vector<T> bxor ( Vector<T> A Vector<T> B );
 
Vector<T> bxor ( T a Vector<T> B );
 
Vector<T> bxor ( Vector<T> A T b );
 
Matrix<T> bxor ( Matrix<T> A Matrix<T> B );
 
Matrix<T> bxor ( T a Matrix<T> B );
 
Matrix<T> bxor ( Matrix<T> A T b );
 
Tensor<T> bxor ( Tensor<T> A Tensor<T> B );
 
Tensor<T> bxor ( T a Tensor<T> B );
 
Tensor<T> bxor ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Value type T must support bitwise exlusive-or (bool, char, int, and so on).

Result:  Each element of the result value is set to the bitwise exclusive or of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = bxor(A, B) produces a result equivalent to Z(i) = bxor(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is bitwise exclusive ored to all all of the elements of the other argument; for example, Z = bxor(A, b) produces Z(i) = bxor(A(i), b).

Example: 

Vector<int> Z, A, B;
Z = bxor(A, B);

See Also:  band (section 4.2.8) bor (section 4.2.9) bnot (section 4.2.10)

4.2.12. ceil

Description:  Elementwise floating-point ceiling.

Syntax: 

Vector<T> ceil ( Vector<T> A );
 
Matrix<T> ceil ( Matrix<T> A );
 
Tensor<T> ceil ( Tensor<T> A );
 

Result:  Each element of the result view is set to the floating-point value of the argument view rounded up to the next integral value. For instance, if the argument is a vector, Z = ceil(A) produces a result equivalent to Z(i) = ceil(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = ceil(A);

See Also:  floor (section 4.2.22)

4.2.13. conj

Description:  Elementwise complex conjugate.

Syntax: 

Vector<T> conj ( Vector<T> A );
 
Matrix<T> conj ( Matrix<T> A );
 
Tensor<T> conj ( Tensor<T> A );
 

Result:  Each element of the result view is set to the complex conjugate of the corresponding element of the argument. For instance, if the argument is a vector, Z = conj(A) produces a result equivalent to Z(i) = conj(A(i)) for all the elements of the vector.

Example: 

Vector<complex<float> > Z, A;
Z = conj(A);

See Also:  real (section 4.2.55) imag (section 4.2.27)

4.2.14. cos

Description:  Elementwise trigonometric cosine.

Syntax: 

Vector<T> cos ( Vector<T> A );
 
Matrix<T> cos ( Matrix<T> A );
 
Tensor<T> cos ( Tensor<T> A );
 

Result:  Each element of the result view is set to cosine of the corresponding element of the argument. For instance, if the argument is a vector, Z = cos(A) produces a result equivalent to Z(i) = cos(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = cos(A);

See Also:  sin (section 4.2.59) tan (section 4.2.64)

4.2.15. cosh

Description:  Elementwise hyperbolic cosine.

Syntax: 

Vector<T> cosh ( Vector<T> A );
 
Matrix<T> cosh ( Matrix<T> A );
 
Tensor<T> cosh ( Tensor<T> A );
 

Result:  Each element of the result view is set to hyperbolic cosine of the corresponding element of the argument. For instance, if the argument is a vector, Z = cosh(A) produces a result equivalent to Z(i) = cosh(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = cosh(A);

See Also:  sinh (section 4.2.60) tanh (section 4.2.65)

4.2.16. div

Description:  Elementwise division.

Syntax: 

Vector<T> div ( Vector<T> A Vector<T> B );
 
Vector<T> div ( T a Vector<T> B );
 
Vector<T> div ( Vector<T> A T b );
 
Matrix<T> div ( Matrix<T> A Matrix<T> B );
 
Matrix<T> div ( T a Matrix<T> B );
 
Matrix<T> div ( Matrix<T> A T b );
 
Tensor<T> div ( Tensor<T> A Tensor<T> B );
 
Tensor<T> div ( T a Tensor<T> B );
 
Tensor<T> div ( Tensor<T> A T b );
 

Operator Syntax:  Division can also be written in operator form. div(A, B) is equivalent to A / B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the fraction of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = div(A, B) produces a result equivalent to Z(i) = A(i) / B(i) for all of the elements of the vector. If either of the arguments is a scalar, it either divides or is divided by all of the elements of the other argument; for example, Z = div(A, b) produces Z(i) = A(i) / b.

Example: 

Vector<float> Z, A, B;
Z = div(A, B);

See Also:  add (section 4.2.2) mul (section 4.2.51) sub (section 4.2.63)

4.2.17. eq

Description:  Elementwise equality comparison.

Syntax: 

Vector<bool> eq ( Vector<T> A Vector<T> B );
 
Vector<bool> eq ( T a Vector<T> B );
 
Vector<bool> eq ( Vector<T> A T b );
 
Matrix<bool> eq ( Matrix<T> A Matrix<T> B );
 
Matrix<bool> eq ( T a Matrix<T> B );
 
Matrix<bool> eq ( Matrix<T> A T b );
 
Tensor<bool> eq ( Tensor<T> A Tensor<T> B );
 
Tensor<bool> eq ( T a Tensor<T> B );
 
Tensor<bool> eq ( Tensor<T> A T b );
 

Operator Syntax:  Equality comparison can also be written in operator form. eq(A, B) is equivalent to A == B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to true if the corresponding elements of the two arguments are equal, false otherwise. For instance, if the arguments are vectors, Z = eq(A, B) produces a result equivalent to Z(i) = A(i) == B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is compared to all of the elements of the other argument; for example, Z = eq(A, b) produces Z(i) = A(i) == b.

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size), B(size);
Z = eq(A, B);

See Also:  ge (section 4.2.24) gt (section 4.2.25) le (section 4.2.34) lt (section 4.2.39) ne (section 4.2.52)

4.2.18. euler

Description:  Elementwise euler function.

Syntax: 

Vector<complex<T> > euler ( Vector<T> A );
 
Matrix<complex<T> > euler ( Matrix<T> A );
 
Tensor<complex<T> > euler ( Tensor<T> A );
 

Result:  Each element of the result view is a complex unit vector rotated by the angle given in the corresponding element of the argument. For instance, if the argument is a vector, Z = euler(A) produces a result equivalent to Z(i) = polar(1, A(i)) for all the elements of the vector.

Example: 

length_type size = 32;
Vector<float> A(size);
Vector<complex<float> > Z(size);
Z = euler(A);

See Also:  arg (section 4.2.4)

4.2.19. exp

Description:  Elementwise natural exponential.

Syntax: 

Vector<T> exp ( Vector<T> A );
 
Matrix<T> exp ( Matrix<T> A );
 
Tensor<T> exp ( Tensor<T> A );
 

Result:  Each element of the result view is set to natural exponential of the corresponding element of the argument. For instance, if the argument is a vector, Z = exp(A) produces a result equivalent to Z(i) = exp(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = exp(A);

See Also:  exp10 (section 4.2.20) log (section 4.2.36) log10 (section 4.2.37)

4.2.20. exp10

Description:  Elementwise base-10 exponential.

Syntax: 

Vector<T> exp10 ( Vector<T> A );
 
Matrix<T> exp10 ( Matrix<T> A );
 
Tensor<T> exp10 ( Tensor<T> A );
 

Result:  Each element of the result view is set to base-10 exponential of the corresponding element of the argument. For instance, if the argument is a vector, Z = exp10(A) produces a result equivalent to Z(i) = exp10(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = exp10(A);

See Also:  exp (section 4.2.19) log (section 4.2.36) log10 (section 4.2.37)

4.2.21. expoavg

Description:  Elementwise exponential average.

Syntax: 

Vector<T> expoavg ( Vector<T> A Vector<T> B Vector<T> C );
 
Matrix<T> expoavg ( Matrix<T> A Matrix<T> B Matrix<T> C );
 
Tensor<T> expoavg ( Tensor<T> A Tensor<T> B Tensor<T> C );
 

Operator Syntax:  Addition can also be written in operator form. expoavg(A, B, C) is equivalent to A*B + (1-A)*C.

Requirements:  It is permissible for arguments to be scalar instead of a view. Scalars are treated a view with constant value. If multiple arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the exponential average of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = expoavg(A, B, C) produces a result equivalent to Z(i) = A(i) * B(i)) + (1 - A(i)) * C(i) for all of the elements of the vector. If any of the arguments are scalar, they are processed with all of the elements of the other arguments; for example, Z = expoavg(A, b, C) produces Z(i) = A(i) * b + (1 - A(i)) * C(i).

Example: 

Vector<float> Z, A, B, C;
Z = expoavg(A, B, C);

See Also: 

4.2.22. floor

Description:  Elementwise floating-point floor.

Syntax: 

Vector<T> floor ( Vector<T> A );
 
Matrix<T> floor ( Matrix<T> A );
 
Tensor<T> floor ( Tensor<T> A );
 

Result:  Each element of the result view is set to the floating-point value of the argument view rounded down to the next integral value. For instance, if the argument is a vector, Z = floor(A) produces a result equivalent to Z(i) = floor(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = floor(A);

See Also:  ceil (section 4.2.12)

4.2.23. fmod

Description:  Floating-point modulo (remainder after division).

Syntax: 

Vector<T> fmod ( Vector<T> A Vector<T> B );
 
Vector<T> fmod ( T a Vector<T> B );
 
Vector<T> fmod ( Vector<T> A T b );
 
Matrix<T> fmod ( Matrix<T> A Matrix<T> B );
 
Matrix<T> fmod ( T a Matrix<T> B );
 
Matrix<T> fmod ( Matrix<T> A T b );
 
Tensor<T> fmod ( Tensor<T> A Tensor<T> B );
 
Tensor<T> fmod ( T a Tensor<T> B );
 
Tensor<T> fmod ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the sum of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = fmod(A, B) produces a result equivalent to Z(i) = fmod(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is fmoded to all of the elements of the other argument; for example, Z = fmod(A, b) produces Z(i) = fmod(A(i), b).

Example: 

Vector<float> Z, A, B;
Z = fmod(A, B);

See Also: 

4.2.24. ge

Description:  Elementwise greater-than or equal comparison.

Syntax: 

Vector<bool> ge ( Vector<T> A Vector<T> B );
 
Vector<bool> ge ( T a Vector<T> B );
 
Vector<bool> ge ( Vector<T> A T b );
 
Matrix<bool> ge ( Matrix<T> A Matrix<T> B );
 
Matrix<bool> ge ( T a Matrix<T> B );
 
Matrix<bool> ge ( Matrix<T> A T b );
 
Tensor<bool> ge ( Tensor<T> A Tensor<T> B );
 
Tensor<bool> ge ( T a Tensor<T> B );
 
Tensor<bool> ge ( Tensor<T> A T b );
 

Operator Syntax:  Greater-than or equal comparison can also be written in operator form. ge(A, B) is equivalent to A >= B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to true if the corresponding elements of the first argument is greater-than or equal the second argument, false otherwise. For instance, if the arguments are vectors, Z = ge(A, B) produces a result equivalent to Z(i) = A(i) >= B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is compared to all of the elements of the other argument; for example, Z = ge(A, b) produces Z(i) = A(i) >= b.

Example: 

Vector<bool> Z;
Vector<float> A, B;
Z = ge(A, B);

See Also:  eq (section 4.2.17) gt (section 4.2.25) le (section 4.2.34) lt (section 4.2.39) ne (section 4.2.52)

4.2.25. gt

Description:  Elementwise greater-than comparison.

Syntax: 

Vector<bool> gt ( Vector<T> A Vector<T> B );
 
Vector<bool> gt ( T a Vector<T> B );
 
Vector<bool> gt ( Vector<T> A T b );
 
Matrix<bool> gt ( Matrix<T> A Matrix<T> B );
 
Matrix<bool> gt ( T a Matrix<T> B );
 
Matrix<bool> gt ( Matrix<T> A T b );
 
Tensor<bool> gt ( Tensor<T> A Tensor<T> B );
 
Tensor<bool> gt ( T a Tensor<T> B );
 
Tensor<bool> gt ( Tensor<T> A T b );
 

Operator Syntax:  Greater-than comparison can also be written in operator form. gt(A, B) is equivalent to A > B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to true if the corresponding elements of the first argument is greater-than the second argument, false otherwise. For instance, if the arguments are vectors, Z = gt(A, B) produces a result equivalent to Z(i) = A(i) > B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is compared to all of the elements of the other argument; for example, Z = gt(A, b) produces Z(i) = A(i) > b.

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size), B(size);
Z = gt(A, B);

See Also:  eq (section 4.2.17) ge (section 4.2.24) le (section 4.2.34) lt (section 4.2.39) ne (section 4.2.52)

4.2.26. hypot

Description:  Hypotenuse of right triangle.

Syntax: 

Vector<T> hypot ( Vector<T> A Vector<T> B );
 
Vector<T> hypot ( T a Vector<T> B );
 
Vector<T> hypot ( Vector<T> A T b );
 
Matrix<T> hypot ( Matrix<T> A Matrix<T> B );
 
Matrix<T> hypot ( T a Matrix<T> B );
 
Matrix<T> hypot ( Matrix<T> A T b );
 
Tensor<T> hypot ( Tensor<T> A Tensor<T> B );
 
Tensor<T> hypot ( T a Tensor<T> B );
 
Tensor<T> hypot ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to the square-root of the sum of sqaures of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = hypot(A, B) produces a result equivalent to Z(i) = sqrt(sq(A(i)) + sq(B(i))) for all of the elements of the vector. If either of the arguments is a scalar, it is used with all of the elements of the other argument; for example, Z = hypot(A, b) produces Z(i) = sqrt(sq(A(i)) + sq(b)).

Example: 

Vector<float> Z, A, B;
Z = hypot(A, B);

See Also:  atan2 (section 4.2.7)

4.2.27. imag

Description:  Elementwise imaginary part of complex.

Syntax: 

Vector<T> imag ( Vector<complex<T> > A );
 
Vector<T> imag ( Matrix<complex<T> > A );
 
Vector<T> imag ( Tensor<complex<T> > A );
 

Result:  Each element of the result view is set to the imaginary component of the corresponding element of the argument. For instance, if the argument is a vector, Z = imag(A) produces a result equivalent to Z(i) = imag(A(i)) for all the elements of the vector.

Example: 

Vector<complex<float> > A;
Vector<float> Z;
Z = imag(A);

See Also:  arg (section 4.2.4) real (section 4.2.55)

4.2.28. is_finite

Description:  Elementwise check for finite floating-point value.

Syntax: 

Vector<bool> is_finite ( Vector<T> A );
 
Matrix<bool> is_finite ( Matrix<T> A );
 
Tensor<bool> is_finite ( Tensor<T> A );
 

Result:  Each element of the result view is set to true of the corresponding element of the argument is a finite floating-point value, false otherwise. For instance, if the argument is a vector, Z = is_finite(A) produces a result equivalent to Z(i) = is_finite(A(i)) for all the elements of the vector. For arguments with complex value type, output is conjunction of is_finite for real and imaginary components. Z(i) = is_finite(real(A(i))) && is_finite(imag(A(i))).

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size);
Z = is_finite(A);

See Also:  is_nan (section 4.2.29) is_normal (section 4.2.30)

4.2.29. is_nan

Description:  Elementwise check for floating-point NaN (not a number).

Syntax: 

Vector<bool> is_nan ( Vector<T> A );
 
Matrix<bool> is_nan ( Matrix<T> A );
 
Tensor<bool> is_nan ( Tensor<T> A );
 

Result:  Each element of the result view is set to true of the corresponding element of the argument is a NaN (not a number), false otherwise. For instance, if the argument is a vector, Z = is_nan(A) produces a result equivalent to Z(i) = is_nan(A(i)) for all the elements of the vector. For arguments with complex value type, output is conjunction of is_nan for real and imaginary components. Z(i) = is_nan(real(A(i))) && is_nan(imag(A(i))).

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size);
Z = is_nan(A);

See Also:  is_finite (section 4.2.28) is_normal (section 4.2.30)

4.2.30. is_normal

Description:  Elementwise check for floating-point normal value.

Syntax: 

Vector<bool> is_normal ( Vector<T> A );
 
Matrix<bool> is_normal ( Matrix<T> A );
 
Tensor<bool> is_normal ( Tensor<T> A );
 

Result:  Each element of the result view is set to true of the corresponding element of the argument is a normal floating-point value, false otherwise. For instance, if the argument is a vector, Z = is_normal(A) produces a result equivalent to Z(i) = is_normal(A(i)) for all the elements of the vector. For arguments with complex value type, output is conjunction of is_normal for real and imaginary components. Z(i) = is_normal(real(A(i))) && is_normal(imag(A(i))).

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size);
Z = is_normal(A);

See Also:  is_finite (section 4.2.28) is_nan (section 4.2.29)

4.2.31. ite

Description:  Elementwise if-then-else.

Syntax: 

Vector<T> ite ( Vector<bool> A Vector<T> B Vector<T> C );
 
Matrix<T> ite ( Matrix<bool> A Matrix<T> B Matrix<T> C );
 
Tensor<T> ite ( Tensor<bool> A Tensor<T> B Tensor<T> C );
 

Requirements:  It is permissible for arguments to be scalar instead of a view. Scalars are treated a view with constant value. If multiple arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the if-then-else evaluation of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = ite(A, B, C) produces a result equivalent to Z(i) = A(i) ? B(i) : C(i) for all of the elements of the vector. If any of the arguments are scalar, they are processed with all of the elements of the other arguments; for example, Z = ite(A, b, C) produces Z(i) = A(i) ? b : C(i).

Example: 

Vector<float> Z, A, B, C;
Z = ite(A, B, C);

See Also: 

4.2.32. jmul

Description:  Elementwise multiplication by conjugate.

Syntax: 

Vector<T> jmul ( Vector<T> A Vector<T> B );
 
Vector<T> jmul ( T a Vector<T> B );
 
Vector<T> jmul ( Vector<T> A T b );
 
Matrix<T> jmul ( Matrix<T> A Matrix<T> B );
 
Matrix<T> jmul ( T a Matrix<T> B );
 
Matrix<T> jmul ( Matrix<T> A T b );
 
Tensor<T> jmul ( Tensor<T> A Tensor<T> B );
 
Tensor<T> jmul ( T a Tensor<T> B );
 
Tensor<T> jmul ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension. Value type must be complex.

Result:  Each element of the result value is set to the product of the corresponding element of the first argument with the conjugate of the second argument. For instance, if the arguments are vectors, Z = jmul(A, B) produces a result equivalent to Z(i) = A(i) * conj(B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is scales all of the elements of the other argument; for example, Z = jmul(A, b) produces Z(i) = A(i) * conj(b).

Example: 

Vector<complex<float> > Z, A, B;
Z = jmul(A, B);

See Also:  mul (section 4.2.51)

4.2.33. land

Description:  Elementwise logical and.

Syntax: 

Vector<T> land ( Vector<T> A Vector<T> B );
 
Vector<T> land ( T a Vector<T> B );
 
Vector<T> land ( Vector<T> A T b );
 
Matrix<T> land ( Matrix<T> A Matrix<T> B );
 
Matrix<T> land ( T a Matrix<T> B );
 
Matrix<T> land ( Matrix<T> A T b );
 
Tensor<T> land ( Tensor<T> A Tensor<T> B );
 
Tensor<T> land ( T a Tensor<T> B );
 
Tensor<T> land ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension. Value type T must be bool.

Result:  Each element of the result value is set to the logical and of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = land(A, B) produces a result equivalent to Z(i) = land(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is logical anded to all all of the elements of the other argument; for example, Z = land(A, b) produces Z(i) = land(A(i), b).

Example: 

Vector<bool> Z, A, B;
Z = land(A, B);

See Also:  bnot (section 4.2.35) bor (section 4.2.38) bxor (section 4.2.40)

4.2.34. le

Description:  Elementwise less-than or equal comparison.

Syntax: 

Vector<bool> le ( Vector<T> A Vector<T> B );
 
Vector<bool> le ( T a Vector<T> B );
 
Vector<bool> le ( Vector<T> A T b );
 
Matrix<bool> le ( Matrix<T> A Matrix<T> B );
 
Matrix<bool> le ( T a Matrix<T> B );
 
Matrix<bool> le ( Matrix<T> A T b );
 
Tensor<bool> le ( Tensor<T> A Tensor<T> B );
 
Tensor<bool> le ( T a Tensor<T> B );
 
Tensor<bool> le ( Tensor<T> A T b );
 

Operator Syntax:  less-than or equal comparison can also be written in operator form. le(A, B) is equivalent to A <= B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to true if the corresponding elements of the first argument is less-than or equal the second argument, false otherwise. For instance, if the arguments are vectors, Z = le(A, B) produces a result equivalent to Z(i) = A(i) <= B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is compared to all of the elements of the other argument; for example, Z = le(A, b) produces Z(i) = A(i) <= b.

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size), B(size);
Z = le(A, B);

See Also:  eq (section 4.2.17) ge (section 4.2.24) gt (section 4.2.25) lt (section 4.2.39) ne (section 4.2.52)

4.2.35. lnot

Description:  Elementwise logical negation.

Syntax: 

Vector<T> lnot ( Vector<T> A );
 
Matrix<T> lnot ( Matrix<T> A );
 
Tensor<T> lnot ( Tensor<T> A );
 

Result:  Each element of the result view is set to logical negation of the corresponding element of the argument. For instance, if the argument is a vector of bool, Z = lnot(A) produces a result equivalent to Z(i) = !A(i) for all the elements of the vector. Valid only on value types supporting logical negation (bool, char, int, and so on).

Example: 

Vector<bool> Z, A;
Z = lnot(A);

See Also:  bnot (section 4.2.10) neg (section 4.2.53)

4.2.36. log

Description:  Elementwise natural logarithm.

Syntax: 

Vector<T> log ( Vector<T> A );
 
Matrix<T> log ( Matrix<T> A );
 
Tensor<T> log ( Tensor<T> A );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result view is set to natural logarithm of the corresponding element of the argument. For instance, if the argument is a vector, Z = log(A) produces a result equivalent to Z(i) = log(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = log(A);

See Also:  exp (section 4.2.19) exp10 (section 4.2.20) log10 (section 4.2.37)

4.2.37. log10

Description:  Elementwise base-10 logarithm.

Syntax: 

Vector<T> log10 ( Vector<T> A );
 
Matrix<T> log10 ( Matrix<T> A );
 
Tensor<T> log10 ( Tensor<T> A );
 

Result:  Each element of the result view is set to base-10 logarithm of the corresponding element of the argument. For instance, if the argument is a vector, Z = log10(A) produces a result equivalent to Z(i) = log10(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = log10(A);

See Also:  exp (section 4.2.19) exp10 (section 4.2.20) log (section 4.2.36)

4.2.38. lor

Description:  Elementwise logical or.

Syntax: 

Vector<T> lor ( Vector<T> A Vector<T> B );
 
Vector<T> lor ( T a Vector<T> B );
 
Vector<T> lor ( Vector<T> A T b );
 
Matrix<T> lor ( Matrix<T> A Matrix<T> B );
 
Matrix<T> lor ( T a Matrix<T> B );
 
Matrix<T> lor ( Matrix<T> A T b );
 
Tensor<T> lor ( Tensor<T> A Tensor<T> B );
 
Tensor<T> lor ( T a Tensor<T> B );
 
Tensor<T> lor ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension. Value type T must support logical negation (bool, char, int, and so on).

Result:  Each element of the result value is set to the logical or of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = lor(A, B) produces a result equivalent to Z(i) = lor(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is logical ored to all all of the elements of the other argument; for example, Z = lor(A, b) produces Z(i) = lor(A(i), b).

Example: 

Vector<bool> Z, A, B;
Z = lor(A, B);

See Also:  land (section 4.2.33) lnot (section 4.2.35) lxor (section 4.2.40)

4.2.39. lt

Description:  Elementwise less-than comparison.

Syntax: 

Vector<bool> lt ( Vector<T> A Vector<T> B );
 
Vector<bool> lt ( T a Vector<T> B );
 
Vector<bool> lt ( Vector<T> A T b );
 
Matrix<bool> lt ( Matrix<T> A Matrix<T> B );
 
Matrix<bool> lt ( T a Matrix<T> B );
 
Matrix<bool> lt ( Matrix<T> A T b );
 
Tensor<bool> lt ( Tensor<T> A Tensor<T> B );
 
Tensor<bool> lt ( T a Tensor<T> B );
 
Tensor<bool> lt ( Tensor<T> A T b );
 

Operator Syntax:  Less-than comparison can also be written in operator form. lt(A, B) is equivalent to A < B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to true if the corresponding elements of the first argument is less-than the second argument, false otherwise. For instance, if the arguments are vectors, Z = lt(A, B) produces a result equivalent to Z(i) = A(i) < B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is compared to all of the elements of the other argument; for example, Z = lt(A, b) produces Z(i) = A(i) < b.

Example: 

length_type size = 32;
Vector<bool> Z(size);
Vector<float> A(size), B(size);
Z = lt(A, B);

See Also:  eq (section 4.2.17) ge (section 4.2.24) gt (section 4.2.25) le (section 4.2.34) ne (section 4.2.52)

4.2.40. lxor

Description:  Elementwise bitwise exclusive or.

Syntax: 

Vector<T> lxor ( Vector<T> A Vector<T> B );
 
Vector<T> lxor ( T a Vector<T> B );
 
Vector<T> lxor ( Vector<T> A T b );
 
Matrix<T> lxor ( Matrix<T> A Matrix<T> B );
 
Matrix<T> lxor ( T a Matrix<T> B );
 
Matrix<T> lxor ( Matrix<T> A T b );
 
Tensor<T> lxor ( Tensor<T> A Tensor<T> B );
 
Tensor<T> lxor ( T a Tensor<T> B );
 
Tensor<T> lxor ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension. Value type T must support bitwise negation (bool, char, int, and so on).

Result:  Each element of the result value is set to the bitwise exclusive or of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = lxor(A, B) produces a result equivalent to Z(i) = lxor(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is bitwise exclusive ored to all all of the elements of the other argument; for example, Z = lxor(A, b) produces Z(i) = lxor(A(i), b).

Example: 

Vector<bool> Z, A, B;
Z = lxor(A, B);

See Also:  land (section 4.2.33) lor (section 4.2.38) lnot (section 4.2.35)

4.2.41. ma

Description:  Elementwise multiplication-addition.

Syntax: 

Vector<T> ma ( Vector<T> A Vector<T> B Vector<T> C );
 
Matrix<T> ma ( Matrix<T> A Matrix<T> B Matrix<T> C );
 
Tensor<T> ma ( Tensor<T> A Tensor<T> B Tensor<T> C );
 

Operator Syntax:  Addition can also be written in operator form. ma(A, B, C) is equivalent to (A * B) + C.

Requirements:  It is permissible for arguments to be scalar instead of a view. Scalars are treated a view with constant value. If multiple arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the product-sum of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = ma(A, B, C) produces a result equivalent to Z(i) = (A(i) * B(i)) + C(i) for all of the elements of the vector. If any of the arguments are scalar, they are processed with all of the elements of the other arguments; for example, Z = ma(A, b, C) produces Z(i) = (A(i) * b) + C(i).

Example: 

Vector<float> Z, A, B, C;
Z = ma(A, B, C);

See Also:  am (section 4.2.3) msb (section 4.2.50) sbm (section 4.2.58)

4.2.42. mag

Description:  Elementwise magnitude.

Syntax: 

Vector<T> mag ( Vector<T> A );
 
Vector<T> mag ( Vector<complex<T> > A );
 
Matrix<T> mag ( Matrix<T> A );
 
Matrix<T> mag ( Matrix<complex<T> > A );
 
Tensor<T> mag ( Tensor<T> A );
 
Tensor<T> mag ( Tensor<complex<T> > A );
 

Result:  Each element of the result view is set to the magnitude (equivalently the absolute value) of the corresponding element of the argument. For instance, if the argument is a vector, Z = mag(A) produces a result equivalent to Z(i) = mag(A(i)) for all the elements of the vector. If argument is a view of scalars, return type is a view of scalars. If argument is a view of complex, return type is a view of scalars.

Example: 

Vector<float> Z, A;
Z = mag(A);

See Also:  magsq (section 4.2.43)

4.2.43. magsq

Description:  Elementwise magnitude squared.

Syntax: 

Vector<T> magsq ( Vector<T> A );
 
Vector<T> magsq ( Vector<complex<T> > A );
 
Matrix<T> magsq ( Matrix<T> A );
 
Matrix<T> magsq ( Matrix<complex<T> > A );
 
Tensor<T> magsq ( Tensor<T> A );
 
Tensor<T> magsq ( Tensor<complex<T> > A );
 

Result:  Each element of the result view is set to the magnitude squared of the corresponding element of the argument. For instance, if the argument is a vector, Z = magsq(A) produces a result equivalent to Z(i) = magsq(A(i)) for all the elements of the vector. For views of scalars, return type is a view of scalars. For views of complex, return type is a view of scalars.

Example: 

Vector<float> Z, A;
Z = magsq(A);

See Also:  mag (section 4.2.42)

4.2.44. max

Description:  Elementwise maxima.

Syntax: 

Vector<T> max ( Vector<T> A Vector<T> B );
 
Vector<T> max ( T a Vector<T> B );
 
Vector<T> max ( Vector<T> A T b );
 
Matrix<T> max ( Matrix<T> A Matrix<T> B );
 
Matrix<T> max ( T a Matrix<T> B );
 
Matrix<T> max ( Matrix<T> A T b );
 
Tensor<T> max ( Tensor<T> A Tensor<T> B );
 
Tensor<T> max ( T a Tensor<T> B );
 
Tensor<T> max ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to the maxima of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = max(A, B) produces a result equivalent to Z(i) = max(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is compared with all of the elements of the other argument; for example, Z = max(A, b) produces Z(i) = max(A(i), b).

Example: 

Vector<float> Z, A, B;
Z = max(A, B);

See Also:  maxmg (section 4.2.45) maxmgsq (section 4.2.46) min (section 4.2.47) minmg (section 4.2.48) minmgsq (section 4.2.49)

4.2.45. maxmg

Description:  Elementwise magnitude maxima.

Syntax: 

Vector<T> maxmg ( Vector<T> A Vector<T> B );
 
Vector<T> maxmg ( T a Vector<T> B );
 
Vector<T> maxmg ( Vector<T> A T b );
 
Matrix<T> maxmg ( Matrix<T> A Matrix<T> B );
 
Matrix<T> maxmg ( T a Matrix<T> B );
 
Matrix<T> maxmg ( Matrix<T> A T b );
 
Tensor<T> maxmg ( Tensor<T> A Tensor<T> B );
 
Tensor<T> maxmg ( T a Tensor<T> B );
 
Tensor<T> maxmg ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the maxima of the magnitudes of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = maxmg(A, B) produces a result equivalent to Z(i) = max(mag(A(i)), mag(B(i))) for all of the elements of the vector. If either of the arguments is a scalar, it is compared with all of the elements of the other argument; for example, Z = maxmg(A, b) produces Z(i) = max(mag(A(i)), mag(b)).

Example: 

Vector<float> Z, A, B;
Z = maxmg(A, B);

See Also:  max (section 4.2.44) maxmgsq (section 4.2.46) min (section 4.2.47) minmg (section 4.2.48) minmgsq (section 4.2.49)

4.2.46. maxmgsq

Description:  Elementwise magnitude-squared maxima.

Syntax: 

Vector<T> maxmgsq ( Vector<T> A Vector<T> B );
 
Vector<T> maxmgsq ( T a Vector<T> B );
 
Vector<T> maxmgsq ( Vector<T> A T b );
 
Matrix<T> maxmgsq ( Matrix<T> A Matrix<T> B );
 
Matrix<T> maxmgsq ( T a Matrix<T> B );
 
Matrix<T> maxmgsq ( Matrix<T> A T b );
 
Tensor<T> maxmgsq ( Tensor<T> A Tensor<T> B );
 
Tensor<T> maxmgsq ( T a Tensor<T> B );
 
Tensor<T> maxmgsq ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to the maxima of the magnitudes squared of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = maxmgsq(A, B) produces a result equivalent to Z(i) = max(mag(sq(A(i))), mag(sq(B(i)))) for all of the elements of the vector. If either of the arguments is a scalar, it is compared with all of the elements of the other argument; for example, Z = maxmgsq(A, b) produces Z(i) = max(mag(sq(A(i))), mag(sq(b))).

Example: 

Vector<float> Z, A, B;
Z = maxmgsq(A, B);

See Also:  max (section 4.2.44) maxmg (section 4.2.45) min (section 4.2.47) minmg (section 4.2.48) minmgsq (section 4.2.49)

4.2.47. min

Description:  Elementwise minima.

Syntax: 

Vector<T> min ( Vector<T> A Vector<T> B );
 
Vector<T> min ( T a Vector<T> B );
 
Vector<T> min ( Vector<T> A T b );
 
Matrix<T> min ( Matrix<T> A Matrix<T> B );
 
Matrix<T> min ( T a Matrix<T> B );
 
Matrix<T> min ( Matrix<T> A T b );
 
Tensor<T> min ( Tensor<T> A Tensor<T> B );
 
Tensor<T> min ( T a Tensor<T> B );
 
Tensor<T> min ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to the minima of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = min(A, B) produces a result equivalent to Z(i) = min(A(i), B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is compared with all of the elements of the other argument; for example, Z = min(A, b) produces Z(i) = min(A(i), b).

Example: 

Vector<float> Z, A, B;
Z = min(A, B);

See Also:  max (section 4.2.44) maxmg (section 4.2.45) maxmgsq (section 4.2.46) minmg (section 4.2.48) minmgsq (section 4.2.49)

4.2.48. minmg

Description:  Elementwise magnitude minima.

Syntax: 

Vector<T> minmg ( Vector<T> A Vector<T> B );
 
Vector<T> minmg ( T a Vector<T> B );
 
Vector<T> minmg ( Vector<T> A T b );
 
Matrix<T> minmg ( Matrix<T> A Matrix<T> B );
 
Matrix<T> minmg ( T a Matrix<T> B );
 
Matrix<T> minmg ( Matrix<T> A T b );
 
Tensor<T> minmg ( Tensor<T> A Tensor<T> B );
 
Tensor<T> minmg ( T a Tensor<T> B );
 
Tensor<T> minmg ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the minima of the magnitudes of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = minmg(A, B) produces a result equivalent to Z(i) = min(mag(A(i)), mag(B(i))) for all of the elements of the vector. If either of the arguments is a scalar, it is compared with all of the elements of the other argument; for example, Z = minmg(A, b) produces Z(i) = min(mag(A(i)), mag(b)).

Example: 

Vector<float> Z;
Vector<complex<float> > A, B;
Z = minmg(A, B);

See Also:  max (section 4.2.44) maxmg (section 4.2.45) maxmgsq (section 4.2.46) min (section 4.2.47) minmgsq (section 4.2.49)

4.2.49. minmgsq

Description:  Elementwise magnitude-squared minima.

Syntax: 

Vector<T> minmgsq ( Vector<T> A Vector<T> B );
 
Vector<T> minmgsq ( T a Vector<T> B );
 
Vector<T> minmgsq ( Vector<T> A T b );
 
Matrix<T> minmgsq ( Matrix<T> A Matrix<T> B );
 
Matrix<T> minmgsq ( T a Matrix<T> B );
 
Matrix<T> minmgsq ( Matrix<T> A T b );
 
Tensor<T> minmgsq ( Tensor<T> A Tensor<T> B );
 
Tensor<T> minmgsq ( T a Tensor<T> B );
 
Tensor<T> minmgsq ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to the minima of the magnitudes squared of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = minmgsq(A, B) produces a result equivalent to Z(i) = min(mag(sq(A(i))), mag(sq(B(i)))) for all of the elements of the vector. If either of the arguments is a scalar, it is compared with all of the elements of the other argument; for example, Z = minmgsq(A, b) produces Z(i) = min(mag(sq(A(i))), mag(sq(b))).

Example: 

Vector<float> Z;
Vector<complex<float> > A, B;
Z = minmgsq(A, B);

See Also:  max (section 4.2.44) maxmg (section 4.2.45) maxmgsq (section 4.2.46) min (section 4.2.47) minmg (section 4.2.48)

4.2.50. msb

Description:  Elementwise multiplication-addition.

Syntax: 

Vector<T> msb ( Vector<T> A Vector<T> B Vector<T> C );
 
Matrix<T> msb ( Matrix<T> A Matrix<T> B Matrix<T> C );
 
Tensor<T> msb ( Tensor<T> A Tensor<T> B Tensor<T> C );
 

Operator Syntax:  Addition can also be written in operator form. msb(A, B, C) is equivalent to (A * B) - C.

Requirements:  It is permissible for arguments to be scalar instead of a view. Scalars are treated a view with constant value. If multiple arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the product-difference of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = msb(A, B, C) produces a result equivalent to Z(i) = (A(i) * B(i)) - C(i) for all of the elements of the vector. If any of the arguments are scalar, they are processed with all of the elements of the other arguments; for example, Z = msb(A, b, C) produces Z(i) = (A(i) * b) - C(i).

Example: 

Vector<float> Z, A, B, C;
Z = msb(A, B, C);

See Also:  am (section 4.2.3) msb (section 4.2.41) sbm (section 4.2.58)

4.2.51. mul

Description:  Elementwise multiplication.

Syntax: 

Vector<T> mul ( Vector<T> A Vector<T> B );
 
Vector<T> mul ( T a Vector<T> B );
 
Vector<T> mul ( Vector<T> A T b );
 
Matrix<T> mul ( Matrix<T> A Matrix<T> B );
 
Matrix<T> mul ( T a Matrix<T> B );
 
Matrix<T> mul ( Matrix<T> A T b );
 
Tensor<T> mul ( Tensor<T> A Tensor<T> B );
 
Tensor<T> mul ( T a Tensor<T> B );
 
Tensor<T> mul ( Tensor<T> A T b );
 

Operator Syntax:  Multiplication can also be written in operator form. mul(A, B) is equivalent to A * B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the product of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = mul(A, B) produces a result equivalent to Z(i) = A(i) * B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is scales all of the elements of the other argument; for example, Z = mul(A, b) produces Z(i) = A(i) * b.

Example: 

Vector<float> Z, A, B;
Z = mul(A, B);

See Also:  add (section 4.2.2) div (section 4.2.16) sub (section 4.2.63)

4.2.52. ne

Description:  Elementwise not-equal comparison.

Syntax: 

Vector<bool> ne ( Vector<T> A Vector<T> B );
 
Vector<bool> ne ( T a Vector<T> B );
 
Vector<bool> ne ( Vector<T> A T b );
 
Matrix<bool> ne ( Matrix<T> A Matrix<T> B );
 
Matrix<bool> ne ( T a Matrix<T> B );
 
Matrix<bool> ne ( Matrix<T> A T b );
 
Tensor<bool> ne ( Tensor<T> A Tensor<T> B );
 
Tensor<bool> ne ( T a Tensor<T> B );
 
Tensor<bool> ne ( Tensor<T> A T b );
 

Operator Syntax:  Not-equal comparison can also be written in operator form. ne(A, B) is equivalent to A != B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to true if the corresponding elements of the two arguments are not equal, false otherwise. For instance, if the arguments are vectors, Z = ne(A, B) produces a result equivalent to Z(i) = A(i) != B(i) for all of the elements of the vector. If either of the arguments is a scalar, it is compared to all of the elements of the other argument; for example, Z = ne(A, b) produces Z(i) = A(i) != b.

Example: 

Vector<bool> Z;
Vector<float> A, B;
Z = ne(A, B);

See Also:  ge (section 4.2.24) gt (section 4.2.25) le (section 4.2.34) lt (section 4.2.39) ne (section 4.2.52)

4.2.53. neg

Description:  Elementwise arithmetic negation.

Syntax: 

Vector<T> neg ( Vector<T> A );
 
Matrix<T> neg ( Matrix<T> A );
 
Tensor<T> neg ( Tensor<T> A );
 

Result:  Each element of the result view is set to arithmetic negation of the corresponding element of the argument. For instance, if the argument is a vector, Z = neg(A) produces a result equivalent to Z(i) = -A(i) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = neg(A);

See Also:  bnot (section 4.2.10) lnot (section 4.2.35)

4.2.54. pow

Description:  Elementwise raise to power.

Syntax: 

Vector<T> pow ( Vector<T> A Vector<T> B );
 
Vector<T> pow ( T a Vector<T> B );
 
Vector<T> pow ( Vector<T> A T b );
 
Matrix<T> pow ( Matrix<T> A Matrix<T> B );
 
Matrix<T> pow ( T a Matrix<T> B );
 
Matrix<T> pow ( Matrix<T> A T b );
 
Tensor<T> pow ( Tensor<T> A Tensor<T> B );
 
Tensor<T> pow ( T a Tensor<T> B );
 
Tensor<T> pow ( Tensor<T> A T b );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is set to the power of the corresponding elements of the first argument to the second argument. For instance, if the arguments are vectors, Z = pow(A, B) produces a result equivalent to Z(i) = pow(A(i) ** B(i)) for all of the elements of the vector. If either of the arguments is a scalar, it is used with all of the elements of the other argument; for example, Z = pow(A, b) produces Z(i) = A(i) ** b.

Example: 

Vector<float> Z, A, B;
Z = pow(A, B);

See Also:  div (section 4.2.16) mul (section 4.2.51) sub (section 4.2.63)

4.2.55. real

Description:  Elementwise real part of complex.

Syntax: 

Vector<T> real ( Vector<complex<T> > A );
 
Vector<T> real ( Matrix<complex<T> > A );
 
Vector<T> real ( Tensor<complex<T> > A );
 

Result:  Each element of the result view is set to the real component of the corresponding element of the argument. For instance, if the argument is a vector, Z = real(A) produces a result equivalent to Z(i) = real(A(i)) for all the elements of the vector.

Example: 

Vector<complex<float> > A;
Vector<float> Z;
Z = real(A);

See Also:  arg (section 4.2.4) imag (section 4.2.27)

4.2.56. recip

Description:  Elementwise recipricol.

Syntax: 

Vector<T> recip ( Vector<T> A );
 
Matrix<T> recip ( Matrix<T> A );
 
Tensor<T> recip ( Tensor<T> A );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result view is set to the recipricol square root of the corresponding element of the argument. For instance, if the argument is a vector, Z = recip(A) produces a result equivalent to Z(i) = 1 / A(i) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = recip(A);

See Also:  rsqrt (section 4.2.57)

4.2.57. rsqrt

Description:  Elementwise recipricol square root.

Syntax: 

Vector<T> rsqrt ( Vector<T> A );
 
Matrix<T> rsqrt ( Matrix<T> A );
 
Tensor<T> rsqrt ( Tensor<T> A );
 

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result view is set to the recipricol square root of the corresponding element of the argument. For instance, if the argument is a vector, Z = rsqrt(A) produces a result equivalent to Z(i) = 1 / sqrt(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = rsqrt(A);

See Also:  sqrt (section 4.2.62)

4.2.58. sbm

Description:  Elementwise subtraction-multiplication.

Syntax: 

Vector<T> sbm ( Vector<T> A Vector<T> B Vector<T> C );
 
Matrix<T> sbm ( Matrix<T> A Matrix<T> B Matrix<T> C );
 
Tensor<T> sbm ( Tensor<T> A Tensor<T> B Tensor<T> C );
 

Operator Syntax:  Addition can also be written in operator form. sbm(A, B, C) is equivalent to (A + B) * C.

Requirements:  It is permissible for arguments to be scalar instead of a view. Scalars are treated a view with constant value. If multiple arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the difference-product of the corresponding elements of the arguments. For instance, if the arguments are vectors, Z = sbm(A, B, C) produces a result equivalent to Z(i) = (A(i) - B(i)) * C(i) for all of the elements of the vector. If any of the arguments are scalar, they are processed with all of the elements of the other arguments; for example, Z = sbm(A, b, C) produces Z(i) = (A(i) - b) * C.

Example: 

Vector<float> Z, A, B, C;
Z = sbm(A, B, C);

See Also:  am (section 4.2.3) ma (section 4.2.41) msb (section 4.2.50)

4.2.59. sin

Description:  Elementwise trigonometric sine.

Syntax: 

Vector<T> sin ( Vector<T> A );
 
Matrix<T> sin ( Matrix<T> A );
 
Tensor<T> sin ( Tensor<T> A );
 

Result:  Each element of the result view is set to sine of the corresponding element of the argument. For instance, if the argument is a vector, Z = sin(A) produces a result equivalent to Z(i) = sin(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = sin(A);

See Also:  cos (section 4.2.14) tan (section 4.2.64)

4.2.60. sinh

Description:  Elementwise hyberbolic sine.

Syntax: 

Vector<T> sinh ( Vector<T> A );
 
Matrix<T> sinh ( Matrix<T> A );
 
Tensor<T> sinh ( Tensor<T> A );
 

Result:  Each element of the result view is set to hyberbolic sine of the corresponding element of the argument. For instance, if the argument is a vector, Z = sinh(A) produces a result equivalent to Z(i) = sinh(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = sinh(A);

See Also:  cosh (section 4.2.15) tanh (section 4.2.65)

4.2.61. sq

Description:  Elementwise square.

Syntax: 

Vector<T> sq ( Vector<T> A );
 
Matrix<T> sq ( Matrix<T> A );
 
Tensor<T> sq ( Tensor<T> A );
 

Result:  Each element of the result view is set to the square of the corresponding element of the argument. For instance, if the argument is a vector, Z = sq(A) produces a result equivalent to Z(i) = A(i) * A(i) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = sq(A);

See Also:  sqrt (section 4.2.62)

4.2.62. sqrt

Description:  Elementwise square root.

Syntax: 

Vector<T> sqrt ( Vector<T> A );
 
Matrix<T> sqrt ( Matrix<T> A );
 
Tensor<T> sqrt ( Tensor<T> A );
 

Result:  Each element of the result view is set to the square root of the corresponding element of the argument. For instance, if the argument is a vector, Z = sqrt(A) produces a result equivalent to Z(i) = sqrt(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = sqrt(A);

See Also:  sq (section 4.2.61)

4.2.63. sub

Description:  Elementwise subtraction.

Syntax: 

Vector<T> sub ( Vector<T> A Vector<T> B );
 
Vector<T> sub ( T a Vector<T> B );
 
Vector<T> sub ( Vector<T> A T b );
 
Matrix<T> sub ( Matrix<T> A Matrix<T> B );
 
Matrix<T> sub ( T a Matrix<T> B );
 
Matrix<T> sub ( Matrix<T> A T b );
 
Tensor<T> sub ( Tensor<T> A Tensor<T> B );
 
Tensor<T> sub ( T a Tensor<T> B );
 
Tensor<T> sub ( Tensor<T> A T b );
 

Operator Syntax:  Subtraction can also be written in operator form. sub(A, B) is equivalent to A - B.

Requirements:  If both arguments are non-scalar, they must be the same size in each dimension.

Result:  Each element of the result value is equal to the difference of the corresponding elements of the two arguments. For instance, if the arguments are vectors, Z = sub(A, B) produces a result equivalent to Z(i) = A(i) - B(i) for all of the elements of the vector. If either of the arguments is a scalar, it's difference with all of the elements of the other argument is computed; for example, Z = sub(A, b) produces Z(i) = A(i) - b.

Example: 

Vector<float> Z, A, B;
Z = sub(A, B);

See Also:  add (section 4.2.2) div (section 4.2.16) mul (section 4.2.51)

4.2.64. tan

Description:  Elementwise trigonometric tangent.

Syntax: 

Vector<T> tan ( Vector<T> A );
 
Matrix<T> tan ( Matrix<T> A );
 
Tensor<T> tan ( Tensor<T> A );
 

Result:  Each element of the result view is set to tangent of the corresponding element of the argument. For instance, if the argument is a vector, Z = tan(A) produces a result equivalent to Z(i) = tan(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = tan(A);

See Also:  cos (section 4.2.14) sin (section 4.2.59)

4.2.65. tanh

Description:  Elementwise hyperbolic tangent.

Syntax: 

Vector<T> tanh ( Vector<T> A );
 
Matrix<T> tanh ( Matrix<T> A );
 
Tensor<T> tanh ( Tensor<T> A );
 

Result:  Each element of the result view is set to hyperbolic tangent of the corresponding element of the argument. For instance, if the argument is a vector, Z = tanh(A) produces a result equivalent to Z(i) = tanh(A(i)) for all the elements of the vector.

Example: 

Vector<float> Z, A;
Z = tanh(A);

See Also:  cosh (section 4.2.15) sinh (section 4.2.60)