1 /**
2  * The linear algebra package provides classes and computational methods for
3  * operations on matrices and vectors.
4  * <p>
5  * Some content of this package is adapted from the Jama package.
6  * <p>
7  * Five fundamental matrix decompositions, which consist of pairs or triples
8  * of matrices, permutation vectors, and the like, produce results in five
9  * decomposition classes. These decompositions are accessed by the Matrix
10  * class to compute solutions of simultaneous linear equations, determinants,
11  * inverses and other matrix functions. The five decompositions are:
12  * <ul>
13  * <li>Cholesky Decomposition of symmetric, positive definite matrices.</li>
14  * <li>LU Decomposition of rectangular matrices.</li>
15  * <li>QR Decomposition of rectangular matrices.</li>
16  * <li>Singular Value Decomposition of rectangular matrices.</li>
17  * <li>Eigenvalue Decomposition of both symmetric and nonsymmetric square
18  * matrices.</li>
19  * </ul>
20  * <b>Example of use:</b>
21  * <p>
22  * Solve a linear system \(Ax=b\) and compute the residual norm, \(||b-Ax||\).
23  * <p>
24  * {@code double[][] matrix = { {1.,2.,3}, {4.,5.,6.}, {7.,8.,10.} };}<br>
25  * {@code double[] b = MathUtil.randomDoubleArray(3, new Random());}<br>
26  * {@code double[] x = VMath.solve(matrix, b);}<br>
27  * {@code double[] r = VMath.minusEquals(VMath.times(matrix, x), b);}<br>
28  * {@code double norm = VMath.euclideanLength(r);}
29  * <p>
30  * The original Jama-package has been developed by
31  * the <a href="http://www.mathworks.com/">MathWorks</a> and
32  * <a href="http://www.nist.gov/">NIST</a>
33  * and can be found at
34  * <a href="http://math.nist.gov/javanumerics/jama/">math.nist.gov</a>.
35  * <p>
36  * Here, for the adaption some classes and methods convenient for data mining
37  * applications within ELKI were added.
38  * Furthermore some erroneous comments were corrected and the coding-style was
39  * subtly changed to a more Java-typical style.
40  *
41  * @opt hide ^java\.(io|lang)\..*
42  */
43 /*
44  * This file is part of ELKI:
45  * Environment for Developing KDD-Applications Supported by Index-Structures
46  *
47  * Copyright (C) 2018
48  * ELKI Development Team
49  *
50  * This program is free software: you can redistribute it and/or modify
51  * it under the terms of the GNU Affero General Public License as published by
52  * the Free Software Foundation, either version 3 of the License, or
53  * (at your option) any later version.
54  *
55  * This program is distributed in the hope that it will be useful,
56  * but WITHOUT ANY WARRANTY; without even the implied warranty of
57  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58  * GNU Affero General Public License for more details.
59  *
60  * You should have received a copy of the GNU Affero General Public License
61  * along with this program. If not, see <http://www.gnu.org/licenses/>.
62  */
63 package de.lmu.ifi.dbs.elki.math.linearalgebra;
64