casacore
|
#include <RigidVector.h>
Public Member Functions | |
RigidVector () | |
RigidVector(Int dummy) { for (Int i=0; i<n; i++) v_p[i]=T(0); } Default constructor. | |
RigidVector (const T &c) | |
Construct from scalar, sets all elements to c. | |
RigidVector (const T &v0, const T &v1) | |
Construct a 2-element vector, fails for wrong size vectors. | |
RigidVector (const T &v0, const T &v1, const T &v2) | |
Construct a 3-element vector, fails for wrong size vectors. | |
RigidVector (const T &v0, const T &v1, const T &v2, const T &v3) | |
Construct a 4-element vector, fails for wrong size vectors. | |
RigidVector (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4) | |
Construct a 5-element vector, fails for wrong size vectors. | |
RigidVector (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5) | |
Construct a 6-element vector, fails for wrong size vectors. | |
RigidVector (const T v[n]) | |
Construct from a c-array (copy semantics) | |
RigidVector (const Vector< T > &v) | |
Construct from a Vector. | |
RigidVector (const RigidVector< T, n > &v) | |
Copy constructor, copy semantics. | |
RigidVector< T, n > & | operator= (const RigidVector< T, n > &v) |
Assign from a RigidVector. | |
RigidVector< T, n > & | operator= (const Vector< T > &v) |
Assign from a Vector. | |
RigidVector< T, n > & | operator= (const T &c) |
Assign a scalar, sets all elements to c. | |
RigidVector< T, n > & | operator- () |
Negation. | |
RigidVector< T, n > & | operator+= (const RigidVector< T, n > &v) |
Addition | |
RigidVector< T, n > & | operator*= (const RigidVector< T, n > &v) |
RigidVector< T, n > & | operator-= (const RigidVector< T, n > &v) |
Subtraction. | |
RigidVector< T, n > & | operator*= (const T &val) |
Multiplication by scalar. | |
RigidVector< T, n > & | operator*= (const SquareMatrix< T, n > &m) |
Multiply vector by matrix: v*=M is equivalent to v=M*v;. | |
T & | operator() (Int i) |
Indexing by reference. | |
const T & | operator() (Int i) const |
Indexing by const reference. | |
Vector< T > | vector () const |
Convert to a regular Vector. | |
RigidVector< T, n > | sqrt (const RigidVector< T, n > &v) |
Square Root. | |
Protected Attributes | |
T | v_p [n] |
// The following are needed for Image<RigidVector> | |
Friends | |
RigidVector< T, n > | operator+ (const RigidVector< T, n > &l, const RigidVector< T, n > &r) |
Add two RigidVectors. | |
RigidVector< T, n > | operator- (const RigidVector< T, n > &l, const RigidVector< T, n > &r) |
Subtract two RigidVectors. | |
T | operator* (const RigidVector< T, n > &l, const RigidVector< T, n > &r) |
The innerproduct of 2 RigidVectors. | |
RigidVector< T, n > | operator* (const T &f, const RigidVector< T, n > &v) |
Multiply a RigidVector by a scalar. | |
RigidVector< T, n > | operator* (const RigidVector< T, n > &v, const T &f) |
Multiply a RigidVector by a scalar. | |
ostream & | operator<< (ostream &os, const RigidVector< T, n > &v) |
Write out a RigidVector using the Vector output method. | |
RigidVector< Complex, 4 > | operator* (const SquareMatrix< Complex, 4 > &m, const RigidVector< Float, 4 > &v) |
Special matrix multiply of Complex matrix * Float vector. | |
Fast Vector classes with fixed (templated) length
Public interface
RigidVector is a vector with a size fixed at compile time, i.e. Rigid as compared to the normal Vector class.
RigidVector is a specialized Vector class for short (<25 elements) vectors. It has a size fixed at compile time, avoids new and delete and uses copy semantics throughout. Unlike Vectors, RigidVectors have fixed zero origin and no strides, allowing fast indexing. The more common mathematical operations are defined for RigidVector, allowing element by element arithmetic, innerproduct and matrix multiplication (by a SquareMatrix). Conversion to and from normal vectors is provided.
The standard Vector class is rather inefficient for short vectors, this class is designed for speed and simplicity.
Definition at line 99 of file RigidVector.h.
|
inline |
RigidVector(Int dummy) { for (Int i=0; i<n; i++) v_p[i]=T(0); } Default constructor.
Definition at line 144 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p, and casacore::RigidVector< T, n >::vector().
Construct from scalar, sets all elements to c.
Definition at line 148 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
Construct a 2-element vector, fails for wrong size vectors.
Definition at line 152 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p, and casacore::RigidVector< T, n >::vector().
Construct a 3-element vector, fails for wrong size vectors.
Definition at line 157 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p, and casacore::RigidVector< T, n >::vector().
|
inline |
Construct a 4-element vector, fails for wrong size vectors.
Definition at line 162 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p, and casacore::RigidVector< T, n >::vector().
|
inline |
Construct a 5-element vector, fails for wrong size vectors.
Definition at line 167 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p, and casacore::RigidVector< T, n >::vector().
|
inline |
Construct a 6-element vector, fails for wrong size vectors.
Definition at line 173 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p, and casacore::RigidVector< T, n >::vector().
Construct from a c-array (copy semantics)
Definition at line 179 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Construct from a Vector.
Definition at line 183 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Copy constructor, copy semantics.
Definition at line 187 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Indexing by reference.
Definition at line 233 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Indexing by const reference.
Definition at line 235 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Definition at line 215 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
RigidVector< T, n > & casacore::RigidVector< T, n >::operator*= | ( | const SquareMatrix< T, n > & | m | ) |
Multiply vector by matrix: v*=M is equivalent to v=M*v;.
|
inline |
Multiplication by scalar.
Definition at line 225 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Addition
Definition at line 211 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Negation.
Definition at line 206 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Subtraction.
Definition at line 220 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Assign from a RigidVector.
Definition at line 191 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Assign a scalar, sets all elements to c.
Definition at line 201 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
|
inline |
Assign from a Vector.
Definition at line 196 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
RigidVector< T, n > casacore::RigidVector< T, n >::sqrt | ( | const RigidVector< T, n > & | v | ) |
Square Root.
|
inline |
Convert to a regular Vector.
Definition at line 239 of file RigidVector.h.
References casacore::RigidVector< T, n >::v_p.
Referenced by casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), and casacore::RigidVector< T, n >::RigidVector().
|
friend |
The innerproduct of 2 RigidVectors.
Definition at line 115 of file RigidVector.h.
|
friend |
Multiply a RigidVector by a scalar.
Definition at line 127 of file RigidVector.h.
|
friend |
Special matrix multiply of Complex matrix * Float vector.
|
friend |
Multiply a RigidVector by a scalar.
Definition at line 122 of file RigidVector.h.
|
friend |
Add two RigidVectors.
Definition at line 103 of file RigidVector.h.
|
friend |
Subtract two RigidVectors.
Definition at line 109 of file RigidVector.h.
|
friend |
Write out a RigidVector using the Vector output method.
Definition at line 132 of file RigidVector.h.
// The following are needed for Image<RigidVector>
static IPosition shape() {return IPosition(1,n);}
static void* newCopyInfo (const TableRecord& record, const IPosition& sourceElementShape);
static void deleteCopyInfo (void*);
static void set (void* copyInfo, void* out, const Array<T>& in, const IPosition& shape); static void get (void* copyInfo, Array<T>& out, const void* in, const IPosition& shape);
Definition at line 264 of file RigidVector.h.
Referenced by casacore::RigidVector< T, n >::operator()(), casacore::RigidVector< T, n >::operator()(), casacore::RigidVector< T, n >::operator*=(), casacore::RigidVector< T, n >::operator*=(), casacore::RigidVector< T, n >::operator+=(), casacore::RigidVector< T, n >::operator-(), casacore::RigidVector< T, n >::operator-=(), casacore::RigidVector< T, n >::operator=(), casacore::RigidVector< T, n >::operator=(), casacore::RigidVector< T, n >::operator=(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), casacore::RigidVector< T, n >::RigidVector(), and casacore::RigidVector< T, n >::vector().