8 #error This class is not to be included by the user directly. Use SharedVectorNff.h or SharedVectorNd.h instead.
28 SHAREDVECTORN(
unsigned len,
unsigned inc,
unsigned start, SharedResizable<REAL> data);
32 unsigned size()
const {
return _len; }
33 static REAL norm(
const SHAREDVECTORN& v) {
return std::sqrt(norm_sq(v)); }
35 REAL norm_inf()
const {
return norm_inf(*
this); }
36 REAL norm1()
const {
return norm1(*
this); }
37 REAL norm()
const {
return norm(*
this); }
38 REAL norm_sq()
const {
return norm_sq(*
this); }
49 REAL* data() {
return _data.get() + _start; }
50 const REAL* data()
const {
return _data.get() + _start; }
51 SHAREDVECTORN&
resize(
unsigned m,
unsigned n,
bool preserve =
false) {
if (n != 1)
throw MissizeException();
return resize(m, preserve); }
54 void reset() { _data.reset(); _start = _inc = _len = 0; }
56 unsigned rows()
const {
return _len; }
57 unsigned columns()
const {
return 1; }
58 unsigned leading_dim()
const {
return _len; }
59 unsigned inc()
const {
return _inc; }
62 #include "SharedVectorN.inl"
65 #define XVECTORN SHAREDVECTORN
66 #include "XVectorN.inl"
70 SharedResizable<REAL> _data;
89 CONST_SHAREDVECTORN(
unsigned len,
unsigned inc,
unsigned start, SharedResizable<REAL> data);
96 unsigned size()
const {
return _len; }
99 REAL norm_inf()
const {
return norm_inf(*
this); }
100 REAL norm1()
const {
return norm1(*
this); }
101 REAL norm()
const {
return norm(*
this); }
102 REAL norm_sq()
const {
return norm_sq(*
this); }
105 const REAL* data()
const {
return _data.get() + _start; }
110 throw MissizeException();
112 return resize(m, preserve);
116 void reset() { _data.reset(); _start = _inc = _len = 0; }
117 unsigned rows()
const {
return _len; }
118 unsigned columns()
const {
return 1; }
119 unsigned leading_dim()
const {
return _len; }
120 unsigned inc()
const {
return _inc; }
123 #include "ConstSharedVectorN.inl"
126 SharedResizable<REAL> _data;
132 std::ostream& operator<<(std::ostream& out,
const SHAREDVECTORN& v);
133 std::istream& operator>>(std::istream& in,
SHAREDVECTORN& v);
static REAL dot(const V1 &v1, const V2 &v2)
Computes the dot-product between two vectors.
Definition: SharedVectorN.h:247
SHAREDVECTORN & operator=(const ORIGIN2 &source)
Copies another vector.
Definition: SharedVectorN.cpp:80
void reset_from(const SHAREDVECTORN &source)
Constructs a shared vector from another shared vector.
Definition: SharedVectorN.cpp:27
A general 2x2 matrix.
Definition: Matrix2.h:16
SHAREDVECTORN segment(unsigned start, unsigned end)
Gets a shared subvector of this subvector.
Definition: SharedVectorN.cpp:36
CONST_SHAREDVECTORN & resize(unsigned N, bool preserve=false)
Does nothing.
Definition: SharedVectorN.cpp:246
SHAREDVECTORN & resize(unsigned N, bool preserve=false)
Does nothing.
Definition: SharedVectorN.cpp:68
A generic, possibly non-square matrix.
Definition: MatrixN.h:18
CONST_SHAREDVECTORN()
Default constructor - constructs an empty vector.
Definition: SharedVectorN.cpp:181
A generic N-dimensional floating point vector.
Definition: SharedVectorN.h:77
A generic, possibly non-square matrix using shared data.
Definition: SharedMatrixN.h:59
CONST_SHAREDVECTORN segment(unsigned start, unsigned end) const
Gets a shared subvector of this subvector.
Definition: SharedVectorN.cpp:230
A generic N-dimensional floating point vector.
Definition: SharedVectorN.h:15
void reset_from(const SHAREDVECTORN &source)
Constructs a shared vector from another shared vector.
Definition: SharedVectorN.cpp:221
static REAL dot(const V1 &v1, const V2 &v2)
Computes the dot-product between two vectors.
Definition: SharedVectorN.h:606
void reset()
Resets the shared structure.
Definition: SharedVectorN.h:116
A generic N-dimensional floating point vector.
Definition: VectorN.h:16
COLUMN_ITERATOR end()
Returns the column iterator.
Definition: SharedVectorN.h:330
A three-dimensional floating point vector used for representing points and vectors in 3D with associa...
Definition: Vector3.h:15
A three-dimensional floating point vector used for representing points and vectors in 3D and without ...
Definition: Origin3.h:16
A generic, possibly non-square matrix using constant shared data.
Definition: SharedMatrixN.h:19
A two-dimensional floating point vector used for computational geometry calculations and without asso...
Definition: Origin2.h:14
SHAREDVECTORN()
Default constructor - constructs an empty vector.
Definition: SharedVectorN.cpp:10
A 3x3 matrix that may be used for orientation, inertia tensors, etc.
Definition: Matrix3.h:20
void reset()
Resets the shared structure.
Definition: SharedVectorN.h:54
XVECTORN & operator*=(REAL scalar)
Multiplies this vector in place by a scalar.
Definition: SharedVectorN.h:393