#include "TensorTypes.h"
#include "../array/FixedArray.h"
#include "../../third-party/loki/static_check.h"
#include <iosfwd>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cassert>
#include <cmath>
#include "SquareMatrix.ipp"
Go to the source code of this file.
Namespaces | |
namespace | ads |
Classes | |
class | ads::SquareMatrix< N, T > |
An NxN matrix. More... | |
class | ads::SquareMatrix< 1, T > |
A 1x1 matrix. More... | |
class | ads::SquareMatrix< 2, T > |
A 2x2 matrix. More... | |
class | ads::SquareMatrix< 3, T > |
A 3x3 matrix. More... | |
Functions | |
template<typename T, int N> | |
SquareMatrix< N, T > | ads::operator+ (const SquareMatrix< N, T > &m, const T x) |
SquareMatrix-scalar addition. | |
template<typename T, int N> | |
SquareMatrix< N, T > | ads::operator+ (const T x, const SquareMatrix< N, T > &m) |
Scalar-SquareMatrix addition. | |
template<typename T, int N> | |
SquareMatrix< N, T > | ads::operator+ (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y) |
SquareMatrix-SquareMatrix addition. | |
template<typename T, int N> | |
SquareMatrix< N, T > | ads::operator- (const SquareMatrix< N, T > &m, const T x) |
SquareMatrix-scalar subtraction. | |
template<typename T, int N> | |
SquareMatrix< N, T > | ads::operator- (const T x, const SquareMatrix< N, T > &m) |
Scalar-SquareMatrix subtraction. | |
template<typename T, int N> | |
SquareMatrix< N, T > | ads::operator- (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y) |
SquareMatrix-SquareMatrix subtraction. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::operator * (const SquareMatrix< N, T > &m, const T x) |
SquareMatrix-scalar product. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::operator * (const T x, const SquareMatrix< N, T > &m) |
Scalar-SquareMatrix product. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::operator * (const SquareMatrix< N, T > &x, const SquareMatrix< N, T > &y) |
SquareMatrix-SquareMatrix product. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::operator/ (const SquareMatrix< N, T > &m, const T x) |
SquareMatrix-scalar division. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::operator/ (const T x, const SquareMatrix< N, T > &m) |
Scalar-SquareMatrix division. | |
template<int N, typename T> | |
T | ads::computeSum (const SquareMatrix< N, T > &x) |
Return the sum of the elements. | |
template<int N, typename T> | |
T | ads::computeProduct (const SquareMatrix< N, T > &x) |
Return the product of the elements. | |
template<int N, typename T> | |
T | ads::computeMinimum (const SquareMatrix< N, T > &x) |
Return the minimum element. Use < for comparison. | |
template<int N, typename T> | |
T | ads::computeMaximum (const SquareMatrix< N, T > &x) |
Return the maximum element. Use > for comparison. | |
template<int N, typename T> | |
T | ads::computeDeterminant (const SquareMatrix< N, T > &x) |
Return the determinant of the matrix. | |
template<int N, typename T> | |
T | ads::computeTrace (const SquareMatrix< N, T > &x) |
Return the trace of the matrix. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::computeTranspose (const SquareMatrix< N, T > &x) |
Return the transpose of the matrix. | |
template<int N, typename T> | |
SquareMatrix< N, T > | ads::computeInverse (const SquareMatrix< N, T > &x) |
Return the inverse of the matrix. | |
template<int N, typename T> | |
void | ads::computeInverse (const SquareMatrix< N, T > &x, SquareMatrix< N, T > *y) |
Compute the inverse of the matrix. | |
template<int N, typename T> | |
void | ads::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 > | ads::computeScaledInverse (const SquareMatrix< N, T > &x) |
Return the scaled inverse of the matrix: determinant * inverse. | |
template<int N, typename T> | |
T | ads::computeFrobeniusNormSquared (const SquareMatrix< N, T > &x) |
Return the frobenius norm of the matrix. | |
template<int N, typename T> | |
T | ads::computeFrobeniusNorm (const SquareMatrix< N, T > &x) |
Return the frobenius norm of the matrix. | |
template<int N, typename T> | |
T | ads::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 | ads::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 | ads::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 | ads::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 & | ads::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 & | ads::operator>> (std::istream &in, SquareMatrix< N, T > &x) |
Read white space-separated numbers into a matrix. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator+ (const SquareMatrix< 1, T > &m, const T x) |
SquareMatrix-scalar addition. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator+ (const T x, const SquareMatrix< 1, T > &m) |
Scalar-SquareMatrix addition. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator+ (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y) |
SquareMatrix-SquareMatrix addition. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator- (const SquareMatrix< 1, T > &m, const T x) |
SquareMatrix-scalar subtraction. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator- (const T x, const SquareMatrix< 1, T > &m) |
Scalar-SquareMatrix subtraction. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator- (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y) |
SquareMatrix-SquareMatrix subtraction. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator * (const SquareMatrix< 1, T > &m, const T x) |
SquareMatrix-scalar product. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator * (const T x, const SquareMatrix< 1, T > &m) |
Scalar-SquareMatrix product. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator * (const SquareMatrix< 1, T > &x, const SquareMatrix< 1, T > &y) |
SquareMatrix-SquareMatrix product. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator/ (const SquareMatrix< 1, T > &m, const T x) |
SquareMatrix-scalar division. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::operator/ (const T x, const SquareMatrix< 1, T > &m) |
Scalar-SquareMatrix division. | |
template<typename T> | |
T | ads::computeSum (const SquareMatrix< 1, T > &x) |
Return the sum of the elements. | |
template<typename T> | |
T | ads::computeProduct (const SquareMatrix< 1, T > &x) |
Return the product of the elements. | |
template<typename T> | |
T | ads::computeMinimum (const SquareMatrix< 1, T > &x) |
Return the minimum element. Use < for comparison. | |
template<typename T> | |
T | ads::computeMaximum (const SquareMatrix< 1, T > &x) |
Return the maximum element. Use > for comparison. | |
template<typename T> | |
T | ads::computeDeterminant (const SquareMatrix< 1, T > &x) |
Return the determinant of the matrix. | |
template<typename T> | |
T | ads::computeTrace (const SquareMatrix< 1, T > &x) |
Return the trace of the matrix. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::computeTranspose (const SquareMatrix< 1, T > &x) |
Return the transpose of the matrix. | |
template<typename T> | |
SquareMatrix< 1, T > | ads::computeInverse (const SquareMatrix< 1, T > &x) |
Return the inverse of the matrix. | |
template<typename T> | |
void | ads::computeInverse (const SquareMatrix< 1, T > &x, SquareMatrix< 1, T > *y) |
Compute the inverse of the matrix. | |
template<typename T> | |
void | ads::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 > | ads::computeScaledInverse (const SquareMatrix< 1, T > &x) |
Return the scaled inverse of the matrix: determinant * inverse. | |
template<typename T> | |
T | ads::computeFrobeniusNorm (const SquareMatrix< 1, T > &x) |
Return the frobenius norm of the matrix. | |
template<typename T> | |
T | ads::computeFrobeniusNormSquared (const SquareMatrix< 1, T > &x) |
Return the frobenius norm of the matrix. | |
template<typename T> | |
T | ads::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 | ads::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 | ads::operator== (const SquareMatrix< 1, T1 > &a, const SquareMatrix< 1, T2 > &b) |
Return true if the matrices are equal. | |
template<typename T1, typename T2> | |
bool | ads::operator!= (const SquareMatrix< 1, T1 > &a, const SquareMatrix< 1, T2 > &b) |
Return true if the tensors are not equal. | |
template<typename T> | |
std::ostream & | ads::operator<< (std::ostream &out, const SquareMatrix< 1, T > &x) |
Write a matrix as rows with space-separated numbers. | |
template<typename T> | |
std::istream & | ads::operator>> (std::istream &in, SquareMatrix< 1, T > &x) |
Read white space-separated numbers into a matrix. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator+ (const SquareMatrix< 2, T > &m, const T x) |
SquareMatrix-scalar addition. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator+ (const T x, const SquareMatrix< 2, T > &m) |
Scalar-SquareMatrix addition. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator+ (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y) |
SquareMatrix-SquareMatrix addition. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator- (const SquareMatrix< 2, T > &m, const T x) |
SquareMatrix-scalar subtraction. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator- (const T x, const SquareMatrix< 2, T > &m) |
Scalar-SquareMatrix subtraction. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator- (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y) |
SquareMatrix-SquareMatrix subtraction. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator * (const SquareMatrix< 2, T > &m, const T x) |
SquareMatrix-scalar product. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator * (const T x, const SquareMatrix< 2, T > &m) |
Scalar-SquareMatrix product. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator * (const SquareMatrix< 2, T > &x, const SquareMatrix< 2, T > &y) |
SquareMatrix-SquareMatrix product. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator/ (const SquareMatrix< 2, T > &m, const T x) |
SquareMatrix-scalar division. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::operator/ (const T x, const SquareMatrix< 2, T > &m) |
Scalar-SquareMatrix division. | |
template<typename T> | |
T | ads::computeSum (const SquareMatrix< 2, T > &x) |
Return the sum of the elements. | |
template<typename T> | |
T | ads::computeProduct (const SquareMatrix< 2, T > &x) |
Return the product of the elements. | |
template<typename T> | |
T | ads::computeMinimum (const SquareMatrix< 2, T > &x) |
Return the minimum element. Use < for comparison. | |
template<typename T> | |
T | ads::computeMaximum (const SquareMatrix< 2, T > &x) |
Return the maximum element. Use > for comparison. | |
template<typename T> | |
T | ads::computeDeterminant (const SquareMatrix< 2, T > &x) |
Return the determinant of the matrix. | |
template<typename T> | |
T | ads::computeTrace (const SquareMatrix< 2, T > &x) |
Return the trace of the matrix. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::computeTranspose (const SquareMatrix< 2, T > &x) |
Return the transpose of the matrix. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::computeInverse (const SquareMatrix< 2, T > &x) |
Return the inverse of the matrix. | |
template<typename T> | |
SquareMatrix< 2, T > | ads::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 | ads::computeInverse (const SquareMatrix< 2, T > &x, SquareMatrix< 2, T > *y) |
Compute the inverse of the matrix. | |
template<typename T> | |
void | ads::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 | ads::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 > | ads::computeScaledInverse (const SquareMatrix< 2, T > &x) |
Return the scaled inverse of the matrix: determinant * inverse. | |
template<typename T> | |
T | ads::computeFrobeniusNorm (const SquareMatrix< 2, T > &x) |
Return the frobenius norm of the matrix. | |
template<typename T> | |
T | ads::computeFrobeniusNormSquared (const SquareMatrix< 2, T > &x) |
Return the frobenius norm of the matrix. | |
template<typename T> | |
T | ads::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 | ads::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 | ads::operator== (const SquareMatrix< 2, T1 > &a, const SquareMatrix< 2, T2 > &b) |
Return true if the matrices are equal. | |
template<typename T1, typename T2> | |
bool | ads::operator!= (const SquareMatrix< 2, T1 > &a, const SquareMatrix< 2, T2 > &b) |
Return true if the tensors are not equal. | |
template<typename T> | |
std::ostream & | ads::operator<< (std::ostream &out, const SquareMatrix< 2, T > &x) |
Write a matrix as rows with space-separated numbers. | |
template<typename T> | |
std::istream & | ads::operator>> (std::istream &in, SquareMatrix< 2, T > &x) |
Read white space-separated numbers into a matrix. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator+ (const SquareMatrix< 3, T > &m, const T x) |
SquareMatrix-scalar addition. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator+ (const T x, const SquareMatrix< 3, T > &m) |
Scalar-SquareMatrix addition. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator+ (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y) |
SquareMatrix-SquareMatrix addition. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator- (const SquareMatrix< 3, T > &m, const T x) |
SquareMatrix-scalar subtraction. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator- (const T x, const SquareMatrix< 3, T > &m) |
Scalar-SquareMatrix subtraction. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator- (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y) |
SquareMatrix-SquareMatrix subtraction. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator * (const SquareMatrix< 3, T > &m, const T x) |
SquareMatrix-scalar product. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator * (const T x, const SquareMatrix< 3, T > &m) |
Scalar-SquareMatrix product. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator * (const SquareMatrix< 3, T > &x, const SquareMatrix< 3, T > &y) |
SquareMatrix-SquareMatrix product. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator/ (const SquareMatrix< 3, T > &m, const T x) |
SquareMatrix-scalar division. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::operator/ (const T x, const SquareMatrix< 3, T > &m) |
Scalar-SquareMatrix division. | |
template<typename T> | |
T | ads::computeSum (const SquareMatrix< 3, T > &x) |
Return the sum of the elements. | |
template<typename T> | |
T | ads::computeProduct (const SquareMatrix< 3, T > &x) |
Return the product of the elements. | |
template<typename T> | |
T | ads::computeMinimum (const SquareMatrix< 3, T > &x) |
Return the minimum element. Use < for comparison. | |
template<typename T> | |
T | ads::computeMaximum (const SquareMatrix< 3, T > &x) |
Return the maximum element. Use > for comparison. | |
template<typename T> | |
T | ads::computeDeterminant (const SquareMatrix< 3, T > &x) |
Return the determinant of the matrix. | |
template<typename T> | |
T | ads::computeTrace (const SquareMatrix< 3, T > &x) |
Return the trace of the matrix. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::computeTranspose (const SquareMatrix< 3, T > &x) |
Return the transpose of the matrix. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::computeInverse (const SquareMatrix< 3, T > &x) |
Return the inverse of the matrix. | |
template<typename T> | |
SquareMatrix< 3, T > | ads::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 | ads::computeInverse (const SquareMatrix< 3, T > &x, SquareMatrix< 3, T > *y) |
Compute the inverse of the matrix. | |
template<typename T> | |
void | ads::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 | ads::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 > | ads::computeScaledInverse (const SquareMatrix< 3, T > &x) |
Return the scaled inverse of the matrix: determinant * inverse. | |
template<typename T> | |
T | ads::computeFrobeniusNorm (const SquareMatrix< 3, T > &x) |
Return the frobenius norm of the matrix. | |
template<typename T> | |
T | ads::computeFrobeniusNormSquared (const SquareMatrix< 3, T > &x) |
Return the frobenius norm of the matrix. | |
template<typename T> | |
T | ads::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 | ads::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 | ads::operator== (const SquareMatrix< 3, T1 > &a, const SquareMatrix< 3, T2 > &b) |
Return true if the matrices are equal. | |
template<typename T1, typename T2> | |
bool | ads::operator!= (const SquareMatrix< 3, T1 > &a, const SquareMatrix< 3, T2 > &b) |
Return true if the tensors are not equal. | |
template<typename T> | |
std::ostream & | ads::operator<< (std::ostream &out, const SquareMatrix< 3, T > &x) |
Write a matrix as rows with space-separated numbers. | |
template<typename T> | |
std::istream & | ads::operator>> (std::istream &in, SquareMatrix< 3, T > &x) |
Read white space-separated numbers into a matrix. |