Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
alltrue(ViewT<T, BlockT> v);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: When T is bool, the function
returns true if all elements are
true, otherwise false. When
T is another type, alltrue
returns the application of accumulation operator band
with base value ˜(T()) applied to
v.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: alltrue returns a scalar value of type
T.
Example:
Vector<bool> bvec(4, true); std::cout << alltrue(bvec) << std::endl; // prints 1 Vector<int> vec(3); vec(0) = 0x00ff; vec(1) = 0x119f; vec(2) = 0x92f7; std::cout << alltrue(vec) == 0x0097 << std::endl; // prints 1
See Also: band (section 4.2.8)
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
anytrue(ViewT<T, BlockT> v);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v.
Description: When T is bool, the function
returns true if at least one element is
true, otherwise false. When
T is another type, anytrue
returns the application of accumulation operator bor
with base value T() applied to
v.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: anytrue returns a scalar value of type
T.
Example:
Vector<bool> bvec(4, true); std::cout << anytrue(bvec) << std::endl; // prints 1 Vector<int> vec(3); vec(0) = 0x00ff; vec(1) = 0x119f; vec(2) = 0x92f7; std::cout << anytrue(vec) == 0x93ff << std::endl; // prints 1
See Also: bor (section 4.2.9)
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
maxmgsqval(
ViewT<complex<T>, BlockT> v,
Index<ViewT<complex<T>, BlockT>::dim>& idx);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: maxmgsqval computes the maximum squared magnitude
of all the elements of the view and returns that value. It also returns,
through the parameter idx, the indices to locate that
value in the view.
Requirements: The template parameter ViewT must be
const_Vector, const_Matrix or
const_Tensor. The function parameters v
and idx are defined in terms of
complex<T>.
Result: maxmgsqval returns a scalar value of type
T.
Example:
length_type size = 13; typedef float T; Vector<complex<T> > vec(size, complex<T>(3, 4)); Index<1> idx; T val; vec(1) = complex<T>(6, 8); vec(2) = complex<T>(0.3, 0.4); val = maxmgsqval(vec, idx); cout << val << endl; // prints 100 cout << idx << endl; // prints 1
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
maxmgval(
ViewT<T, BlockT> v,
Index<ViewT<T, BlockT>::dim>& idx);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: maxmgval computes the maximum magnitude of all
the elements of the view and returns that value. It also returns, through
the parameter idx, the indices to locate that value
in the view.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: When T is complex<W>,
maxmgval returns a scalar value of type
W; otherwise it returns a value of type
T.
Example:
length_type size = 13; typedef float T; Vector<complex<T> > vec(size, complex<T>(3, 4)); Index<1> idx; T val; vec(1) = complex<T>(6, 8); vec(2) = complex<T>(0.3, 0.4); val = maxmgval(vec, idx); cout << val << endl; // prints 10 cout << idx << endl; // prints 1
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
maxval(
ViewT<T, BlockT> v,
Index<ViewT<T, BlockT>::dim>& idx);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: maxval computes the maximum of all the elements
of the view and returns that value. It also returns, through the parameter
idx, the indices to locate that value in the
view.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: maxval returns a scalar value of type
T.
Example:
Vector<float> vec(4); vec(0) = 0.; vec(1) = 1.; vec(2) = 3.; vec(3) = 2.; Index<1> idx; float val = maxval(vec,idx); std::cout << val << std::endl; // prints 3.0 std::cout << idx << std::endl; // prints 2
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
meansqval(ViewT<T, BlockT> v);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: meansqval sums the squares of all the elements of
the view and returns that value divided by the number of elements.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: meansqval returns a scalar value of type
T.
Example:
Vector<float> vec(4); vec(0) = 0.; vec(1) = 1.; vec(2) = 2.; vec(3) = 3.; std::cout << meansqval(vec) << std::endl; // prints 3.5
See Also: add (section 4.2.2)
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
meanval(ViewT<T, BlockT> v);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: meanval sums all the elements of the view and
returns that value divided by the number of elements.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: meanval returns a scalar value of type
T.
Example:
Vector<float> vec(4); vec(0) = 0.; vec(1) = 1.; vec(2) = 2.; vec(3) = 3.; std::cout << meanval(vec) << std::endl; // prints 1.5
See Also: add (section 4.2.2)
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
minmgsqval(
ViewT<complex<T>, BlockT> v,
Index<ViewT<complex<T>, BlockT>::dim>& idx);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: minmgsqval computes the minimum squared magnitude
of all the elements of the view and returns that value. It also returns,
through the parameter idx, the indices to locate that
value in the view.
Requirements: The template parameter ViewT must be
const_Vector, const_Matrix or
const_Tensor. The function parameters v
and idx are defined in terms of
complex<T>.
Result: minmgsqval returns a scalar value of type
T.
Example:
length_type size = 13; typedef float T; Vector<complex<T> > vec(size, complex<T>(3, 4)); Index<1> idx; T val; vec(1) = complex<T>(6, 8); vec(2) = complex<T>(0.3, 0.4); val = minmgsqval(vec, idx); cout << val << endl; // prints 0.25 cout << idx << endl; // prints 2
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
minmgval(
ViewT<T, BlockT> v,
Index<ViewT<T, BlockT>::dim>& idx);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: minmgval computes the minimum magnitude of all
the elements of the view and returns that value. It also returns, through
the parameter idx, the indices to locate that value
in the view.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: When T is complex<W>,
minmgval returns a scalar value of type
W; otherwise it returns a value of type
T.
Example:
length_type size = 13; typedef float T; Vector<complex<T> > vec(size, complex<T>(3, 4)); Index<1> idx; T val; vec(1) = complex<T>(6, 8); vec(2) = complex<T>(0.3, 0.4); val = minmgval(vec, idx); cout << val << endl; // prints 0.5 cout << idx << endl; // prints 2
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
minval(
ViewT<T, BlockT> v,
Index<ViewT<T, BlockT>::dim>& idx);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: minval computes the minimum of all the elements
of the view and returns that value. It also returns, through the parameter
idx, the indices to locate that value in the
view.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: minval returns a scalar value of type
T.
Example:
Vector<float> vec(4); vec(0) = 3.; vec(1) = 1.; vec(2) = 0.; vec(3) = 2.; Index<1> idx; float val = minval(vec,idx); std::cout << val << std::endl; // prints 0.0 std::cout << idx << std::endl; // prints 2
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
sumsqval(ViewT<T, BlockT> v);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: sumsqval sums the squares of all the elements of
the view and returns that value.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: sumsqval returns a scalar value of type
T.
Example:
Vector<float> vec(4); vec(0) = 0.; vec(1) = 1.; vec(2) = 2.; vec(3) = 3.; std::cout << sumsqval(vec) << std::endl; // prints 14.0
See Also: add (section 4.2.2)
Syntax:
template <typename T,
template <typename, typename> class ViewT,
typename BlockT>
T
sumval(ViewT<T, BlockT> v);
Template parameters
Tis the type of the elements in the view and of the return value.
ViewTis the type of the parameter v. It must be
const_Vector, const_Matrix or
const_Tensor.
Description: sumval sums all the elements of the view and
returns that value.
Requirements: The template parameter ViewT must be const_Vector, const_Matrix or const_Tensor.
Result: sumval returns a scalar value of type
T.
Example:
Vector<float> vec(4); vec(0) = 0.; vec(1) = 1.; vec(2) = 2.; vec(3) = 3.; std::cout << sumval(vec) << std::endl; // prints 6.0
See Also: add (section 4.2.2)