org.javaseis.array
Class Transpose

java.lang.Object
  extended by org.javaseis.array.Transpose

public class Transpose
extends java.lang.Object

Java implementation of in-memory array transposes. Designed for use with JavaSeis Parallel Distributed Objects, using 1D Java arrays as the base storage.

The methods in this class are static methods that can be called for any 1D Java array that has been "shaped" as a 2D Fortran style array. Arbitrary object arrays and primitive types are supported. The "basic" operations are provided, which are transpose the last two dimensions of 2D and 3D arrays respectively. More complex transposes are built from the basic types.

For example, a "321" transpose is constructed from:

 123 -> 213 using T21 transpose
 213 -> 231 using T132 transpose
 231 -> 321 using T21 transpose
 
See the MultiArray class for more examples.

Author:
Chuck Mosher for JavaSeis.org

Constructor Summary
Transpose()
           
 
Method Summary
static void byte132(byte[] a, int ia, int n1, int n2, int n3)
          Transpose the last two dimensinos of a 3D Fortran style array stored in a 1D Java array.
static void byte21(byte[] a, int ia, int n1, int n2)
          Transpose a 2D Fortran style array stored in a 1D Java array.
static void double132(double[] a, int ia, int n1, int n2, int n3)
           
static void double21(double[] a, int ia, int n1, int n2)
           
static void float132(float[] a, int ia, int n1, int n2, int n3)
           
static void float21(float[] a, int ia, int n1, int n2)
           
static void int132(int[] a, int ia, int n1, int n2, int n3)
           
static void int21(int[] a, int ia, int n1, int n2)
           
static void long132(long[] a, int ia, int n1, int n2, int n3)
           
static void long21(long[] a, int ia, int n1, int n2)
           
static void main(java.lang.String[] args)
          Simple test harness
static void object132(java.lang.Object[] a, int ia, int n1, int n2, int n3)
           
static void object21(java.lang.Object[] a, int ia, int n1, int n2)
           
static void short132(short[] a, int ia, int n1, int n2, int n3)
           
static void short21(short[] a, int ia, int n1, int n2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transpose

public Transpose()
Method Detail

byte132

public static void byte132(byte[] a,
                           int ia,
                           int n1,
                           int n2,
                           int n3)
Transpose the last two dimensinos of a 3D Fortran style array stored in a 1D Java array. Routines are provided for primitive types and Object arrays. A byte array of length (n2+n3)/2 is allocated internally for work space, along with two vectors of length n1. Runtime exceptions are thrown on memory or algorithm failures.

Parameters:
a - 1D vector "shaped" as a 2D Fortran array
n1 - first Fortran dimension
n2 - second Fortran dimension

byte21

public static void byte21(byte[] a,
                          int ia,
                          int n1,
                          int n2)
Transpose a 2D Fortran style array stored in a 1D Java array. Routines are provided for primitive types and Object arrays. A byte array of length (n1+n2)/2 is allocated internally for work space. Runtime exceptions are thrown on memory or algorithm failures.

Parameters:
a - 1D vector "shaped" as a 2D Fortran array
ia - offset in the 1D array to the start of the 2D array
n1 - first Fortran dimension
n2 - second Fortran dimension

double132

public static void double132(double[] a,
                             int ia,
                             int n1,
                             int n2,
                             int n3)

double21

public static void double21(double[] a,
                            int ia,
                            int n1,
                            int n2)

float132

public static void float132(float[] a,
                            int ia,
                            int n1,
                            int n2,
                            int n3)

float21

public static void float21(float[] a,
                           int ia,
                           int n1,
                           int n2)

int132

public static void int132(int[] a,
                          int ia,
                          int n1,
                          int n2,
                          int n3)

int21

public static void int21(int[] a,
                         int ia,
                         int n1,
                         int n2)

long132

public static void long132(long[] a,
                           int ia,
                           int n1,
                           int n2,
                           int n3)

long21

public static void long21(long[] a,
                          int ia,
                          int n1,
                          int n2)

main

public static void main(java.lang.String[] args)
Simple test harness

Parameters:
args -

object132

public static void object132(java.lang.Object[] a,
                             int ia,
                             int n1,
                             int n2,
                             int n3)

object21

public static void object21(java.lang.Object[] a,
                            int ia,
                            int n1,
                            int n2)

short132

public static void short132(short[] a,
                            int ia,
                            int n1,
                            int n2,
                            int n3)

short21

public static void short21(short[] a,
                           int ia,
                           int n1,
                           int n2)