1 #ifndef NUMCXX_TARRAY1_H 6 #define NUMCXX_TARRAY1_H 31 template<
typename T>
class TArray1:
public TArray<T>,
public ExpressionBase
81 static std::shared_ptr<TArray1 <T> >
create(
index n1) {
return std::make_shared<TArray1 <T> >(n1);}
88 static std::shared_ptr<TArray1 <T> >
create(
const std::initializer_list<T> il){
return std::make_shared<TArray1 <T> >(il);}
92 std::shared_ptr<TArray1 <T> >
copy()
const {
return std::make_shared<TArray1 <T>>(*this); }
128 template <typename EXPR, typename= typename std::enable_if<std::is_class<EXPR>::value, EXPR>::type>
TArray1(std::shared_ptr< std::vector< T >> v)
Construct 1D Array from smart pointer to std::vector.
TArray1()
Default constructor.
T item(index i0) const
Element read access.
index _idx(index i0) const
1D Array index calculation with optional bounds check.
TArray1(const EXPR &A)
Copy constructor from expression.
std::shared_ptr< TArray1< T > > clone() const
Create a clone of the array.
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.
TArray1(index n)
Construct an empty 1D array.
void itemset(index i0, T x)
Element write access.
TArray1< T > & operator=(const TArray1< T > &expr)
Assignment operator.
static std::shared_ptr< TArray1< T > > create(const std::initializer_list< T > il)
Construct 1D Array from std::initializer list.
TArray1(TArray1< T > &&A)
Move constructor.
T __getitem__(index i0) const
Element read access.
TArray1(index n0, T *data, std::shared_ptr< void > datamanager)
Construct an 1D array from smartpointer managed array.
std::shared_ptr< TArray1< T > > copy() const
Create a copy.
One dimensional array class.
TArray1(const std::initializer_list< T > &il)
Construct 1D Array from std::initializer list.
void __setitem__(index i0, T x)
Element write access.
void _setshape(index shape0)
Set shape of 1D array (for move constructors)
TArray1(index n0, T *data, std::function< void(T *p)> deleter)
Construct an 1D array from plain old C Array.
static std::shared_ptr< TArray1< T > > create(index n1)
Construct smart pointer empty 1D 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.
TArray1< T > & operator=(TArray1< T > &&A)
Move assignment.
TArray1(const TArray1< T > &A)
Copy constructor.
std::shared_ptr< void > _datamanager
Data manager.
T * data() const
Obtain C-pointer of data array.
Header for numcxx::TArray.