public class DoubleArrayView extends Object implements Cloneable
Constructor and Description |
---|
DoubleArrayView(double[] array)
Create a view on the entirety of the given array.
|
DoubleArrayView(double[] array,
int l,
int r)
Create a view on the given array from l (inclusive) to
r (exclusive).
|
DoubleArrayView(int n)
Create a view on an array of length n.
|
Modifier and Type | Method and Description |
---|---|
DoubleArrayView |
clone() |
double |
get(int i)
Get the ith element of this array view.
|
double |
getFast(int i)
Get the ith element of this array view omitting any
bounds checks.
|
double[] |
getUnderlyingStorage()
Get access to the underlying array of this view.
|
void |
set(int i,
double v)
Set the ith element of this array view to the value v.
|
void |
setFast(int i,
double v)
Set the ith element of this array view to the value v.
|
int |
size()
Get the size (number of elements) in the view.
|
DoubleArrayView |
subView(int l1,
int r1)
Get a subview of this view from l1 (inclusive) to r1 (exclusive).
|
double[] |
toArray()
Convert this view to an array.
|
String |
toString() |
public DoubleArrayView(double[] array, int l, int r)
array
- the arrayl
- start (left) indexr
- end (right) indexpublic DoubleArrayView(double[] array)
array
- the array.public DoubleArrayView(int n)
n
- the length of the view and underlying array.public DoubleArrayView subView(int l1, int r1)
l1
- start (left) indexr1
- end (right) indexpublic double get(int i)
i
- the index to getpublic double getFast(int i)
i
- the index to getpublic void set(int i, double v)
i
- the index to setv
- the value to setpublic void setFast(int i, double v)
i
- the index to setv
- the value to setpublic double[] getUnderlyingStorage()
public int size()
public double[] toArray()
public DoubleArrayView clone()