edu.mines.jtk.lapack.DMatrixChd Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edu-mines-jtk Show documentation
Show all versions of edu-mines-jtk Show documentation
Java packages for science and engineering
The newest version!
/****************************************************************************
Copyright 2005, Colorado School of Mines and others.
Licensed 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 edu.mines.jtk.lapack;
import org.netlib.lapack.LAPACK;
import static edu.mines.jtk.util.ArrayMath.*;
import edu.mines.jtk.util.Check;
/**
* Cholesky decomposition of a symmetric positive-definite matrix A.
* For a symmetric positive-definite matrix a, the Cholesky decomposition
* is A = L*L', where L is a lower triangular matrix.
* @author Dave Hale, Colorado School of Mines
* @version 2005.12.12
*/
public class DMatrixChd {
/**
* Constructs a Cholesky decomposition of the specified matrix A.
* The matrix A must be symmetric. For efficiency, this condition
* is assumed and not checked. That is, only the lower triangular
* part of A is used to perform the decomposition.
* @param a the matrix.
*/
public DMatrixChd(DMatrix a) {
Check.argument(a.isSquare(),"A is square");
_n = a.getN();
_l = a.getPackedColumns();
// Zero elements above lower triangle.
for (int j=0; j<_n; ++j) {
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy