Java API By Example, From Geeks To Geeks.

# Java > Open Source Codes > org > jscience > mathematics > vectors > LUDecomposition

 `1 /*2  * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences.3  * Copyright (C) 2006 - JScience (http://jscience.org/)4  * All rights reserved.5  * 6  * Permission to use, copy, modify, and distribute this software is7  * freely granted, provided that this notice is preserved.8  */9 package org.jscience.mathematics.vectors;10 11 import java.util.Comparator ;12 13 import org.jscience.mathematics.structures.Field;14 import org.jscience.mathematics.numbers.Number;15 16 import javolution.context.LocalContext;17 import javolution.context.RealtimeObject;18 import javolution.util.FastTable;19 import javolution.util.Index;20 21 /**22  *

This class represents the decomposition of a {@link Matrix matrix} 23  * A into a product of a {@link #getLower lower} 24  * and {@link #getUpper upper} triangular matrices, L25  * and U respectively, such as A = P·L·U with 26  * P a {@link #getPermutation permutation} matrix.

27  * 28  *

This decomposition is typically used to resolve linear systems29  * of equations (Gaussian elimination) or to calculate the determinant30  * of a square {@link Matrix} (O(m³)).

31  * 32  *

Numerical stability is guaranteed through pivoting if the33  * {@link Field} elements are {@link Number numbers}34  * For others elements types, numerical stability can be ensured by setting35  * the {@link javolution.context.LocalContext context-local} pivot 36  * comparator (see {@link #setPivotComparator}).

37  * 38  *

Pivoting can be disabled by setting the {@link #setPivotComparator 39  * pivot comparator} to null ({@link #getPermutation P} 40  * is then the matrix identity).