Package dk.alexandra.fresco.stat
Interface AdvancedLinearAlgebra
- All Known Implementing Classes:
DefaultLinearAlgebra
public interface AdvancedLinearAlgebra
This computation directory contains variuous linear algebra functions. See also
FixedLinearAlgebra
.-
Method Summary
Modifier and Type Method Description DRes<ArrayList<DRes<SFixed>>>
backSubstitution(Matrix<DRes<SFixed>> a, ArrayList<DRes<SFixed>> b)
Use back substitution to compute a vector x such that ax = b where a is an upper triangular square matrix.DRes<ArrayList<DRes<SFixed>>>
forwardSubstitution(Matrix<DRes<SFixed>> a, ArrayList<DRes<SFixed>> b)
Use forward substitution to compute a vector x such that ax = b where a is a lower triangular square matrix.DRes<List<ArrayList<DRes<SFixed>>>>
gramSchmidt(List<ArrayList<DRes<SFixed>>> vectors)
Return a list of mutually orthogonal vectors spanning the same space as the given vectors.DRes<Matrix<DRes<SFixed>>>
invertLowerTriangularMatrix(Matrix<DRes<SFixed>> l)
Compute the inverse of a lower triangular matrix.DRes<List<DRes<SFixed>>>
iterativeEigenvalues(Matrix<DRes<SFixed>> a, int iterations)
Approximate the eigenvalues of a matrix using the QR-algorithm.DRes<ArrayList<DRes<SFixed>>>
linearInverseProblem(Matrix<DRes<SFixed>> a, ArrayList<DRes<SFixed>> b)
Solve a linear inverse problem, eg.DRes<Matrix<DRes<SFixed>>>
moorePenrosePseudoInverse(Matrix<DRes<SFixed>> a)
Compute the Moore-Penrose pseudo-inverse of an m×n-matrix with full column rank.DRes<ArrayList<DRes<SFixed>>>
normalizeVector(ArrayList<DRes<SFixed>> u)
Normalize a non-zero vector.DRes<ArrayList<DRes<SFixed>>>
projection(ArrayList<DRes<SFixed>> a, ArrayList<DRes<SFixed>> u)
Compute the projection of a vector a onto another vector u.DRes<Pair<Matrix<DRes<SFixed>>,Matrix<DRes<SFixed>>>>
qrDecomposition(Matrix<DRes<SFixed>> a)
Compute the QR-decomposition of an mxn-matrix a with m ≥ n and full column rank.static AdvancedLinearAlgebra
using(ProtocolBuilderNumeric builder)
-
Method Details
-
using
-
backSubstitution
Use back substitution to compute a vector x such that ax = b where a is an upper triangular square matrix.- Parameters:
a
- An upper triangular matrix.b
- A vector.- Returns:
- A vector x such that ax = b.
-
forwardSubstitution
DRes<ArrayList<DRes<SFixed>>> forwardSubstitution(Matrix<DRes<SFixed>> a, ArrayList<DRes<SFixed>> b)Use forward substitution to compute a vector x such that ax = b where a is a lower triangular square matrix.- Parameters:
a
- An lower triangular matrix.b
- A vector.- Returns:
- A vector x such that ax = b.
-
gramSchmidt
Return a list of mutually orthogonal vectors spanning the same space as the given vectors.- Parameters:
vectors
- A set of linearly independent vectors.- Returns:
- A set of mutually orthogonal vectors spanning the same space as the input.
-
invertLowerTriangularMatrix
DRes<Matrix<DRes<SFixed>>> invertLowerTriangularMatrix(Matrix<DRes<SFixed>> l)Compute the inverse of a lower triangular matrix.- Parameters:
l
- A lower triangular matrix.- Returns:
- The inverse of l
-
linearInverseProblem
DRes<ArrayList<DRes<SFixed>>> linearInverseProblem(Matrix<DRes<SFixed>> a, ArrayList<DRes<SFixed>> b)Solve a linear inverse problem, eg. find an x such that ax = b where a is an m×n-matrix and b is an n-dimensional vector. If a system is overdetermined (m ≥ n), the computation will find the x minimising ||ax - b||.- Parameters:
a
- An m×n-matrix.b
- An n-dimensional vector.- Returns:
- A solution to the equation ax = b or a matrix minimising ax - b.
-
moorePenrosePseudoInverse
DRes<Matrix<DRes<SFixed>>> moorePenrosePseudoInverse(Matrix<DRes<SFixed>> a)Compute the Moore-Penrose pseudo-inverse of an m×n-matrix with full column rank.- Parameters:
a
- An m×n-matrix with full column rank.- Returns:
- The Moore-Penrose pseudo-inverse of a.
-
normalizeVector
Normalize a non-zero vector.- Parameters:
u
- A non-zero vector.- Returns:
- A vector with the same direction as u and magnitude 1.
-
projection
Compute the projection of a vector a onto another vector u.- Parameters:
a
- A vector.u
- A vector.- Returns:
- a projected onto u.
-
iterativeEigenvalues
Approximate the eigenvalues of a matrix using the QR-algorithm.- Parameters:
a
- A square matrix.iterations
- The number of iterations.- Returns:
- An approximation of the eigenvalues of a.
-
qrDecomposition
DRes<Pair<Matrix<DRes<SFixed>>,Matrix<DRes<SFixed>>>> qrDecomposition(Matrix<DRes<SFixed>> a)Compute the QR-decomposition of an mxn-matrix a with m ≥ n and full column rank. The QR-decomposition is a pair of matrices (Q,R) with A = QR and where Q is an mxn-matrix with orthonormal columns and R is an upper-triangular nxn-matrix.- Parameters:
a
- An mxn-matrix- Returns:
- A pair of matrices (Q,R) with a = QR and where * Q is an mxn-matrix with orthonormal columns and R is an upper-triangular * nxn-matrix.
-