SquareMatrix.h File Reference

A square matrix class. More...

#include "TensorTypes.h"
#include "../defs.h"
#include <cstddef>
#include "../array/FixedArray.h"
#include "../../third-party/loki/static_check.h"
#include <iosfwd>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cassert>
#include <cmath>

Go to the source code of this file.

Classes

class  SquareMatrix< N, T >
 An NxN matrix. More...
class  SquareMatrix< 1, T >
 A 1x1 matrix. More...
class  SquareMatrix< 2, T >
 A 2x2 matrix. More...
class  SquareMatrix< 3, T >
 A 3x3 matrix. More...

Functions

template<typename T , int N>
SquareMatrix< N, T > operator+ (const SquareMatrix< N, T > &m, const T x)
 SquareMatrix-scalar addition.
template<typename T , int N>
SquareMatrix< N, T > operator+ (const T x, const SquareMatrix< N, T > &m)
 Scalar-SquareMatrix addition.
template<typename T , int N>
SquareMatrix< N, T > operator+ (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y)
 SquareMatrix-SquareMatrix addition.
template<typename T , int N>
SquareMatrix< N, T > operator- (const SquareMatrix< N, T > &m, const T x)
 SquareMatrix-scalar subtraction.
template<typename T , int N>
SquareMatrix< N, T > operator- (const T x, const SquareMatrix< N, T > &m)
 Scalar-SquareMatrix subtraction.
template<typename T , int N>
SquareMatrix< N, T > operator- (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y)
 SquareMatrix-SquareMatrix subtraction.
template<int N, typename T >
SquareMatrix< N, T > operator* (const SquareMatrix< N, T > &m, const T x)
 SquareMatrix-scalar product.
template<int N, typename T >
SquareMatrix< N, T > operator* (const T x, const SquareMatrix< N, T > &m)
 Scalar-SquareMatrix product.
template<int N, typename T >
SquareMatrix< N, T > operator* (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y)
 SquareMatrix-SquareMatrix product.
template<int N, typename T >
SquareMatrix< N, T > operator/ (const SquareMatrix< N, T > &m, const T x)
 SquareMatrix-scalar division.
template<int N, typename T >
SquareMatrix< N, T > operator/ (const T x, const SquareMatrix< N, T > &m)
 Scalar-SquareMatrix division.
template<int N, typename T >
computeSum (const SquareMatrix< N, T > &x)
 Return the sum of the elements.
template<int N, typename T >
computeProduct (const SquareMatrix< N, T > &x)
 Return the product of the elements.
template<int N, typename T >
computeMinimum (const SquareMatrix< N, T > &x)
 Return the minimum element. Use < for comparison.
template<int N, typename T >
computeMaximum (const SquareMatrix< N, T > &x)
 Return the maximum element. Use > for comparison.
template<int N, typename T >
computeDeterminant (const SquareMatrix< N, T > &x)
 Return the determinant of the matrix.
template<int N, typename T >
computeTrace (const SquareMatrix< N, T > &x)
 Return the trace of the matrix.
template<int N, typename T >
SquareMatrix< N, T > computeTranspose (const SquareMatrix< N, T > &x)
 Return the transpose of the matrix.
template<int N, typename T >
SquareMatrix< N, T > computeInverse (const SquareMatrix< N, T > &x)
 Return the inverse of the matrix.
template<int N, typename T >
void computeInverse (const SquareMatrix< N, T > &x, SquareMatrix< N, T > *y)
 Compute the inverse of the matrix.
template<int N, typename T >
void computeScaledInverse (const SquareMatrix< N, T > &x, SquareMatrix< N, T > *si)
 Calculate the scaled inverse of the matrix: determinant * inverse.
template<int N, typename T >
SquareMatrix< N, T > computeScaledInverse (const SquareMatrix< N, T > &x)
 Return the scaled inverse of the matrix: determinant * inverse.
