rvl.util
Class LinAlg

java.lang.Object
  |
  +--rvl.util.LinAlg

public class LinAlg
extends java.lang.Object

Linear algebra functions


Constructor Summary
LinAlg()
           
 
Method Summary
static double[] constant(double val, int n)
          create a constant vector of given value val, of length n
static double[] copy(double[] x)
           
static double[][] LU(double[][] A, int[] row)
           
static boolean LUInPlace(double[][] A, int[] row)
          in-place LU decomposition of A uses scaled-column pivoting
static double[] LUSolve(double[][] LU, int[] row, double[] b)
           
static double[] LUSolveInPlace(double[][] LU, int[] row, double[] b)
          Solve the system LUx = b (in-place; alters b)
static void print(double[] x)
          print a vector
static void println(double[] x)
          print a vector, then a newline
static void println(double[][] x)
          print a matrix and a newline
static double[][] transpose(double[][] A)
          transpose a matrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinAlg

public LinAlg()
Method Detail

LUInPlace

public static boolean LUInPlace(double[][] A,
                                int[] row)
in-place LU decomposition of A uses scaled-column pivoting
Parameters:
A - square matrix (n x n)
row - integer array of length n to store row permutations
Returns:
true if A is nonsingular, false if singular

LUSolveInPlace

public static double[] LUSolveInPlace(double[][] LU,
                                      int[] row,
                                      double[] b)
Solve the system LUx = b (in-place; alters b)
Parameters:
LU - LU decomposition (result of LU or LUInPlace)
row - permutation array
b - rhs of system (altered by process)
Returns:
the solution

LU

public static double[][] LU(double[][] A,
                            int[] row)
Returns:
LU decomposition of square matrix A (Does not alter contents of A)
See Also:
LUInPlace

LUSolve

public static double[] LUSolve(double[][] LU,
                               int[] row,
                               double[] b)
Returns:
solution x to LUx = b

copy

public static double[] copy(double[] x)
Returns:
a newly allocated copy of x

transpose

public static double[][] transpose(double[][] A)
transpose a matrix

constant

public static double[] constant(double val,
                                int n)
create a constant vector of given value val, of length n

print

public static void print(double[] x)
print a vector

println

public static void println(double[] x)
print a vector, then a newline

println

public static void println(double[][] x)
print a matrix and a newline