Jive reference manual
|
A dummy class representing array expressions. More...
#include <jem/base/array/ArrayExpr.h>
Public Types | |
typedef Tuple< int, N > | Shape |
A type representing the shape of an array expression. More... | |
Public Member Functions | |
const ArrayExpr< T, N > & | operator= (const ArrayExpr< T, N > &rhs) const |
Copies an rvalue array expression. More... | |
const ArrayExpr< T, N > & | operator= (const T &rhs) const |
Sets all elements to a specified value. More... | |
int | size () const |
Returns the size of a one-dimensional array expression. More... | |
Shape | shape () const |
Returns the shape of this array expression. More... | |
The class ArrayExpr
is a fictitious class that represents array expressions. The template parameter T denotes the type of the elements of the array expression, while the template parameter N denotes the rank of the array expression. For instance, if a
and b
are both arrays of type Array<float,3>
, then the expression (a + b)
is represented by the class ArrayExpr<float,3>
.
The ArrayExpr
class is used in this documentation to indicate that a function accepts an array expression as one of its arguments. For instance, the declaration
indicates that the function min
can be called with any array expression of which the elements have type T
, and of which the rank is N
. Thus, min(a + b)
is a valid function call.
The ArrayExpr
class is conceptually (but not in reality!) a base class of the Array
class. This means that an Array
object can be passed to any function expecting an array expression. Thus, min(a)
is also a valid function call.
The ArrayExpr
class represents both rvalue expressions and lvalue expressions. An rvalue expression can only be used as a data source, while an lvalue expression can also be used as a data sink. This means that an rvalue expression can only be used as the right-hand side of an assignment and as the input parameter of a function. An lvalue expression, on the other hand, can also be used as the left-hand side of an assignment and as an output parameter of a function. Note that an lvalue expression is also an rvalue expression.
Array
, Array expressions. typedef Tuple<int,N> jem::ArrayExpr< T, N >::Shape |
The Shape
type represents the shape of an array expression. It is an alias for Tuple<int,N>
.
const ArrayExpr<T,N>& jem::ArrayExpr< T, N >::operator= | ( | const ArrayExpr< T, N > & | rhs | ) | const |
Assigns the values of the elements of the rvalue array expression rhs to the corresponding elements represented by this array expression.
rhs | - an rvalue array expression or an Array object. |
equal( this->shape(), rhs.shape() )
*this
const ArrayExpr<T,N>& jem::ArrayExpr< T, N >::operator= | ( | const T & | rhs | ) | const |
Assigns all elements represented by this array expression to the value rhs.
rhs | - an object of type T. |
*this
int jem::ArrayExpr< T, N >::size | ( | ) | const |
Returns the size of a one-dimensional array expression. This function does not exist for multi-dimensional array expressions.
this->shape()[0]
Shape jem::ArrayExpr< T, N >::shape | ( | ) | const |
Returns the shape of this array expression. It is equal to the shape of the operands of this array expression.