template<int N, typename T >
computeFrobeniusNormSquared (const SquareMatrix< N, T > &x)
 Return the frobenius norm of the matrix.
template<int N, typename T >
computeFrobeniusNorm (const SquareMatrix< N, T > &x)
 Return the frobenius norm of the matrix.
template<int N, typename T >
computeInnerProduct (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y)
 Return the inner product of the matrices. computeTrace(transpose(x) * y).
template<int N, typename T >
void computeProduct (const SquareMatrix< N, T > &m, const FixedArray< N, T > &v, FixedArray< N, T > *x)
 Compute the matrix-vector product. x = m * v.
template<int N, typename T1 , typename T2 >
bool operator== (const SquareMatrix< N, T1 > &a, const SquareMatrix< N, T2 > &b)
 Return true if the matrices are equal.
template<int N, typename T1 , typename T2 >
bool operator!= (const SquareMatrix< N, T1 > &a, const SquareMatrix< N, T2 > &b)
 Return true if the tensors are not equal.
template<int N, typename T >
std::ostream & operator<< (std::ostream &out, const SquareMatrix< N, T > &x)
 Write a matrix as rows with space-separated numbers.
template<int N, typename T >
std::istream & operator>> (std::istream &in, SquareMatrix< N, T > &x)
 Read white space-separated numbers into a matrix.
template<typename T >
SquareMatrix< 1, T > operator+ (const SquareMatrix< 1, T > &m, const T x)
 SquareMatrix-scalar addition.
template<typename T >
SquareMatrix< 1, T > operator+ (const T x, const SquareMatrix< 1, T > &m)
 Scalar-SquareMatrix addition.
template<typename T >
SquareMatrix< 1, T > operator+ (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y)
 SquareMatrix-SquareMatrix addition.
template<typename T >
SquareMatrix< 1, T > operator- (const SquareMatrix< 1, T > &m, const T x)
 SquareMatrix-scalar subtraction.
template<typename T >
SquareMatrix< 1, T > operator- (const T x, const SquareMatrix< 1, T > &m)
 Scalar-SquareMatrix subtraction.
template<typename T >
SquareMatrix< 1, T > operator- (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y)
 SquareMatrix-SquareMatrix subtraction.
template<typename T >
SquareMatrix< 1, T > operator* (const SquareMatrix< 1, T > &m, const T x)
 SquareMatrix-scalar product.
template<typename T >
SquareMatrix< 1, T > operator* (const T x, const SquareMatrix< 1, T > &m)
 Scalar-SquareMatrix product.
template<typename T >
SquareMatrix< 1, T > operator* (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y)
 SquareMatrix-SquareMatrix product.
template<typename T >
SquareMatrix< 1, T > operator/ (const SquareMatrix< 1, T > &m, const T x)
 SquareMatrix-scalar division.
template<typename T >
SquareMatrix< 1, T > operator/ (const T x, const SquareMatrix< 1, T > &m)
 Scalar-SquareMatrix division.
template<typename T >
computeSum (const SquareMatrix< 1, T > &x)
 Return the sum of the elements.
template<typename T >
computeProduct (const SquareMatrix< 1, T > &x)
 Return the product of the elements.
template<typename T >
computeMinimum (const SquareMatrix< 1, T > &x)
 Return the minimum element. Use < for comparison.
template<typename T >
computeMaximum (const SquareMatrix< 1, T > &x)
 Return the maximum element. Use > for comparison.
template<typename T >
computeDeterminant (const SquareMatrix< 1, T > &x)
 Return the determinant of the matrix.
template<typename T >
computeTrace (const SquareMatrix< 1, T > &x)
 Return the trace of the matrix.
template<typename T >
SquareMatrix< 1, T > computeTranspose (const SquareMatrix< 1, T > &x)
 Return the transpose of the matrix.
template<typename T >
SquareMatrix< 1, T > computeInverse (const SquareMatrix< 1, T > &x)
 Return the inverse of the matrix.
