All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class array.doubleArray2D

java.lang.Object
   |
   +----array.doubleArray
           |
           +----array.doubleArray2D

public final class doubleArray2D
extends doubleArray
doubleArray2D = 2-dimensional array of doubles

The doubleArray2D concrete class implementes 2-dimensional arrays of doubles. 2-dimensional arrays can either be instantiated directly through constructors, or they can be generated by extracting two-dimensional sections from other 2- or higher-dimensional arrays.


Variable Index

 o data
 o n0
 o n1
 o w0
 o w1
 o w2

Constructor Index

 o doubleArray2D(double[], Range, Range)
Create a 2-dimensional array as a section of another array.
 o doubleArray2D(double[][])
Create a 2-dimensional array, with shape and values defined by a Java double[][] array.
 o doubleArray2D(int, int)
Create a 2-dimensional array of a certain shape.

Method Index

 o assign(double)
Assign a scalar value to all elements of the array.
 o assign(doubleArray2D)
Assign the values from another two-dimensional array to this array.
 o divide(doubleArray2D)
Divide elements of this array by the corresponding elements of another array b.
 o get(Index, Index)
Return another doubleArray2D with the values of the specified elements.
 o get(Index, Index, doubleArray2D)
Extract selected elements of this doubleArray2D into another doubleArray2D.
 o get(Index, int)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(Index, int, doubleArray1D)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(Index, Range)
Return another doubleArray2D with the values of the specified elements.
 o get(Index, Range, doubleArray2D)
Extract selected elements of this doubleArray2D into another doubleArray2D.
 o get(int, Index)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(int, Index, doubleArray1D)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(int, int)
Return the value of an element of the array.
 o get(int, Range)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(int, Range, doubleArray1D)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(int[])
Return the value of an element of the array.
 o get(Range, Index)
Return another doubleArray2D with the values of the specified elements.
 o get(Range, Index, doubleArray2D)
Extract selected elements of this doubleArray2D into another doubleArray2D.
 o get(Range, int)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(Range, int, doubleArray1D)
Extract selected elements of this doubleArray2D into a doubleArray1D.
 o get(Range, Range)
Return another doubleArray2D with the values of the specified elements.
 o get(Range, Range, doubleArray2D)
Extract selected elements of this doubleArray2D into another doubleArray2D.
 o getf(int, int)
Return the value of an element of the array, no check.
 o permuteAxes(int, int)
Permute the axes of this array, thus creating a reference to its transpose.
 o range(int)
Return the range of array indices along its i-th axis.
 o rank()
Return the rank of the 2-dimensional array, i.e.
 o reshape(int)
Reshape this two-dimensional array into a one-dimensional array.
 o reshape(int, int)
Reshape this two-dimensional array into another two-dimensional array.
 o reshape(int, int, int)
Reshape this two-dimensional array into a three-dimensional array.
 o section(int, int)
Extract a 0-dimensional section from the array.
 o section(int, Range)
Extract a 1-dimensional section from the array.
 o section(Range, int)
Extract a 1-dimensional section from the array.
 o section(Range, Range)
Extract a 2-dimensional section from the array.
 o set(Index, Index, double)
Set the value of a list of elements of the array.
 o set(Index, Index, doubleArray2D)
Set the value of a list of elements of the array.
 o set(Index, int, double)
Set the value of a list of elements of the array.
 o set(Index, int, doubleArray1D)
Set the value of a list of elements of the array.
 o set(Index, Range, double)
Set the value of a list of elements of the array.
 o set(Index, Range, doubleArray2D)
Set the value of a list of elements of the array.
 o set(int, Index, double)
Set the value of a list of elements of the array.
 o set(int, Index, doubleArray1D)
Set the value of a list of elements of the array.
 o set(int, int, double)
Set the value of an element of the array.
 o set(int, Range, double)
Set the value of a list of elements of the array.
 o set(int, Range, doubleArray1D)
Set the value of a list of elements of the array.
 o set(int[], double)
Set the value of an element of the array.
 o set(Range, Index, double)
Set the value of a list of elements of the array.
 o set(Range, Index, doubleArray2D)
Set the value of a list of elements of the array.
 o set(Range, int, double)
Set the value of a list of elements of the array.
 o set(Range, int, doubleArray1D)
Set the value of a list of elements of the array.
 o set(Range, Range, double)
Set the value of a list of elements of the array.
 o set(Range, Range, doubleArray2D)
Set the value of a list of elements of the array.
 o setf(int, int, double)
Set the value of an element of the array, no check.
 o shape()
Return the shape of the array as an int[] I of length 2.
 o size()
Return the number of elements in the array.
 o size(int)
Return the extent of the array along its i-th axis.
 o toJava()
Transforms this doubleArray2D to a double[].

Variables

 o data
 protected double data[]
 o n0
 protected int n0
 o n1
 protected int n1
 o w0
 protected int w0
 o w1
 protected int w1
 o w2
 protected int w2

Constructors

 o doubleArray2D
 public doubleArray2D(int n,
                      int m) throws InvalidArrayShapeException
Create a 2-dimensional array of a certain shape. Elements are 0-valued

