1 #ifndef NUMCXX_TARRAY_H 6 #define NUMCXX_TARRAY_H 22 inline std::ostream & operator << (std::ostream & s, TArray<T> &A);
26 template<
typename T>
class TArray 73 template <
typename VAL>
79 template <
typename VAL>
86 template <
typename VAL>
93 template <
typename VAL>
121 template <
typename VAL>
138 void savetxt(std::ostream &s)
const;
217 TArray(
const std::initializer_list<T> &il );
233 TArray(
index n0, T*data, std::shared_ptr<void> datamanager);
242 TArray(
const std::initializer_list<std::initializer_list<T>> &il );
267 friend std::ostream & operator<< <T>(std::ostream & s,
TArray<T> &A);
TArray< T > & operator=(const VAL &expr)
Expression template compatible assignment operator.
Inline metho definitions for numcxx::TArray.
void _assert_square() const
Check if all shapes are the same.
void savetxt(std::ostream &s) const
Implementation of expression templates.
index _shape[3]
Shape vector.
virtual void solve(TArray< T > &sol, const TArray< T > &rhs) const
index _idx(index i0) const
1D Array index calculation with optional bounds check.
void xdiv(TArray< T > &A, const EXPR &expr, const EXPR *x=0)
std::function< void(T *p)> _deleter
Deleter method.
TArray is the common template base class for arrays and dense matrices of the numcxx project...
size_t size() const
Obtain size of array.
void operator*=(const VAL &a)
Multiply all elements by value.
T & operator()(const index i0)
Access operator for 1D arrays.
void xadd(TArray< T > &A, const EXPR &expr, const EXPR *x=0)
void _check_bounds(index acc_dim, index acc_ndim, index acc_idx) const
Bounds checker.
Base class for linear solvers and preconditioners.
void operator/=(const VAL &a)
Divide each element by value.
void _nullify()
Nullify contents of array (for move constructors)
virtual void update(void)
TArray()
Construct an zero length 1D array.
void xmul(TArray< T > &A, const EXPR &expr, const EXPR *x=0)
virtual void apply(const TArray< T > &sol, TArray< T > &rhs) const
const T & operator[](const index i) const
Const reference to entry for use in expression templates.
T & operator[](const index i)
Alternative access operator for 1D arrays.
const T & operator()(const index i0, const index i1) const
const T & operator()(const index i0) const
static void operate(std::function< void(T &a, T &b)> f, TArray< T > &A, TArray< T > &B)
Binary operation on arrays.
T & operator()(const index i0, const index i1)
Access operator for 2D arrays.
void xsub(TArray< T > &A, const EXPR &expr, const EXPR *x=0)
size_t _size
Size of array.
index ndim() const
Obtain tensor dimension of array.
void _setshape(index shape0)
Set shape of 1D array (for move constructors)
void resize(size_t n)
Resize array.
TArray< T > & assign(TArray< T > &A, const EXPR &expr, const EXPR *x=0)
index shape(const index dim) const
Obtain shape of array for given dimension.
void operator+=(const VAL &a)
Add value to all elements.
void operator-=(const VAL &a)
Subtract value from all elements.
Base class for linear operators (matrices, sparse matrices)
std::shared_ptr< void > _datamanager
Data manager.
const index _ndim
Tensor dimension.
T * data() const
Obtain C-pointer of data array.