template<typename T >
void computeInverse (const SquareMatrix< 1, T > &x, SquareMatrix< 1, T > *y)
 Compute the inverse of the matrix.
template<typename T >
void computeScaledInverse (const SquareMatrix< 1, T > &x, SquareMatrix< 1, T > *si)
 Calculate the scaled inverse of the matrix: determinant * inverse.
template<typename T >
SquareMatrix< 1, T > computeScaledInverse (const SquareMatrix< 1, T > &x)
 Return the scaled inverse of the matrix: determinant * inverse.
template<typename T >
computeFrobeniusNorm (const SquareMatrix< 1, T > &x)
 Return the frobenius norm of the matrix.
template<typename T >
computeFrobeniusNormSquared (const SquareMatrix< 1, T > &x)
 Return the frobenius norm of the matrix.
template<typename T >
computeInnerProduct (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y)
 Return the inner product of the matrices. computeTrace(transpose(x) * y).
template<typename T >
void computeProduct (const SquareMatrix< 1, T > &m, const FixedArray< 1, T > &v, FixedArray< 1, T > *x)
 Compute the matrix-vector product. x = m * v.
template<typename T1 , typename T2 >
bool operator== (const SquareMatrix< 1, T1 > &a, const SquareMatrix< 1, T2 > &b)
 Return true if the matrices are equal.
template<typename T1 , typename T2 >
bool operator!= (const SquareMatrix< 1, T1 > &a, const SquareMatrix< 1, T2 > &b)
 Return true if the tensors are not equal.
template<typename T >
std::ostream & operator<< (std::ostream &out, const SquareMatrix< 1, T > &x)
 Write a matrix as rows with space-separated numbers.
template<typename T >
std::istream & operator>> (std::istream &in, SquareMatrix< 1, T > &x)
 Read white space-separated numbers into a matrix.
template<typename T >
SquareMatrix< 2, T > operator+ (const SquareMatrix< 2, T > &m, const T x)
 SquareMatrix-scalar addition.
template<typename T >
SquareMatrix< 2, T > operator+ (const T x, const SquareMatrix< 2, T > &m)
 Scalar-SquareMatrix addition.
template<typename T >
SquareMatrix< 2, T > operator+ (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y)
 SquareMatrix-SquareMatrix addition.
template<typename T >
SquareMatrix< 2, T > operator- (const SquareMatrix< 2, T > &m, const T x)
 SquareMatrix-scalar subtraction.
template<typename T >
SquareMatrix< 2, T > operator- (const T x, const SquareMatrix< 2, T > &m)
 Scalar-SquareMatrix subtraction.
template<typename T >
SquareMatrix< 2, T > operator- (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y)
 SquareMatrix-SquareMatrix subtraction.
template<typename T >
SquareMatrix< 2, T > operator* (const SquareMatrix< 2, T > &m, const T x)
 SquareMatrix-scalar product.
template<typename T >
SquareMatrix< 2, T > operator* (const T x, const SquareMatrix< 2, T > &m)
 Scalar-SquareMatrix product.
template<typename T >
SquareMatrix< 2, T > operator* (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y)
 SquareMatrix-SquareMatrix product.
template<typename T >
SquareMatrix< 2, T > operator/ (const SquareMatrix< 2, T > &m, const T x)
 SquareMatrix-scalar division.
template<typename T >
SquareMatrix< 2, T > operator/ (const T x, const SquareMatrix< 2, T > &m)
 Scalar-SquareMatrix division.
template<typename T >
computeSum (const SquareMatrix< 2, T > &x)
 Return the sum of the elements.
template<typename T >
computeProduct (const SquareMatrix< 2, T > &x)
 Return the product of the elements.
template<typename T >
computeMinimum (const SquareMatrix< 2, T > &x)
 Return the minimum element. Use < for comparison.
