10 template<
class Sub
class>
39 Rhs::s_cols ==
matrix::dynamic || Rhs::s_cols == 1,
"Can only assign a row or column vector");
41 "Can only assign to vector of the same size");
42 assert(rhs.rows() == 1 || rhs.cols() == 1,
"Can only assign a row or column vector");
80 if (l > Real_::zeroTol)
86 return VecS().resize(
size()).fromZero();
95 if (val.size() > 1) os <<
"[";
96 for (
sdt i = 0; i < val.size(); ++i)
98 if (i != 0) os <<
", ";
101 return val.size() > 1 ? os <<
"]" : os;
106 namespace matrix {
namespace priv
109 template<
class Vec, sdt Cols>
118 template<
class Vec, sdt Rows>
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
VecBase< Subclass > Base
Definition: Base.h:123
static type create(Vec &v, sdt i, sdt dim=-1)
Definition: Block.h:220
Real dot(const VecBase< T > &v) const
Vector dot product.
Definition: Base.h:91
BlockTraits< Vec, 1, 1 > Super
Definition: Base.h:130
static optnull_t optnull
Null optional, use to reset an optional to an uninitialized state or test for initialization.
Definition: Optional.h:12
const Real & m(sdt i) const
Access matrix element at index. Wrapper for convenience only, more readable than (*this)(i) ...
Definition: Base.h:567
VecS normalize(optional< Real & > len=optnull) const
Get unit vector. The pre-normalized length will be returned in len if specified.
Definition: Base.h:77
ptrdiff_t sdt
Size difference type, shorthand for ptrdiff_t.
Definition: Core.h:92
Numeral< Real >::Real_ Real_
Definition: Base.h:25
VecBase< Subclass > Base
Definition: Base.h:132
VecS & fromAxis(sdt i)
Initialize with unit axis (all zeros except for a one at index i)
Definition: Base.h:31
Accum reduce(Range &&, Seqs &&..., Accum &&initVal, Func &&)
Accumulate a series of sequences into an output.
static Real sqrt(Real x)
Square Root.
Definition: Alge.h:63
Real length() const
Get length (magnitude) of vector.
Definition: Base.h:74
Alge_< Real > Alge
Definition: Base.h:28
Matrix block view.
Definition: Block.h:188
friend ostream & operator<<(ostream &os, const VecBase &val)
Definition: Base.h:93
VecBase< Subclass > Base
Definition: Base.h:114
vec::priv::Segment< VecS >::type segment(sdt i, sdt dim)
Get dynamic segment at offset i with dimension dim
Definition: Base.h:60
#define assert(...)
Forwards to assert_#args. See assert_1(), assert_2().
Definition: Debug.h:24
N-dimensional vector.
Definition: Traits.h:12
vec::priv::Segment< const VecS, Dim >::type segment(sdt i, sdt dim=-1) const
Definition: Base.h:56
BlockTraits< Vec, 1, Cols > Super
Definition: Base.h:112
BlockTraits< Vec, Rows, 1 > Super
Definition: Base.h:121
float Real
Real number type. See Real_ for real number operations and constants.
Definition: Real.h:21
MatrixS & resize(sdt rows, sdt cols)
Sets number of rows/columns and reallocates only if the size has changed (rows*cols). All previous data is lost on reallocation. Returns self.
Definition: Base.h:277
Enables any type to be optional so it can exist in an uninitialized null state.
Definition: Optional.h:52
MatrixS & fromZero()
Zero all elements.
Definition: Base.h:70
vec::priv::Segment< VecS, Dim >::type segment(sdt i, sdt dim=-1)
Get segment at offset i with dimension dim. If dimension is fixed then dim may be left unspecified...
Definition: Base.h:52
Vector base class.
Definition: Base.h:11
vec::priv::Segment< const VecS >::type segment(sdt i, sdt dim) const
Definition: Base.h:63
static Num sqr(Num x)
Square.
Definition: Alge.h:60
int size(const StdContainer &cont)
Safely get the size of a std container as a signed integer.
Definition: StdUtil.h:19
Subclass VecS
Definition: Base.h:18
void storageCopy(const StorageBlock< Src > &src, StorageBlock< Dst > &dst)
Copy between block and dense storages.
Definition: Block.h:84
Real lengthSqr() const
Get the square of the length.
Definition: Base.h:72
Matrix base class.
Definition: Base.h:17
Global Honeycomb namespace.
VecS & resize(sdt dim)
Sets number of dimensions and reallocates only if different. All previous data is lost on reallocatio...
Definition: Base.h:69