29 #ifndef SCIMATH_SQUAREMATRIX_H
30 #define SCIMATH_SQUAREMATRIX_H
40 template <
class T, Int n>
class RigidVector;
107 template <
class T, Int n>
class SquareMatrix {
148 const T*
pa=&a[0][0];
150 for (
Int i=0; i<n*n; i++) *pa_p++=*pa++;
158 for (
Int i=0; i<n; i++)
a_p[i][i]=vec[i];
310 ostream& operator<<(ostream& os, const SquareMatrix<Complex,2>& m);
311 ostream& operator<<(ostream& os, const SquareMatrix<Complex,4>& m);
312 ostream& operator<<(ostream& os, const SquareMatrix<Float,2>& m);
313 ostream& operator<<(ostream& os, const SquareMatrix<Float,4>& m);
320 #ifndef CASACORE_NO_AUTO_TEMPLATES
321 #include <casacore/scimath/Mathematics/SquareMatrix.tcc>
322 #endif //# CASACORE_NO_AUTO_TEMPLATES
Matrix< T > matrix() const
Convert the SquareMatrix to a Matrix.
SquareMatrix()
Default constructor - creates a unity matrix at present, this may not be what we want (non-intuitive...
SquareMatrix< T, n > & operator*=(const SquareMatrix< T, n > &other)
Matrix product of 'this' SquareMatrix with other, i.e., A*=B; is equivalent with A=A*B where '*' is m...
SquareMatrix< T, n > & adjoint()
Tranpose and conjugate the matrix in place(!).
~SquareMatrix()
Destructor.
SquareMatrix< T, n > & operator=(const T a[n][n])
Assign a c-style matrix, creates a general matrix.
T operator()(Int i, Int j) const
Indexing, only const indexing is allowed.
SquareMatrix(const Vector< T > &vec)
Construct from Vector, creates a diagonal matrix.
SquareMatrix(const T a[n][n])
Construct from c-style matrix (by copying elements).
LatticeExprNode conj(const LatticeExprNode &expr)
Fast Vector classes with fixed (templated) length.
SquareMatrix< T, n > & operator=(const SquareMatrix< T, n > &m)
Assignment, uses copy semantics.
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
Fast Square Matrix class with fixed (templated) size.
SquareMatrix(int itype)
Create a matrix of a given type, no initialization.
SquareMatrix(const T &scalar)
Construct from scalar, creates a scalar-identity matrix.
T & operator()(Int i, Int j)
Non const indexing, throws exception if you try to change an element which would require a type chang...
SquareMatrix(const SquareMatrix< T, n > &m)
Copy construct a SquareMatrix, a true copy is made.
SquareMatrix(const T vec[n])
Construct from c-style vector, creates a diagonal matrix.
SquareMatrix< T, n > & operator=(T val)
Assign a scalar, creates a scalar-identity matrix.
SquareMatrix< T, n > & operator+=(const SquareMatrix< T, n > &other)
Add two SquareMatrices, element by element.
SquareMatrix(const Matrix< T > &mat)
Construct from Matrix.
friend SquareMatrix< Complex, 4 > & directProduct(SquareMatrix< Complex, 4 > &result, const SquareMatrix< Complex, 2 > &left, const SquareMatrix< Complex, 2 > &right)
Global friend function to calculate direct product.
SquareMatrix< T, n > inverse() const
Return the inverse of the matrix by value.
SquareMatrix< T, n > & conj()
For a SquareMatrix<Complex,n>: set the argument result to the real part of the matrix (and return res...
friend RigidVector< Complex, 4 > operator*(const SquareMatrix< Complex, 4 > &m, const RigidVector< Float, 4 > &v)
friend class SquareMatrix<T,n*n>;// Sun native does not accept this friend class SquareMatrix<Complex...
SquareMatrix< T, n > & operator=(const T vec[n])
Assign a c-style vector, creates a diagonal matrix.