001    /*
002     * Copyright (C) 2008-2010 by Holger Arndt
003     *
004     * This file is part of the Universal Java Matrix Package (UJMP).
005     * See the NOTICE file distributed with this work for additional
006     * information regarding copyright ownership and licensing.
007     *
008     * UJMP is free software; you can redistribute it and/or modify
009     * it under the terms of the GNU Lesser General Public License as
010     * published by the Free Software Foundation; either version 2
011     * of the License, or (at your option) any later version.
012     *
013     * UJMP is distributed in the hope that it will be useful,
014     * but WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016     * GNU Lesser General Public License for more details.
017     *
018     * You should have received a copy of the GNU Lesser General Public
019     * License along with UJMP; if not, write to the
020     * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
021     * Boston, MA  02110-1301  USA
022     */
023    
024    package org.ujmp.core.doublematrix.calculation.general.decomposition;
025    
026    import org.ujmp.core.Matrix;
027    import org.ujmp.core.exceptions.MatrixException;
028    
029    public interface DecompositionDoubleCalculations {
030    
031            /**
032             * Calculates the inverse of the Matrix using either LUDecomposition (for
033             * square matrices) or QRDecomposition (otherwise).
034             * 
035             * @return Inverse of the matrix
036             */
037            public Matrix inv() throws MatrixException;
038    
039            /**
040             * Calculates the inverse of the Matrix using either LUDecomposition (for
041             * square matrices) or QRDecomposition (otherwise).
042             * 
043             * @return Inverse of the matrix
044             */
045            public Matrix invSymm() throws MatrixException;
046    
047            /**
048             * Calculates the inverse of a symmetric positive definite Matrix using
049             * Cholesky Decomposition.
050             * 
051             * @return Inverse of the matrix
052             */
053            public Matrix invSPD() throws MatrixException;
054    
055            /**
056             * Solve A*X = B
057             * 
058             * @param b
059             *            right hand side
060             * @return solution for X if A is square, least squares solution otherwise
061             */
062            public Matrix solve(Matrix b) throws MatrixException;
063    
064            /**
065             * Solve A*X = B
066             * 
067             * @param b
068             *            right hand side
069             * @return solution for X if A is square, least squares solution otherwise
070             */
071            public Matrix solveSymm(Matrix b) throws MatrixException;
072    
073            /**
074             * Solve A*X = B
075             * 
076             * @param b
077             *            right hand side
078             * @return solution for X if A is square, least squares solution otherwise
079             */
080            public Matrix solveSPD(Matrix b) throws MatrixException;
081    
082            /**
083             * Calculates the pseudo inverse of the Matrix using Singular Value
084             * Decomposition.
085             * 
086             * @return Pseudo inverse of the Matrix
087             */
088            public Matrix pinv() throws MatrixException;
089    
090            /**
091             * Calculates a generalized inverse of the Matrix
092             * 
093             * @return Pseudo inverse of the Matrix
094             */
095            public Matrix ginv() throws MatrixException;
096    
097            /**
098             * Projects the matrix into the space of the principal components.
099             * 
100             * @return Matrix projected on principal components.
101             */
102            public Matrix princomp() throws MatrixException;
103    
104            /**
105             * Calculates the singular value decomposition of the matrix: A = U*S*V'
106             * 
107             * @return Singular value decomposition of the matrix.
108             */
109            public Matrix[] svd() throws MatrixException;
110    
111            /**
112             * Calculates the Eigen decomposition of the matrix.
113             * 
114             * @return Eigen decomposition of the matrix.
115             */
116            public Matrix[] eig() throws MatrixException;
117    
118            /**
119             * Calculates the Eigen decomposition of a symmetric matrix.
120             * 
121             * @return Eigen decomposition of the matrix.
122             */
123            public Matrix[] eigSymm() throws MatrixException;
124    
125            /**
126             * Calculates a QR decomposition of the matrix.
127             * 
128             * @return QR decomposition of the matrix.
129             */
130            public Matrix[] qr() throws MatrixException;
131    
132            /**
133             * Calculates a LU decomposition of the matrix.
134             * 
135             * @return LU decomposition of the matrix.
136             */
137            public Matrix[] lu() throws MatrixException;
138    
139            /**
140             * Calculates a Cholesky decomposition of the matrix.
141             * 
142             * @return Cholesky decomposition of the matrix.
143             */
144            public Matrix chol() throws MatrixException;
145    
146    }