; // for directProduct of 2x2
Global friend function for product of Complex matrix and Float 4-vector
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
Enum used internally to optimize operations.
Destructor
Default constructor - creates a unity matrix at present, this may not
be what we want (non-intuitive?)
SquareMatrix(int itype) : type_p(itype)
Create a matrix of a given type, no initialization
SquareMatrix(const SquareMatrix<T,n>& m)
Copy construct a SquareMatrix, a true copy is made.
Construct from c-style matrix (by copying elements).
Construct from Matrix.
Construct from c-style vector, creates a diagonal matrix.
Construct from Vector, creates a diagonal matrix.
SquareMatrix(const T& scalar) : type_p(ScalarId)
Construct from scalar, creates a scalar-identity matrix
SquareMatrix<T,n>& operator=(const SquareMatrix<T,n>& m)
Assignment, uses copy semantics.
SquareMatrix<T,n>& operator=(const T a[n][n])
Assign a c-style matrix, creates a general matrix.
SquareMatrix<T,n>& operator=(const n<T>& m)
Assign a Matrix, creates a general matrix.
SquareMatrix<T,n>& operator=(const T vec[n])
Assign a c-style vector, creates a diagonal matrix
SquareMatrix<T,n>& operator=(const n<T>& v)
Assign a 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<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 matrix multiplication.
SquareMatrix<T,n>& operator*=(Float f)
Scalar multiplication
T operator()(Int i, Int j) const
Indexing, only const indexing is allowed. You cannot change the
matrix via indexing. No bounds checking.
Non const indexing, throws exception if you try to change an element
which would require a type change of the matrix
SquareMatrix<T,n>& conj()
For a SquareMatrix<Complex,n>:
set the argument result to the real part of the matrix
(and return result by reference to allow use in
expressions without creating temporary).
For a SquareMatrix<Complex,n>:
return the real part of the matrix.
Conjugate the matrix in place(!).
SquareMatrix<T,n>& adjoint()
Tranpose and conjugate the matrix in place(!).
SquareMatrix<T,n>& conj(SquareMatrix<T,n>& result)
Conjugate the matrix, return it in result (and by ref)
SquareMatrix<T,n>& adjoint(SquareMatrix<T,n>& result)
Tranpose and conjugate the matrix, return it in result (and by ref)
SquareMatrix<T,n>& inverse(SquareMatrix<T,n>& result) const
Compute the inverse of the matrix and return it in result (also
returns result by reference).
SquareMatrix<T,n> inverse() const
Return the inverse of the matrix by value.
Assign 'this' to the Matrix result, also return result by reference.
Convert the SquareMatrix to a Matrix.
Interface
- SquareMatrix<Complex,4> directProduct(const SquareMatrix<Complex,2>& left, const SquareMatrix<Complex,2>& right)
- SquareMatrix<Complex,2> conj(const SquareMatrix<Complex,2>& m)
- SquareMatrix<Complex,4> conj(const SquareMatrix<Complex,4>& m)
- SquareMatrix<Complex,2> adjoint(const SquareMatrix<Complex,2>& m)
- SquareMatrix<Complex,4> adjoint(const SquareMatrix<Complex,4>& m)
- ostream& operator<<(ostream& os, const SquareMatrix<Complex,2>& m)
- ostream& operator<<(ostream& os, const SquareMatrix<Complex,4>& m)
- ostream& operator<<(ostream& os, const SquareMatrix<Float,2>& m)
- ostream& operator<<(ostream& os, const SquareMatrix<Float,4>& m)
Member Description
Calculate direct product of two SquareMatrices.
Return conjugate of SquareMatrix.
Return conjugate of SquareMatrix.
Return adjoint of SquareMatrix.
Return adjoint of SquareMatrix.
ostream& operator<<(ostream& os, const SquareMatrix<Complex,2>& m)
Write SquareMatrix to output, uses Matrix to do the work.
ostream& operator<<(ostream& os, const SquareMatrix<Complex,4>& m)
ostream& operator<<(ostream& os, const SquareMatrix<Float,2>& m)
ostream& operator<<(ostream& os, const SquareMatrix<Float,4>& m)