template<typename T >
computeMaximum (const SquareMatrix< 2, T > &x)
 Return the maximum element. Use > for comparison.
template<typename T >
computeDeterminant (const SquareMatrix< 2, T > &x)
 Return the determinant of the matrix.
template<typename T >
computeTrace (const SquareMatrix< 2, T > &x)
 Return the trace of the matrix.
template<typename T >
SquareMatrix< 2, T > computeTranspose (const SquareMatrix< 2, T > &x)
 Return the transpose of the matrix.
template<typename T >
SquareMatrix< 2, T > computeInverse (const SquareMatrix< 2, T > &x)
 Return the inverse of the matrix.
template<typename T >
SquareMatrix< 2, T > computeInverse (const SquareMatrix< 2, T > &x, const T det)
 Return the inverse of the matrix given the matrix and its determinant.
template<typename T >
void computeInverse (const SquareMatrix< 2, T > &x, SquareMatrix< 2, T > *y)
 Compute the inverse of the matrix.
template<typename T >
void computeInverse (const SquareMatrix< 2, T > &x, const T det, SquareMatrix< 2, T > *y)
 Compute the inverse of the matrix given its determinant.
template<typename T >
void computeScaledInverse (const SquareMatrix< 2, T > &x, SquareMatrix< 2, T > *si)
 Calculate the scaled inverse of the matrix: determinant * inverse.
template<typename T >
SquareMatrix< 2, T > computeScaledInverse (const SquareMatrix< 2, T > &x)
 Return the scaled inverse of the matrix: determinant * inverse.
template<typename T >
computeFrobeniusNorm (const SquareMatrix< 2, T > &x)
 Return the frobenius norm of the matrix.
template<typename T >
computeFrobeniusNormSquared (const SquareMatrix< 2, T > &x)
 Return the frobenius norm of the matrix.
template<typename T >
computeInnerProduct (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y)
 Return the inner product of the matrices. computeTrace(transpose(x) * y).
template<typename T >
void computeProduct (const SquareMatrix< 2, T > &m, const FixedArray< 2, T > &v, FixedArray< 2, T > *x)
 Compute the matrix-vector product. x = m * v.
template<typename T1 , typename T2 >
bool operator== (const SquareMatrix< 2, T1 > &a, const SquareMatrix< 2, T2 > &b)
 Return true if the matrices are equal.
template<typename T1 , typename T2 >
bool operator!= (const SquareMatrix< 2, T1 > &a, const SquareMatrix< 2, T2 > &b)
 Return true if the tensors are not equal.
template<typename T >
std::ostream & operator<< (std::ostream &out, const SquareMatrix< 2, T > &x)
 Write a matrix as rows with space-separated numbers.
template<typename T >
std::istream & operator>> (std::istream &in, SquareMatrix< 2, T > &x)
 Read white space-separated numbers into a matrix.
template<typename T >
SquareMatrix< 3, T > operator+ (const SquareMatrix< 3, T > &m, const T x)
 SquareMatrix-scalar addition.
template<typename T >
SquareMatrix< 3, T > operator+ (const T x, const SquareMatrix< 3, T > &m)
 Scalar-SquareMatrix addition.
template<typename T >
SquareMatrix< 3, T > operator+ (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y)
 SquareMatrix-SquareMatrix addition.
template<typename T >
SquareMatrix< 3, T > operator- (const SquareMatrix< 3, T > &m, const T x)
 SquareMatrix-scalar subtraction.
template<typename T >
SquareMatrix< 3, T > operator- (const T x, const SquareMatrix< 3, T > &m)
 Scalar-SquareMatrix subtraction.
template<typename T >
SquareMatrix< 3, T > operator- (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y)
 SquareMatrix-SquareMatrix subtraction.
template<typename T >
SquareMatrix< 3, T > operator* (const SquareMatrix< 3, T > &m, const T x)
 SquareMatrix-scalar product.
