1 #ifndef NUMCXX_TMATRIX_H 6 #define NUMCXX_TMATRIX_H 81 static std::shared_ptr<TMatrix <T> >
create(
index n1,
index n2) {
return std::make_shared<TMatrix<T>> (n1,n2); }
84 static std::shared_ptr<TMatrix <T> >
create(
const std::initializer_list<std::initializer_list<T>> &il) {
return std::make_shared<TMatrix<T>> (il); }
89 std::shared_ptr<TMatrix <T> >
copy()
const {
return std::make_shared<TMatrix<T>>(*this); }
static std::shared_ptr< TMatrix< T > > create(const std::initializer_list< std::initializer_list< T >> &il)
Construct matrix from std::initializer list.
void _assert_square() const
Check if all shapes are the same.
TMatrix(const std::initializer_list< std::initializer_list< T >> &il)
Construct 2D Array from std::initializer list.
TMatrix< T > & operator=(const TMatrix< T > &expr)
Assignment operator.
index _idx(index i0) const
1D Array index calculation with optional bounds check.
Inline method definitions for class numcxx::TMatrix.
const T & xentry(const index i, const index j) const
Matrix entry access for use in expression templates.
static std::shared_ptr< TMatrix< T > > create(index n1, index n2)
Construct empty square matrix.
TArray is the common template base class for arrays and dense matrices of the numcxx project...
TMatrix< T > & operator=(const T &expr)
Assignment operator.
std::shared_ptr< TMatrix< T > > copy() const
Create a copy of the matrix.
TMatrix(index n1, index n2)
Construct an empty matrix.
T item(index i0, index i1)
Element read access.
TMatrix(const TMatrix< T > &A)
Copy constructor.
std::shared_ptr< TMatrix< T > > clone() const
Create a clone of the matrix.
One dimensional array class.
std::shared_ptr< TMatrix< T > > calculate_inverse()
Calculate inverse of matrix.
TMatrix(index n1, index n2, T *data, std::function< void(T *p)> deleter)
Construct matrix from data pointer.
void apply(const TArray< T > &u, TArray< T > &v) const
Apply matrix to vector.
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.
std::shared_ptr< TArray1< T > > const __getitem__(index i0)
Getter routine for access from python.
Base class for linear operators (matrices, sparse matrices)
TMatrix()
Construct zero size matrix.
void itemset(index i0, index i1, T x)
Element write access.
T * data() const
Obtain C-pointer of data array.
Header for numcxx::TArray.
TMatrix(index n1, index n2, T *data, std::shared_ptr< void > datamanager)
Construct matrix from data pointer.