21 template <
class T,
unsigned int Dim >
24 template <
class T,
unsigned int Dim >
64 using Superclass::operator();
65 using Superclass::operator=;
66 using Superclass::operator+=;
67 using Superclass::operator-=;
68 using Superclass::operator%=;
69 using Superclass::operator/=;
79 #define __NDArray_vector_constructor(intType) \ 80 explicit NDArray(const intType size) : Superclass() \ 84 __utl_ndarray_alloc_blah(shape); \ 92 #undef __NDArray_vector_constructor 107 template<
typename EType>
117 NDArray(
const T* vec,
const SizeType size) : Superclass()
122 utl::cblas_copy<T>(this->
Size(), vec, 1, this->
m_Data, 1);
128 NDArray(
const SizeType size,
const T r) : Superclass()
136 template<
typename TVectorValueType >
141 explicit NDArray(
const ShapeType& shape) : Superclass(shape) { }
143 NDArray(
const T* vec,
const ShapeType& shape) : Superclass(vec,shape) { }
148 NDArray(
const ShapeType& shape,
const T r) : Superclass(shape, r) { }
152 void SetData( T*
const data,
const SizeType size )
237 double cosA = std::cos(alpha);
238 double sinA = std::sin(alpha);
249 *
this = GetRotateAxis(alpha, axis);
279 vec.
ReSize(indexVec.size());
280 for (
int i = 0; i < indexVec.size(); ++i )
281 vec[i] = this->
m_Data[ indexVec[i] ];
286 GetSubVector(indexVec, vec);
292 for (
int i = 0; i < indexVec.size(); ++i )
293 this->
m_Data[ indexVec[i] ] = vec[i];
const ValueType * ConstIterator
NDArray is a N-Dimensional array class (row-major, c version)
NDArray<T,1> is a vector class which uses blas mkl.
Superclass::ScalarValueType ScalarValueType
#define __NDArray_vector_constructor(intType)
void cblas_copy(const INTT N, const T *X, const INTT incX, T *Y, const INTT incY)
base class for expression
NDArray(const T *vec, const SizeType size)
NDArray(const Expr< EType, typename EType::ValueType > &expr)
void PreMultiply(const NDArray< T, 2 > &mat, NDArray< T, 1 > &vec)
NDArray< T, 1 > GetSubVector(const std::vector< int > &indexVec) const
ConstReference operator()(long index) const
vnl_matrix< T > GetDiagonalMatrix(const vnl_vector< T > &vec)
Superclass::ValueType ValueType
NDArray< T, 1 > & operator=(NDArray< T, 1 > &r)
Superclass::ConstPointer ConstPointer
#define utlException(cond, expout)
Superclass::SizeType SizeType
static constexpr SizeType SubDimension
Reference operator()(long index)
NDArray< T, 2 > & SetDiagonal(const NDArray< T, 1 > &vec)
NDArray<T,2> is a row-major matrix.
bool ReSize(const ShapeType &shape)
const ValueType & ConstReference
NDArray(const ShapeType &shape, const T r)
void SetData(T *const data, const ShapeType &shape)
NDArray< T, Dim > & operator=(const NDArray< T, Dim > &r)
void PostMultiply(const NDArray< T, 2 > &mat, NDArray< T, 1 > &vec)
double CrossProduct(const TVector1 &v1, const TVector2 &v2, TVector3 &v3)
NDArray(const NDArray< T, 1 > &vec)
void ProductUtlvM(const utl::NDArray< T, 1 > &b, const utl::NDArray< T, 2 > &A, utl::NDArray< T, 1 > &c, const double alpha=1.0, const double beta=0.0)
#define UTL_ALWAYS_INLINE
Superclass::Reference Reference
Reference operator()(int index)
NDArray< T, 1 > & operator=(NDArray< T, 1 > &&r)
Base class for utl::NDArray.
double DotProduct(const TVector1 &v1, const TVector2 &v2, const int N1)
Superclass::ConstIterator ConstIterator
Superclass::Iterator Iterator
Superclass::SizeType SizeType
void Fill(const T &value)
ConstReference operator()(unsigned long index) const
NDArray< T, 1 > GetRotateAxis(const double alpha, const NDArray< T, 1 > &axis)
NDArray< T, 1 > & SetSubVector(const std::vector< int > indexVec, const NDArray< T, 1 > &vec)
Superclass::ConstReference ConstReference
ConstReference operator()(int index) const
Reference operator()(unsigned int index)
Reference operator()(unsigned long index)
NDArrayBase< T, 1 > Superclass
ConstReference operator()(unsigned int index) const
void Swap(NDArrayBase< T, Dim > &vec)
void GetDiagonalMatrix(NDArray< T, 2 > &mat) const
NDArray(NDArray< T, 1 > &&vec)
Superclass::ShapeType ShapeType
NDArray(const NDArray< TVectorValueType, 1 > &r)
Superclass::Pointer Pointer
NDArray(const ShapeType &shape)
NDArray(const SizeType size, const T r)
const ValueType * ConstPointer
NDArray< T, 2 > GetDiagonalMatrix() const
NDArray(const T *vec, const ShapeType &shape)
void CopyData(T *const data, const SizeType size)
NDArrayBase< T, Dim > & Scale(const T a)
void SetData(T *const data, const SizeType size)
bool ReSize(const SizeType rows, const SizeType cols)
NDArrayBase< T, Dim > & operator=(const Expr< EType, typename EType::ValueType > &src)
NDArray(const std::initializer_list< T > &r)
utl::remove_complex_t< T > ScalarValueType
void GetSubVector(const std::vector< int > &indexVec, NDArray< T, 1 > &vec) const
bool ReSize(const SizeType size)
Superclass::ShapeType ShapeType
#define __utl_ndarray_alloc_blah(shape)
void ProductUtlMv(const utl::NDArray< T, 2 > &A, const utl::NDArray< T, 1 > &b, utl::NDArray< T, 1 > &c, const double alpha=1.0, const double beta=0.0)
void RotateAxis(const double alpha, const NDArray< T, 1 > &axis)
void CopyData(T *const data, const ShapeType &shape)