29 #ifndef SCIMATH_RIGIDVECTOR_H
30 #define SCIMATH_RIGIDVECTOR_H
40 template <
class T, Int n>
class SquareMatrix;
102 template <
class T, Int n>
class RigidVector {
121 for (
Int i=0; i<n; i++) sum+=l.v_p[i]*r.v_p[i];
135 friend ostream& operator<<(ostream& os, const RigidVector<T,n>& v) {
148 for (
Int i=0; i<n; i++)
v_p[i]=T(0);
152 for (
Int i=0; i<n; i++)
v_p[i]=c;
177 const T& v4,
const T& v5) {
183 for (
Int i=0; i<n; i++)
v_p[i]=v[i];
187 for (
Int i=0; i<n; i++)
v_p[i]=v(i);
191 for (
Int i=0; i<n; i++)
v_p[i]=v.v_p[i];
195 for (
Int i=0; i<n; i++)
v_p[i]=v.v_p[i];
200 for (
Int i=0; i<n; i++)
v_p[i]=v(i);
205 for (
Int i=0; i<n; i++)
v_p[i]=c;
215 for (
Int i=0; i<n; i++)
v_p[i]+=v.v_p[i];
219 for (
Int i=0; i<n; i++)
v_p[i]*=v.v_p[i];
224 for (
Int i=0; i<n; i++)
v_p[i]-=v.v_p[i];
229 for (
Int i=0; i<n; i++)
v_p[i]*=val;
244 for (
Int i=0; i<n; i++) v(i)=
v_p[i];
297 #ifndef CASACORE_NO_AUTO_TEMPLATES
298 #include <casacore/scimath/Mathematics/RigidVector.tcc>
299 #endif //# CASACORE_NO_AUTO_TEMPLATES
RigidVector(const RigidVector< T, n > &v)
Copy constructor, copy semantics.
A 1-D Specialization of the Array class.
RigidVector()
RigidVector(Int dummy) { for (Int i=0; i<n; i++) v_p[i]=T(0); } Default constructor.
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 &c)
Construct from scalar, sets all elements to c.
RigidVector< T, n > & operator=(const Vector< T > &v)
Assign from a Vector.
RigidVector< Float, 4 > operator*(const SquareMatrix< Float, 4 > &m, const RigidVector< Float, 4 > &v)
Multiply vector by matrix.
LatticeExprNode sum(const LatticeExprNode &expr)
friend RigidVector< T, n > operator-(const RigidVector< T, n > &l, const RigidVector< T, n > &r)
Subtract two RigidVectors.
friend T operator*(const RigidVector< T, n > &l, const RigidVector< T, n > &r)
The innerproduct of 2 RigidVectors.
RigidVector< T, n > & operator=(const RigidVector< T, n > &v)
Assign from a RigidVector.
RigidVector< T, n > & operator+=(const RigidVector< T, n > &v)
Addition.
friend RigidVector< T, n > operator*(const RigidVector< T, n > &v, const T &f)
Multiply a RigidVector by a scalar.
RigidVector(const Vector< T > &v)
Construct from a Vector.
RigidVector(const T v[n])
Construct from a c-array (copy semantics)
RigidVector(const T &v0, const T &v1, const T &v2)
Construct a 3-element vector, fails for wrong size vectors.
Fast Vector classes with fixed (templated) length.
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.
T & operator()(Int i)
Indexing by reference.
Fast Square Matrix class with fixed (templated) size.
const T & operator()(Int i) const
Indexing by const reference.
RigidVector(const T &v0, const T &v1)
Construct a 2-element vector, fails for wrong size vectors.
Vector< T > vector() const
Convert to a regular Vector.
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< T, n > & operator*=(const RigidVector< T, n > &v)
T v_p[n]
// The following are needed for Image<RigidVector>
RigidVector< T, n > & operator*=(const T &val)
Multiplication by scalar.
friend RigidVector< T, n > operator+(const RigidVector< T, n > &l, const RigidVector< T, n > &r)
Add two RigidVectors.
RigidVector< Complex, 4 > operator*(const SquareMatrix< Complex, 4 > &m, const RigidVector< Complex, 4 > &v)
Multiply vector by matrix.
RigidVector< T, n > & operator-=(const RigidVector< T, n > &v)
Subtraction.
const Double c
Fundamental physical constants (SI units):
friend RigidVector< T, n > operator*(const T &f, const RigidVector< T, n > &v)
Multiply a RigidVector by a scalar.
RigidVector< T, n > sqrt(const RigidVector< T, n > &v)
Square Root.
RigidVector< T, n > & operator=(const T &c)
Assign a scalar, sets all elements to c.
RigidVector< T, n > & operator-()
Negation.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.