Parameters:
n - extent of the array along 0th axis
m - extent of the array along 1st axis
Throws: InvalidArrayShapeException
all extents must be nonnegative
 o doubleArray2D
 public doubleArray2D(double a[][]) throws InvalidArrayShapeException
Create a 2-dimensional array, with shape and values defined by a Java double[][] array.

Parameters:
a - Java double[][] array defining shape and values of the array
Throws: InvalidArrayShapeException
The Java array must be rectangular
 o doubleArray2D
 protected doubleArray2D(double a[],
                         Range I,
                         Range J) throws ArrayIndexOutOfBoundsException
Create a 2-dimensional array as a section of another array. Internal use within the package only. A 2-dimensional array can be empty (have 0 elements).

Methods

 o rank
 public int rank()
Return the rank of the 2-dimensional array, i.e. 2.

Overrides:
rank in class doubleArray
 o size
 public int size()
Return the number of elements in the array.

Overrides:
size in class doubleArray
 o size
 public int size(int i) throws InvalidArrayAxisException
Return the extent of the array along its i-th axis.

Parameters:
i - array axis (0 <= i < rank())
Throws: InvalidArrayAxisException
i must be between 0 and 1
Overrides:
size in class doubleArray
 o shape
 public int[] shape()
Return the shape of the array as an int[] I of length 2. I[0] = size(0) I[1] = size(1)

Overrides:
shape in class doubleArray
 o range
 public Range range(int i) throws InvalidArrayAxisException
Return the range of array indices along its i-th axis.

Parameters:
i - array axis (0 <= i < rank())
Throws: InvalidArrayAxisException
i must be between 0 and 1
 o permuteAxes
 public doubleArray2D permuteAxes(int a0,
                                  int a1) throws InvalidArrayAxisException
Permute the axes of this array, thus creating a reference to its transpose.

Parameters:
a0 - axis to appear as 0th axis (0 or 1)
a1 - axis to appear as 1st axis (0 or 1)
Throws: InvalidArrayAxisException
0 <= a0,a1 <= 1
 o reshape
 public doubleArray1D reshape(int m) throws NonconformingArrayException
Reshape this two-dimensional array into a one-dimensional array.

Parameters:
m - extent of resulting array along 0th axis
Throws: NonconformingArrayException
m must be equal to size of this
 o reshape
 public doubleArray2D reshape(int m0,
                              int m1) throws NonconformingArrayException
Reshape this two-dimensional array into another two-dimensional array.

Parameters:
m0 - extent of resulting array along 0th axis
m1 - extent of resulting array along 1st axis
Throws: NonconformingArrayException
m0*m1*m2 must be equal to size of this
 o reshape
 public doubleArray3D reshape(int m0,
                              int m1,
                              int m2) throws NonconformingArrayException
Reshape this two-dimensional array into a three-dimensional array.

Parameters:
m0 - extent of resulting array along 0th axis
m1 - extent of resulting array along 1st axis
m2 - extent of resulting array along 2nd axis
Throws: NonconformingArrayException
m0*m1*m2 must be equal to size of this
 o get
 public double get(int index[]) throws InvalidArrayIndexException, ArrayIndexOutOfBoundsException
Return the value of an element of the array.

Parameters:
index - index[i] = index along i-th axis, 0 <= index[i] < size(i)
Throws: InvalidArrayIndexException
index[] must be of length 2
Overrides:
get in class doubleArray
 o set
 public void set(int index[],
                 double d) throws InvalidArrayIndexException, ArrayIndexOutOfBoundsException
Set the value of an element of the array.

Parameters:
index - index[i] = index along i-th axis, 0 <= index[i] < size(i)
d - value to which element is set
Throws: InvalidArrayIndexException
index[] must be of length 2
Overrides:
set in class doubleArray
 o get
 public double get(int i,
                   int j) throws ArrayIndexOutOfBoundsException
Return the value of an element of the array.

Parameters:
i - index along the 0th axis of the array.
j - index along the 1st axis of the array.
 o getf
 protected double getf(int i,
                       int j) throws ArrayIndexOutOfBoundsException
Return the value of an element of the array, no check.

