casacore
|
Fast Vector classes with fixed (templated) length. More...
#include <RigidVector.h>
Public Member Functions | |
RigidVector () | |
RigidVector(Int dummy) { for (Int i=0; i<n; i++) v_p[i]=T(0); } Default constructor. More... | |
RigidVector (const T &c) | |
Construct from scalar, sets all elements to c. More... | |
RigidVector (const T &v0, const T &v1) | |
Construct a 2-element vector, fails for wrong size vectors. More... | |
RigidVector (const T &v0, const T &v1, const T &v2) | |
Construct a 3-element vector, fails for wrong size vectors. More... | |
RigidVector (const T &v0, const T &v1, const T &v2, const T &v3) | |
Construct a 4-element vector, fails for wrong size vectors. More... | |
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. More... | |
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. More... | |
RigidVector (const T v[n]) | |
Construct from a c-array (copy semantics) More... | |
RigidVector (const Vector< T > &v) | |
Construct from a Vector. More... | |
RigidVector (const RigidVector< T, n > &v) | |
Copy constructor, copy semantics. More... | |
RigidVector< T, n > & | operator= (const RigidVector< T, n > &v) |
Assign from a RigidVector. More... | |
RigidVector< T, n > & | operator= (const Vector< T > &v) |
Assign from a Vector. More... | |
RigidVector< T, n > & | operator= (const T &c) |
Assign a scalar, sets all elements to c. More... | |
RigidVector< T, n > & | operator- () |
Negation. More... | |
RigidVector< T, n > & | operator+= (const RigidVector< T, n > &v) |
Addition. More... | |
RigidVector< T, n > & | operator*= (const RigidVector< T, n > &v) |
RigidVector< T, n > & | operator-= (const RigidVector< T, n > &v) |
Subtraction. More... | |
RigidVector< T, n > & | operator*= (const T &val) |
Multiplication by scalar. More... | |
RigidVector< T, n > & | operator*= (const SquareMatrix< T, n > &m) |
Multiply vector by matrix: v*=M is equivalent to v=M*v;. More... | |
T & | operator() (Int i) |
Indexing by reference. More... | |
const T & | operator() (Int i) const |
Indexing by const reference. More... | |
Vector< T > | vector () const |
Convert to a regular Vector. More... | |
RigidVector< T, n > | sqrt (const RigidVector< T, n > &v) |
Square Root. More... | |
Protected Attributes | |
T | v_p [n] |
// The following are needed for Image<RigidVector> More... | |
Friends | |
RigidVector< T, n > | operator+ (const RigidVector< T, n > &l, const RigidVector< T, n > &r) |
Add two RigidVectors. More... | |
RigidVector< T, n > | operator- (const RigidVector< T, n > &l, const RigidVector< T, n > &r) |
Subtract two RigidVectors. More... | |
T | operator* (const RigidVector< T, n > &l, const RigidVector< T, n > &r) |
The innerproduct of 2 RigidVectors. More... | |
RigidVector< T, n > | operator* (const T &f, const RigidVector< T, n > &v) |
Multiply a RigidVector by a scalar. More... | |
RigidVector< T, n > | operator* (const RigidVector< T, n > &v, const T &f) |
Multiply a RigidVector by a scalar. More... | |
ostream & | operator<< (ostream &os, const RigidVector< T, n > &v) |
Write out a RigidVector using the Vector output method. More... | |
RigidVector< Complex, 4 > | operator* (const SquareMatrix< Complex, 4 > &m, const RigidVector< Float, 4 > &v) |
Special matrix multiply of Complex matrix * Float vector. More... | |
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 102 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 147 of file RigidVector.h.
|
inline |
Construct from scalar, sets all elements to c.
Definition at line 151 of file RigidVector.h.
|
inline |
Construct a 2-element vector, fails for wrong size vectors.
Definition at line 155 of file RigidVector.h.
|
inline |
Construct a 3-element vector, fails for wrong size vectors.
Definition at line 160 of file RigidVector.h.
|
inline |
Construct a 4-element vector, fails for wrong size vectors.
Definition at line 165 of file RigidVector.h.
|
inline |
Construct a 5-element vector, fails for wrong size vectors.
Definition at line 170 of file RigidVector.h.
|
inline |
Construct a 6-element vector, fails for wrong size vectors.
Definition at line 176 of file RigidVector.h.
|
inline |
Construct from a c-array (copy semantics)
Definition at line 182 of file RigidVector.h.
|
inline |
Construct from a Vector.
Definition at line 186 of file RigidVector.h.
|
inline |
Copy constructor, copy semantics.
Definition at line 190 of file RigidVector.h.
|
inline |
Indexing by reference.
Definition at line 236 of file RigidVector.h.
|
inline |
Indexing by const reference.
Definition at line 238 of file RigidVector.h.
|
inline |
Definition at line 218 of file RigidVector.h.
|
inline |
Multiplication by scalar.
Definition at line 228 of file RigidVector.h.
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 |
Addition.
Definition at line 214 of file RigidVector.h.
|
inline |
Negation.
Definition at line 209 of file RigidVector.h.
|
inline |
Subtraction.
Definition at line 223 of file RigidVector.h.
|
inline |
Assign from a RigidVector.
Definition at line 194 of file RigidVector.h.
|
inline |
Assign from a Vector.
Definition at line 199 of file RigidVector.h.
|
inline |
Assign a scalar, sets all elements to c.
Definition at line 204 of file RigidVector.h.
RigidVector<T,n> casacore::RigidVector< T, n >::sqrt | ( | const RigidVector< T, n > & | v | ) |
Square Root.
|
inline |
Convert to a regular Vector.
Definition at line 242 of file RigidVector.h.
|
friend |
The innerproduct of 2 RigidVectors.
Definition at line 118 of file RigidVector.h.
|
friend |
Multiply a RigidVector by a scalar.
Definition at line 125 of file RigidVector.h.
|
friend |
Multiply a RigidVector by a scalar.
Definition at line 130 of file RigidVector.h.
|
friend |
Special matrix multiply of Complex matrix * Float vector.
|
friend |
Add two RigidVectors.
Definition at line 106 of file RigidVector.h.
|
friend |
Subtract two RigidVectors.
Definition at line 112 of file RigidVector.h.
|
friend |
Write out a RigidVector using the Vector output method.
Definition at line 135 of file RigidVector.h.
|
protected |
// 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 267 of file RigidVector.h.
Referenced by casacore::RigidVector< Double, 2 >::operator()(), casacore::RigidVector< Double, 2 >::operator*=(), casacore::RigidVector< Double, 2 >::operator+=(), casacore::RigidVector< Double, 2 >::operator-(), casacore::RigidVector< Double, 2 >::operator-=(), casacore::RigidVector< Double, 2 >::operator=(), casacore::RigidVector< Double, 2 >::RigidVector(), and casacore::RigidVector< Double, 2 >::vector().