LTL  2.0.x
Where Expressions

Index an arbitrary subset of elements of an MArray.

For example, Find all elemets of an MArray that are zero:

MArray<float,3> A(nx,ny,nz);
A = ...
IndexList<3> zeros = where( A==0.0f );

We can now set all of these to 1:

A[zeros] = 1; // could be any conformable 1-D expression.

You can use operator()(IndexList&) instead of operator[](IndexList&) to obtain the values of the MArry indexed by the IndexList as a 1D MArray:

MArray<float,1> B = A(someIndexList);

In short:

IndexList<N> where( [some N-dim boolean expression] );
MArray<T,N>::operator[]( IndexList& ) = expression;
Marray<T,1> MArray<T,N>::operator()( IndexList& );