Parameters:
i - index along the 0th axis of the array.
j - index along the 1st axis of the array.
 o get
 public doubleArray1D get(int idx0,
                          Index idx1) throws ArrayIndexOutOfBoundsException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
 o get
 public doubleArray1D get(int idx0,
                          Index idx1,
                          doubleArray1D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
result - resulting array
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray1D get(int idx0,
                          Range idx1) throws ArrayIndexOutOfBoundsException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
 o get
 public doubleArray1D get(int idx0,
                          Range idx1,
                          doubleArray1D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
result - resulting array
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray1D get(Range idx0,
                          int idx1) throws ArrayIndexOutOfBoundsException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
 o get
 public doubleArray1D get(Range idx0,
                          int idx1,
                          doubleArray1D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
result - resulting array
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray1D get(Index idx0,
                          int idx1) throws ArrayIndexOutOfBoundsException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
 o get
 public doubleArray1D get(Index idx0,
                          int idx1,
                          doubleArray1D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into a doubleArray1D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - index along the 1st axis of the array
result - resulting array
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray2D get(Index idx0,
                          Index idx1) throws ArrayIndexOutOfBoundsException
Return another doubleArray2D with the values of the specified elements.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
 o get
 public doubleArray2D get(Index idx0,
                          Index idx1,
                          doubleArray2D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into another doubleArray2D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
result - array where elements are stored
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray2D get(Range idx0,
                          Index idx1) throws ArrayIndexOutOfBoundsException
Return another doubleArray2D with the values of the specified elements.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
 o get
 public doubleArray2D get(Range idx0,
                          Index idx1,
                          doubleArray2D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into another doubleArray2D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
result - array where elements are stored
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray2D get(Range idx0,
                          Range idx1) throws ArrayIndexOutOfBoundsException
Return another doubleArray2D with the values of the specified elements.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
 o get
 public doubleArray2D get(Range idx0,
                          Range idx1,
                          doubleArray2D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into another doubleArray2D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
result - array where elements are stored
Throws: NonconformingArrayException
shapes must match
 o get
 public doubleArray2D get(Index idx0,
                          Range idx1) throws ArrayIndexOutOfBoundsException
Return another doubleArray2D with the values of the specified elements.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
 o get
 public doubleArray2D get(Index idx0,
                          Range idx1,
                          doubleArray2D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Extract selected elements of this doubleArray2D into another doubleArray2D.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
result - array where elements are stored
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(int i,
                 int j,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of an element of the array.

Parameters:
i - index along the 0th axis of the array
j - index along the 1st axis of the array
d - value to which element is set
 o setf
 protected void setf(int i,
                     int j,
                     double val) throws ArrayIndexOutOfBoundsException
Set the value of an element of the array, no check.

Parameters:
i - index along the 0th axis of the array
j - index along the 1st axis of the array
d - value to which element is set
 o set
 public void set(int idx0,
                 Index idx1,
                 doubleArray1D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(int idx0,
                 Index idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o set
 public void set(int idx0,
                 Range idx1,
                 doubleArray1D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(int idx0,
                 Range idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o set
 public void set(Index idx0,
                 int idx1,
                 doubleArray1D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(Index idx0,
                 int idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o set
 public void set(Range idx0,
                 int idx1,
                 doubleArray1D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(Range idx0,
                 int idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - list of values for elements
 o set
 public void set(Index idx0,
                 Index idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - value for elements
 o set
 public void set(Index idx0,
                 Index idx1,
                 doubleArray2D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indices along the 0th axis of the array
idx1 - indices along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(Range idx0,
                 Index idx1,
                 doubleArray2D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indices along the 0th axis of the array
idx1 - indices along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(Range idx0,
                 Index idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - value for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o set
 public void set(Range idx0,
                 Range idx1,
                 doubleArray2D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indices along the 0th axis of the array
idx1 - indices along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(Range idx0,
                 Range idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - value for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o set
 public void set(Index idx0,
                 Range idx1,
                 doubleArray2D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

Parameters:
idx0 - indices along the 0th axis of the array
idx1 - indices along the 1st axis of the array
val - list of values for elements
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
shapes must match
 o set
 public void set(Index idx0,
                 Range idx1,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of a list of elements of the array.

Parameters:
idx0 - indexes along the 0th axis of the array
idx1 - indexes along the 1st axis of the array
val - value for elements
 o section
 public doubleArray2D section(Range I,
                              Range J) throws InvalidRangeException
Extract a 2-dimensional section from the array.

Parameters:
I - range of indices along 0th axis defining the section
J - range of indices along 1st axis defining the section
Throws: InvalidRangeException
ranges of indices must be within bounds of axes
 o section
 public doubleArray1D section(Range I,
                              int j) throws InvalidRangeException
Extract a 1-dimensional section from the array.

Parameters:
I - range of indices along 0th axis defining the section
j - index along 1st axis defining the section
Throws: InvalidRangeException
range of indices must be within bounds of 0th axis
 o section
 public doubleArray1D section(int i,
                              Range J) throws InvalidRangeException
Extract a 1-dimensional section from the array.

Parameters:
i - index along 0th axis defining the section
J - range of indices along 1st axis defining the section
Throws: InvalidRangeException
range of indices must be within bounds of 1st axis
 o section
 public doubleArray0D section(int i,
                              int j)
Extract a 0-dimensional section from the array.

Parameters:
i - index along 0th axis defining the section.
j - index along 1st axis defining the section.
 o assign
 public void assign(double d)
Assign a scalar value to all elements of the array.

Parameters:
d - value to be assigned
 o assign
 public void assign(doubleArray2D a) throws NonconformingArrayException
Assign the values from another two-dimensional array to this array.

Parameters:
a - array with source values
Throws: NonconformingArrayException
arrays must be of same shape
 o divide
 public doubleArray2D divide(doubleArray2D b) throws NonconformingArrayException
Divide elements of this array by the corresponding elements of another array b.

Parameters:
a - array with divisor values
Throws: NonconformingArrayException
b and this must have same shape
 o toJava
 public double[][] toJava()
Transforms this doubleArray2D to a double[].


All Packages  Class Hierarchy  This Package  Previous  Next  Index