10 namespace vec {
namespace priv
13 template<sdt Dim,
class Real_,
int Options,
class Alloc_>
27 template<sdt Dim,
class Real,
int Options,
class Alloc>
31 template<sdt Dim,
class Real,
int Options,
class Alloc>
32 class Vec :
public VecBase<Vec<Dim,Real,Options,Alloc>>
42 explicit Vec(Int dim,
typename std::enable_if<std::is_integral<Int>::value && s_size ==
matrix::dynamic>::type*
_=0)
49 Vec(
const Alloc&
alloc) { this->setAllocator(alloc); }
71 #define MATRIX_VEC_ADAPTER \
73 using Super::s_size; \
74 using typename Super::Alloc; \
78 explicit Matrix(Int dim, typename std::enable_if<std::is_integral<Int>::value && s_size == matrix::dynamic>::type*_=0) \
80 explicit Matrix(Real scalar) : Super(scalar) {} \
81 Matrix(const Real* a, sdt dim) : Super(a,dim) {} \
82 Matrix(const Alloc& alloc) : Super(alloc) {} \
84 Matrix(const MatrixBase<T>& rhs) : Super(rhs) {} \
86 Matrix& operator=(const MatrixBase<T>& rhs) { Super::operator=(rhs); return *this; } \
88 template<sdt Dim,
class Real,
int Options,
class Alloc_>
90 class Matrix<Dim,1,
Real,Options,Alloc_> :
public Vec<Dim,Real,Options,Alloc_>
97 template<sdt Dim,
class Real,
int Options,
class Alloc_>
98 class Matrix<1,Dim,
Real,Options,Alloc_> :
public Vec<Dim,Real, Options | matrix::Option::vecRow, Alloc_>
MatrixS & fromScalar(Real f)
Initialize with scalar in every element.
Definition: Base.h:72
(m x n)-dimensional matrix
Definition: Matrix.h:24
Vec()
No init.
Definition: Vec.h:39
Vec(const Real *a, sdt dim)
Initialize from array with dimension dim
Definition: Vec.h:47
static const sdt dynamic
Definition: Traits.h:23
VecBase & operator=(const MatrixBase< T > &rhs)
Assign to row or column vector of any dimension. Asserts that if this vector has a fixed dimension th...
Definition: Base.h:35
Alloc_ Alloc
Definition: Vec.h:23
Vec(Int dim, typename std::enable_if< std::is_integral< Int >::value &&s_size==matrix::dynamic >::type *_=0)
Allocate elements for dimension size, only available if vector is dynamic.
Definition: Vec.h:42
7 bit alignment stored as log2, so max alignment is 2^15 byte boundary
Definition: Traits.h:32
N-dimensional vector traits.
Definition: Vec.h:14
Vec< matrix::dynamic, Float, matrix::Option::vecRow > VecRowN_f
Definition: Vec.h:66
Auto or dynamic vector storage.
Definition: Storage.h:45
ptrdiff_t sdt
Size difference type, shorthand for ptrdiff_t.
Definition: Core.h:92
static const int options
Definition: Vec.h:22
Vec< matrix::dynamic, Double > VecN_d
Definition: Vec.h:62
Vec(Real scalar)
Construct uniform vector.
Definition: Vec.h:45
static const sdt rows
Definition: Vec.h:20
static auto _
Definition: Module.cpp:8
Vec< matrix::dynamic, Real, matrix::Option::vecRow > VecRowN
N-dimensional row vector types.
Definition: Vec.h:65
static const sdt dim
Definition: Vec.h:19
Vec< matrix::dynamic, Float > VecN_f
Definition: Vec.h:61
Real_ Real
Definition: Vec.h:17
N-dimensional vector.
Definition: Traits.h:12
static const sdt cols
Definition: Vec.h:21
float Real
Real number type. See Real_ for real number operations and constants.
Definition: Real.h:21
Real ElemT
Definition: Vec.h:18
T * alloc(szt count=1)
Allocate memory for count number of T objects. Objects are not constructed.
Definition: Allocator.h:31
Vector base class.
Definition: Base.h:11
Vec & operator=(const MatrixBase< T > &rhs)
Assign to row or column vector of any dimension. Asserts that if this vector has a fixed dimension th...
Definition: Vec.h:56
Numeral< Real >::Real_ Real_
Operations and constants for Real type. See Float_, Double_.
Definition: Real.h:25
Vec< matrix::dynamic > VecN
N-dimensional column vector types.
Definition: Vec.h:60
#define MATRIX_VEC_ADAPTER
It's not possible to inherit ctors, so this macro is required.
Definition: Vec.h:71
Vec(const MatrixBase< T > &rhs)
Construct from row or column vector of any dimension. Asserts that if this vector has a fixed dimensi...
Definition: Vec.h:52
Matrix base class.
Definition: Base.h:17
MatrixS & fromArray(const Num *a, bool rowMajor=true)
Initialize from array. If the array is in row-major format set rowMajor to true, otherwise set to fal...
Definition: Base.h:53
Vec< matrix::dynamic, Double, matrix::Option::vecRow > VecRowN_d
Definition: Vec.h:67
Global Honeycomb namespace.
Vec(const Alloc &alloc)
Construct with allocator, for a dynamic vector. Allocator element type must be int8.
Definition: Vec.h:49
priv::Storage< Vec< Dim, Real_, Options, Alloc_ > > Storage
Definition: Vec.h:16
VecS & resize(sdt dim)
Sets number of dimensions and reallocates only if different. All previous data is lost on reallocatio...
Definition: Base.h:69