ArrayClasses
Class UTRMatrixArray

java.lang.Object
  extended byArrayClasses.UTRMatrixArray

public class UTRMatrixArray
extends java.lang.Object

An array A of n-1 lower triangular matrices (arrays). The matrix A[t] has dimension n-1-t, that is the matrix dimensions decrease as n-1,n-2,...,1.

A structure of this type is useful to store the path independent sequence of log-Libor covariation matrices which drive the time steps of the forward Libor process.


Constructor Summary
UTRMatrixArray(int n)
          Noncontiguous memory allocation using repeated new.
 
Method Summary
 double[][][] getMatrices()
          We expose the entire data array to avoid the overhead of accessors to individual entries.
 void initialize(DoubleFunction f)
          Set entries data[t][i][j]=f(t,i,j) where f is the function object passed as a parameter.
 void initialize(int t, ColtMatrix C)
          Set entries data[t][i][j]=C.getQuick(i,j) where C is a ColtMatrix.
static void main(java.lang.String[] args)
          Test program.
 java.lang.String toString()
          String representation for printing and inspection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UTRMatrixArray

public UTRMatrixArray(int n)
Noncontiguous memory allocation using repeated new.

Parameters:
n - number of forward Libors ncluding L_0.
Method Detail

getMatrices

public double[][][] getMatrices()
We expose the entire data array to avoid the overhead of accessors to individual entries. We need speed.


initialize

public void initialize(int t,
                       ColtMatrix C)
Set entries data[t][i][j]=C.getQuick(i,j) where C is a ColtMatrix. Uses only the upper half of C.

Parameters:
t - index of matrix in array to be initialized.
C - matrix yielding entry values to be copied.

initialize

public void initialize(DoubleFunction f)
Set entries data[t][i][j]=f(t,i,j) where f is the function object passed as a parameter.

Parameters:
f - function object used to initialize entries.

toString

public java.lang.String toString()
String representation for printing and inspection.


main

public static void main(java.lang.String[] args)
Test program. Allocates a matrix array, initializes the array with function object f(t,i,j)=i+j and calls toString to print the array. We want to see if the shape of the matrix array and initialization are in order.