template<typename T >
SquareMatrix< 3, T > operator* (const T x, const SquareMatrix< 3, T > &m)
 Scalar-SquareMatrix product.
template<typename T >
SquareMatrix< 3, T > operator* (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y)
 SquareMatrix-SquareMatrix product.
template<typename T >
SquareMatrix< 3, T > operator/ (const SquareMatrix< 3, T > &m, const T x)
 SquareMatrix-scalar division.
template<typename T >
SquareMatrix< 3, T > operator/ (const T x, const SquareMatrix< 3, T > &m)
 Scalar-SquareMatrix division.
template<typename T >
computeSum (const SquareMatrix< 3, T > &x)
 Return the sum of the elements.
template<typename T >
computeProduct (const SquareMatrix< 3, T > &x)
 Return the product of the elements.
template<typename T >
computeMinimum (const SquareMatrix< 3, T > &x)
 Return the minimum element. Use < for comparison.
template<typename T >
computeMaximum (const SquareMatrix< 3, T > &x)
 Return the maximum element. Use > for comparison.
template<typename T >
computeDeterminant (const SquareMatrix< 3, T > &x)
 Return the determinant of the matrix.
template<typename T >
computeTrace (const SquareMatrix< 3, T > &x)
 Return the trace of the matrix.
template<typename T >
SquareMatrix< 3, T > computeTranspose (const SquareMatrix< 3, T > &x)
 Return the transpose of the matrix.
template<typename T >
SquareMatrix< 3, T > computeInverse (const SquareMatrix< 3, T > &x)
 Return the inverse of the matrix.
template<typename T >
SquareMatrix< 3, T > computeInverse (const SquareMatrix< 3, T > &x, const T det)
 Return the inverse of the matrix given the matrix and its determinant.
template<typename T >
void computeInverse (const SquareMatrix< 3, T > &x, SquareMatrix< 3, T > *y)
 Compute the inverse of the matrix.
template<typename T >
void computeInverse (const SquareMatrix< 3, T > &x, const T det, SquareMatrix< 3, T > *y)
 Compute the inverse of the matrix given its determinant.
template<typename T >
void computeScaledInverse (const SquareMatrix< 3, T > &x, SquareMatrix< 3, T > *si)
 Calculate the scaled inverse of the matrix: determinant * inverse.
template<typename T >
SquareMatrix< 3, T > computeScaledInverse (const SquareMatrix< 3, T > &x)
 Return the scaled inverse of the matrix: determinant * inverse.
template<typename T >
computeFrobeniusNorm (const SquareMatrix< 3, T > &x)
 Return the frobenius norm of the matrix.
template<typename T >
computeFrobeniusNormSquared (const SquareMatrix< 3, T > &x)
 Return the frobenius norm of the matrix.
template<typename T >
computeInnerProduct (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y)
 Return the inner product of the matrices. computeTrace(transpose(x) * y).
template<typename T >
void computeProduct (const SquareMatrix< 3, T > &m, const FixedArray< 3, T > &v, FixedArray< 3, T > *x)
 Compute the matrix-vector product. x = m * v.
template<typename T1 , typename T2 >
bool operator== (const SquareMatrix< 3, T1 > &a, const SquareMatrix< 3, T2 > &b)
 Return true if the matrices are equal.
template<typename T1 , typename T2 >
bool operator!= (const SquareMatrix< 3, T1 > &a, const SquareMatrix< 3, T2 > &b)
 Return true if the tensors are not equal.
template<typename T >
std::ostream & operator<< (std::ostream &out, const SquareMatrix< 3, T > &x)
 Write a matrix as rows with space-separated numbers.
template<typename T >
std::istream & operator>> (std::istream &in, SquareMatrix< 3, T > &x)
 Read white space-separated numbers into a matrix.

Detailed Description

A square matrix class.

Generated on Thu Jun 30 02:14:51 2016 for Algorithms and Data Structures Package by  doxygen 1.6.3