001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.math.linear;
019    
020    
021    /**
022     * An interface to classes that implement an algorithm to calculate the 
023     * QR-decomposition of a real matrix.
024     * <p>This interface is based on the class with similar name from the now defunct
025     * <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> library, with the
026     * following changes:</p>
027     * <ul>
028     *   <li>a {@link #getQT() getQT} method has been added,</li>
029     *   <li>the <code>solve</code> and <code>isFullRank</code> methods have been replaced
030     *   by a {@link #getSolver() getSolver} method and the equivalent methods provided by
031     *   the returned {@link DecompositionSolver}.</li>
032     * </ul>
033     *   
034     * @see <a href="http://mathworld.wolfram.com/QRDecomposition.html">MathWorld</a>
035     * @see <a href="http://en.wikipedia.org/wiki/QR_decomposition">Wikipedia</a>
036     * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $
037     * @since 1.2
038     */
039    public interface QRDecomposition {
040    
041        /**
042         * Returns the matrix R of the decomposition. 
043         * <p>R is an upper-triangular matrix</p>
044         * @return the R matrix
045         */
046        RealMatrix getR();
047    
048        /**
049         * Returns the matrix Q of the decomposition.
050         * <p>Q is an orthogonal matrix</p>
051         * @return the Q matrix
052         */
053        RealMatrix getQ();
054    
055        /**
056         * Returns the transpose of the matrix Q of the decomposition.
057         * <p>Q is an orthogonal matrix</p>
058         * @return the Q matrix
059         */
060        RealMatrix getQT();
061    
062        /**
063         * Returns the Householder reflector vectors.
064         * <p>H is a lower trapezoidal matrix whose columns represent
065         * each successive Householder reflector vector. This matrix is used
066         * to compute Q.</p>
067         * @return a matrix containing the Householder reflector vectors
068         */
069        RealMatrix getH();
070    
071        /**
072         * Get a solver for finding the A &times; X = B solution in least square sense.
073         * @return a solver
074         */
075        DecompositionSolver getSolver();
076    
077    }