ArrayClasses
Class UTRContiguousArray

java.lang.Object
  extended byArrayClasses.UTRContiguousArray

public class UTRContiguousArray
extends java.lang.Object

Upper triangular matrix of doubles stored as contiguous 1D array row by row. No linear algebra operations provided. Only accessors. No bounds checking! The idea is to optimize speed for loops of the form
for(int i=p;i In short the second index j neds to change less frequently than i in accessor methods (row major order in memory).


Constructor Summary
UTRContiguousArray(int p, int n)
          Memory allocation, all entries zero.
 
Method Summary
 double _(int i, int j)
          Get entry.
static void main(java.lang.String[] args)
          TEST PROGRAM
 void set(int i, int j, double x)
          Set entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UTRContiguousArray

public UTRContiguousArray(int p,
                          int n)
Memory allocation, all entries zero.

Method Detail

set

public void set(int i,
                int j,
                double x)
Set entry. No bounds checking at all. Indices must satisfy p<=j<=i
WARNING: no error need be detected if j>i.

Parameters:
i - row index.
j - column index

_

public double _(int i,
                int j)
Get entry. No bounds checking at all. Indices must satisfy p<=j<=i
WARNING: no error need be detected if j>i.

Parameters:
i - row index.
j - column index

main

public static void main(java.lang.String[] args)
TEST PROGRAM