spec.benchmarks.scimark.lu
Class LU

java.lang.Object
  extended by spec.benchmarks.scimark.lu.LU

public class LU
extends java.lang.Object

LU matrix factorization. (Based on TNT implementation.) Decomposes a matrix A into a triangular lower triangular factor (L) and an upper triangular factor (U) such that A = L*U. By convnetion, the main diagonal of L consists of 1's so that L and U can be stored compactly in a NxN matrix.


Constructor Summary
LU(int id)
           
 
Method Summary
 int factor(double[][] A, int[] pivot)
          LU factorization (in place).
 double[][] getLU()
           
 int[] getPivot()
          Returns a copy of the pivot vector.
protected static void insert_copy(double[][] B, double[][] A)
           
static void main(int id)
          Returns a copy of the compact LU factorization.
 double measureLU(int N, double min_time, Random R)
           
protected static double[] new_copy(double[] x)
           
protected static double[][] new_copy(double[][] A)
           
static int[] new_copy(int[] x)
           
static double num_flops(int N)
           
 void run()
           
 double[] solve(double[] b)
          Solve a linear system, with pre-computed factorization.
 void solve(double[][] LU, int[] pvt, double[] b)
          Solve a linear system, using a prefactored matrix in LU form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LU

public LU(int id)
Method Detail

main

public static void main(int id)
Returns a copy of the compact LU factorization. (useful mainly for debugging.) Retrieves the compact LU factorization. The U factor is stored in the upper triangular portion, and the L factor is stored in the lower triangular portion. The main diagonal of L consists (by convention) of ones, and is not explicitly stored.


num_flops

public static final double num_flops(int N)

new_copy

protected static double[] new_copy(double[] x)

new_copy

protected static double[][] new_copy(double[][] A)

new_copy

public static int[] new_copy(int[] x)

insert_copy

protected static final void insert_copy(double[][] B,
                                        double[][] A)

getLU

public double[][] getLU()

getPivot

public int[] getPivot()
Returns a copy of the pivot vector.

Returns:
the pivot vector used in obtaining the LU factorzation. Subsequent solutions must permute the right-hand side by this vector.

solve

public double[] solve(double[] b)
Solve a linear system, with pre-computed factorization.

Parameters:
b - (in) the right-hand side.
Returns:
solution vector.

factor

public int factor(double[][] A,
                  int[] pivot)
LU factorization (in place).

Parameters:
A - (in/out) On input, the matrix to be factored. On output, the compact LU factorization.
pivot - (out) The pivot vector records the reordering of the rows of A during factorization.
Returns:
0, if OK, nozero value, othewise.

solve

public void solve(double[][] LU,
                  int[] pvt,
                  double[] b)
Solve a linear system, using a prefactored matrix in LU form.

Parameters:
LU - (in) the factored matrix in LU form.
pvt - (in) the pivot vector which lists the reordering used during the factorization stage.
b - (in/out) On input, the right-hand side. On output, the solution vector.

measureLU

public double measureLU(int N,
                        double min_time,
                        Random R)

run

public void run()