KrisLibrary  1.0.0
LinearAlgebra.h
1 #ifndef MATH3D_LINEAR_ALGEBRA_H
2 #define MATH3D_LINEAR_ALGEBRA_H
3 
4 #include "primitives.h"
5 #include <math/complex.h>
6 #include <math/vector.h>
7 #include <math/matrix.h>
8 
9 namespace Math3D
10 {
11 
12 //copy nD primitives to a general vector/matrix
13 void Copy(Real v,Vector& vec);
14 void Copy(const Vector2& v,Vector& vec);
15 void Copy(const Vector3& v,Vector& vec);
16 void Copy(const Vector4& v,Vector& vec);
17 void Copy(const Vector& vec,Real& v);
18 void Copy(const Vector& vec,Vector2& v);
19 void Copy(const Vector& vec,Vector3& v);
20 void Copy(const Vector& vec,Vector4& v);
21 void Copy(Real m,Matrix& mat);
22 void Copy(const Matrix2& m,Matrix& mat);
23 void Copy(const Matrix3& m,Matrix& mat);
24 void Copy(const Matrix4& m,Matrix& mat);
25 void Copy(const Matrix& mat,Real& m);
26 void Copy(const Matrix& mat,Matrix2& m);
27 void Copy(const Matrix& mat,Matrix3& m);
28 void Copy(const Matrix& mat,Matrix4& m);
29 
30 //A = U diag(W) V^T (SVs are sorted from highest to lowest)
31 bool SVD(const Matrix2& A,Matrix2& U,Vector2& W,Matrix2& V);
32 bool SVD(const Matrix3& A,Matrix3& U,Vector3& W,Matrix3& V);
33 bool SVD(const Matrix4& A,Matrix4& U,Vector4& W,Matrix4& V);
34 
35 //returns eigenvalues of matrices
36 void Eigenvalues(const Matrix2& A,Complex& lambda1,Complex& lambda2);
37 bool Eigenvalues(const Matrix2& A,Real& lambda1,Real& lambda2);
38 void Eigenvalues(const Matrix3& A,Complex& lambda1,Complex& lambda2,Complex& lambda3);
39 bool Eigenvalues(const Matrix3& A,Real& lambda1,Real& lambda2,Real& lambda3);
40 
41 //A = Q diag(lambda) Q^T for symmetric matrices A
42 bool Eigendecomposition(const Matrix2& A,Vector2& lambda,Matrix2& Q);
43 bool Eigendecomposition(const Matrix3& A,Vector3& lambda,Matrix3& Q);
44 bool Eigendecomposition(const Matrix4& A,Vector4& lambda,Matrix4& Q);
45 
46 } //namespace Math3D
47 
48 
49 #endif
Class declarations for useful 3D math types.
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:13