All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.commons.math.linear.SingularValueDecomposition Maven / Gradle / Ivy

Go to download

The Math project is a library of lightweight, self-contained mathematics and statistics components addressing the most common practical problems not immediately available in the Java programming language or commons-lang.

There is a newer version: 2.2
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math.linear;



/**
 * An interface to classes that implement an algorithm to calculate the 
 * Singular Value Decomposition of a real matrix.
 * 

The Singular Value Decomposition of matrix A is a set of three matrices: * U, Σ and V such that A = U × Σ × VT. * Let A be an m × n matrix, then U is an m × m orthogonal matrix, * Σ is a m × n diagonal matrix with positive diagonal elements, * and V is an n × n orthogonal matrix.

*

This interface is similar to the class with similar name from the now defunct * JAMA library, with the * following changes:

*
    *
  • the norm2 method which has been renamed as {@link #getNorm() * getNorm},
  • *
  • the cond method which has been renamed as {@link * #getConditionNumber() getConditionNumber},
  • *
  • the rank method which has been renamed as {@link #getRank() * getRank},
  • *
  • a {@link #getUT() getUT} method has been added,
  • *
  • a {@link #getVT() getVT} method has been added,
  • *
  • a {@link #getSolver() getSolver} method has been added,
  • *
  • a {@link #getCovariance(double) getCovariance} method has been added.
  • *
* @see MathWorld * @see Wikipedia * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $ * @since 2.0 */ public interface SingularValueDecomposition { /** * Returns the matrix U of the decomposition. *

U is an orthogonal matrix, i.e. its transpose is also its inverse.

* @return the U matrix * @see #getUT() */ RealMatrix getU(); /** * Returns the transpose of the matrix U of the decomposition. *

U is an orthogonal matrix, i.e. its transpose is also its inverse.

* @return the U matrix (or null if decomposed matrix is singular) * @see #getU() */ RealMatrix getUT(); /** * Returns the diagonal matrix Σ of the decomposition. *

Σ is a diagonal matrix. The singular values are provided in * non-increasing order, for compatibility with Jama.

* @return the Σ matrix */ RealMatrix getS(); /** * Returns the diagonal elements of the matrix Σ of the decomposition. *

The singular values are provided in non-increasing order, for * compatibility with Jama.

* @return the diagonal elements of the Σ matrix */ double[] getSingularValues(); /** * Returns the matrix V of the decomposition. *

V is an orthogonal matrix, i.e. its transpose is also its inverse.

* @return the V matrix (or null if decomposed matrix is singular) * @see #getVT() */ RealMatrix getV(); /** * Returns the transpose of the matrix V of the decomposition. *

V is an orthogonal matrix, i.e. its transpose is also its inverse.

* @return the V matrix (or null if decomposed matrix is singular) * @see #getV() */ RealMatrix getVT(); /** * Returns the n × n covariance matrix. *

The covariance matrix is V × J × VT * where J is the diagonal matrix of the inverse of the squares of * the singular values.

* @param minSingularValue value below which singular values are ignored * (a 0 or negative value implies all singular value will be used) * @return covariance matrix * @exception IllegalArgumentException if minSingularValue is larger than * the largest singular value, meaning all singular values are ignored */ RealMatrix getCovariance(double minSingularValue) throws IllegalArgumentException; /** * Returns the L2 norm of the matrix. *

The L2 norm is max(|A × u|2 / * |u|2), where |.|2 denotes the vectorial 2-norm * (i.e. the traditional euclidian norm).

* @return norm */ double getNorm(); /** * Return the condition number of the matrix. * @return condition number of the matrix */ double getConditionNumber(); /** * Return the effective numerical matrix rank. *

The effective numerical rank is the number of non-negligible * singular values. The threshold used to identify non-negligible * terms is max(m,n) × ulp(s1) where ulp(s1) * is the least significant bit of the largest singular value.

* @return effective numerical matrix rank */ int getRank(); /** * Get a solver for finding the A × X = B solution in least square sense. * @return a solver */ DecompositionSolver getSolver(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy