All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class array.doubleArray1D

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

public final class doubleArray1D
extends doubleArray
doubleArray1D = 1-dimensional array of doubles

The doubleArray1D concrete class implements 1-dimensional arrays of doubles. 1-dimensional arrays can either be instantiated directly through constructors, or they can be generated by extracting single-dimensional sections from other 1- or higher-dimensional arrays.


Variable Index

 o data
 o n0
 o w0
 o w1

Constructor Index

 o doubleArray1D(double[])
Create a 1-dimensional array, with size and values defined by a Java array of doubles.
 o doubleArray1D(double[], Range)
Create a 1-dimensional array as a section of another array.
 o doubleArray1D(int)
Create a 1-dimensional array of a certain size.

Method Index

 o assign(double)
Assign a scalar value to all elements of the array.
 o assign(doubleArray1D)
Assign the values from another one-dimensional array to this array.
 o get(Index)
Return another doubleArray1D with the values of the specified elements.
 o get(Index, doubleArray1D)
Return another doubleArray1D with the values of the specified elements.
 o get(int)
Return the value of an element of the array.
 o get(int[])
Return the value of an element of the array.
 o get(Range)
Return another doubleArray1D with the values of the specified elements.
 o get(Range, doubleArray1D)
Return another doubleArray1D with the values of the specified elements.
 o getf(int)
Return the value of an element of the array, no check.
 o permuteAxes(int)
Permute the axis of this array.
 o range(int)
Return the range of array indices along its i-th axis.
 o rank()
Return the rank of the 1-dimensional array, i.e.
 o reshape(int, int)
Reshape this one-dimensional array into a two-dimensional array.
 o reshape(int, int, int)
Reshape this one-dimensional array into a three-dimensional array.
 o section(int)
Extract a 0-dimensional section from the array.
 o section(Range)
Extract a 1-dimensional section from the array.
 o set(Index, double)
Set the value of a list of elements of the array.
 o set(Index, 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(int[], double)
Set the value of an element of the array.
 o set(Range, double)
Set the value of a list of elements of the array.
 o set(Range, doubleArray1D)
Set the value of a list of elements of the array.
 o setf(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 1.
 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 spread(int, int, doubleArray2D)
Replicates an array by adding a dimension.
 o toJava()
Transforms this doubleArray1D to a double[].

Variables

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

Constructors

 o doubleArray1D
 public doubleArray1D(int n) throws InvalidArrayShapeException
Create a 1-dimensional array of a certain size. Elements are 0-valued.

Parameters:
n - number of elements in array.
Throws: InvalidArrayShapeException
extent must be nonnegative
 o doubleArray1D
 public doubleArray1D(double a[]) throws InvalidArrayShapeException
Create a 1-dimensional array, with size and values defined by a Java array of doubles.

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

Methods

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

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 1. I[0] = size(0)

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 0
 o permuteAxes
 public doubleArray1D permuteAxes(int a0) throws InvalidArrayAxisException
Permute the axis of this array. For a one-dimensional array, this is the identity operator.

Parameters:
a0 - axis to appear as 0th axis (must be 0)
Throws: InvalidArrayAxisException
a0 must be 0
 o reshape
 public doubleArray2D reshape(int m0,
                              int m1) throws NonconformingArrayException
Reshape this one-dimensional array into a two-dimensional array.

Parameters:
m0 - extent of resulting array along 0th axis
m1 - extent of resulting array along 1st axis
Throws: NonconformingArrayException
m0*m1 must be equal to size of this
 o reshape
 public doubleArray3D reshape(int m0,
                              int m1,
                              int m2) throws NonconformingArrayException
Reshape this one-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 1
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 1
Overrides:
set in class doubleArray
 o get
 public double get(int i) throws ArrayIndexOutOfBoundsException
Return the value of an element of the array.

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

Parameters:
i - index along the 0-th axis of the array.
 o get
 public doubleArray1D get(Index idx,
                          doubleArray1D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Return another doubleArray1D with the values of the specified elements.

Parameters:
idx - indexes along the 0-th axis of the array.
result - resulting array
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
result must have proper shape
 o get
 public doubleArray1D get(Index idx) throws ArrayIndexOutOfBoundsException
Return another doubleArray1D with the values of the specified elements.

Parameters:
idx - indexes along the 0-th axis of the array.
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o get
 public doubleArray1D get(Range idx,
                          doubleArray1D result) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Return another doubleArray1D with the values of the specified elements.

Parameters:
idx - indexes along the 0-th axis of the array.
result - resulting array
Throws: ArrayIndexOutOfBoundsException
indices must be valid
Throws: NonconformingArrayException
result must have proper shape
 o get
 public doubleArray1D get(Range idx) throws ArrayIndexOutOfBoundsException
Return another doubleArray1D with the values of the specified elements.

Parameters:
idx - indexes along the 0-th axis of the array.
Throws: ArrayIndexOutOfBoundsException
indices must be valid
 o set
 public void set(int i,
                 double val) throws ArrayIndexOutOfBoundsException
Set the value of an element of the array.

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

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

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

Parameters:
idx - indexes along the 0-th axis of the array
val - value for elements
 o set
 public void set(Range idx,
                 doubleArray1D val) throws ArrayIndexOutOfBoundsException, NonconformingArrayException
Set the value of a list of elements of the array.

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

Parameters:
idx - indexes along the 0-th axis of the array
val - value for elements
 o section
 public doubleArray1D section(Range I) throws InvalidRangeException
Extract a 1-dimensional section from the array.

Parameters:
I - range of indices defining the section
Throws: InvalidRangeException
range of indices must be within bounds
 o section
 public doubleArray0D section(int i)
Extract a 0-dimensional section from the array.

Parameters:
i - index of the element 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(doubleArray1D a) throws NonconformingArrayException
Assign the values from another one-dimensional array to this array.

Parameters:
a - array with source values
Throws: NonconformingArrayException
arrays must be of same shape
 o spread
 public void spread(int axis,
                    int copies,
                    doubleArray2D result) throws NonconformingArrayException, InvalidArrayAxisException
Replicates an array by adding a dimension.

Parameters:
axis - axis along which replication is performed
copies - number of copies along that axis
result - resulting array
Throws: NonconformingArrayException
result array must be of right shape
Throws: InvalidArrayAxisException
0 <= axis <= 1
 o toJava
 public double[] toJava()
Transforms this doubleArray1D to a double[].


All Packages  Class Hierarchy  This Package  Previous  Next  Index