public class MWMatrixRef extends MWArray
MWMatrixRef
class represents a MATLAB Matrix Reference.
See src/mlutil/matrixref/MatrixRef.cpp.EMPTY_ARRAY
Modifier and Type | Method and Description |
---|---|
<T> T |
applyVisitor(AbstractMWArrayVisitor<T> v) |
MWClassID |
classID()
Returns the MATLAB type of this array.
|
java.lang.Object |
clone()
Creates and returns a deep copy of this array.
|
int[] |
columnIndex()
Returns an array containing the column index of each element in the underlying MATLAB array.
|
int |
compareTo(java.lang.Object obj)
Compares this array with the specified array for order.
|
static MWArray |
deserialize(byte[] data)
Create a new MWArray from serialized data.
|
void |
dispose()
Frees the native MATLAB array contained by this array.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other array is equal to this one.
|
java.lang.Object |
get(int index)
Returns the element at the specified 1-based offset in this array.
|
java.lang.Object |
get(int[] index)
Returns the element at the specified 1-based index-array in this array.
|
java.lang.Object |
getData()
Returns a 1-D array containing a copy of the data in the underlying MATLAB array.
|
int[] |
getDimensions()
Returns an array containing the size of each dimension of this array.
|
int |
hashCode()
Returns a hash code value for this array.
|
boolean |
isEmpty()
Tests if this array has no elements.
|
boolean |
isSparse()
Tests if this array is sparse.
|
int |
maximumNonZeros()
Returns the allocated capacity of a sparse array.
|
int |
numberOfDimensions()
Returns the number of dimensions of this array.
|
int |
numberOfElements()
Returns the total number of elements in this array.
|
int |
numberOfNonZeros()
Returns the number of non-zero elements in a sparse array.
|
protected java.lang.Object |
readResolve()
Called by serialization mechanism when loading a new array from a byte stream.
|
int[] |
rowIndex()
Returns an array containing the row index of each element in the underlying MATLAB array.
|
byte[] |
serialize()
Serialize the MATLAB array to a byte array.
|
void |
set(int[] index,
java.lang.Object element)
Replaces the element at the specified 1-based index-array in this array with the specified element.
|
void |
set(int index,
java.lang.Object element)
Replaces the element at the specified 1-based offset in this array with the specified element.
|
void |
setData(java.lang.Object data) |
java.lang.Object |
sharedCopy()
Creates and returns a shared copy of this array.
|
java.lang.Object[] |
toArray()
Returns an array containing a copy of the data in the underlying MATLAB array.
|
java.lang.String |
toString()
Returns a string representation of this array.
|
protected void |
validate()
Validates the internal array handle.
|
disposeArray
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
MWMatrixRef
instance representing a deep
copy of the underlying MATLAB array.java.lang.CloneNotSupportedException
- - The object's class does not implement the Cloneable interface.public java.lang.Object sharedCopy()
MWMatrixRef
instance representing a shared
copy of the underlying MATLAB array.public boolean equals(java.lang.Object obj)
obj
- Object Array to compare with this MWArray objectpublic int hashCode()
public java.lang.String toString()
public int numberOfElements()
public int numberOfNonZeros()
numberOfElements()
.public int maximumNonZeros()
numberOfElements()
.public MWClassID classID()
MWClassID
of this arraypublic java.lang.Object[] toArray()
toArray
returns the real part. If the underlying array is sparse, a full representation of
the array is returned. Care should be taken when calling toArray
on a
sparse array with large row and column dimensions, as this action may exhaust system
memory. If the underlying array is a cell or struct array, toArray
is
recursively called on each cell.public int numberOfDimensions()
public int[] getDimensions()
public boolean isEmpty()
public boolean isSparse()
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
obj
- Object Array to compare with this MWArray objectpublic java.lang.Object get(int index)
index
- The index of the requested element. Valid range: 1 <= index <= N, where N = total number of elements in the array.public java.lang.Object get(int[] index)
index
- Array of indices specifying the location of the requested element.
The length of the index array must be exactly the number of dimensions of this array.
Each element of the index array has the valid range: 1 <= index[i] <= N[i], where N[i] = the size of the ith dimension.public void set(int index, java.lang.Object element)
index
- The index of the element to replace. Valid range: 1 <= index <= N, where N = total number of elements in the array.element
- New element to replace at index.public void set(int[] index, java.lang.Object element)
index
- Array of indices specifying the location of the element to replace.
The length of the index array must be exactly the number of dimensions of this array.
Each element of the index array has the valid range: 1 <= index[i] <= N[i], where N[i] = the size of the ith dimension.element
- New element to replace at index.public java.lang.Object getData()
getData
returns
the real part. If the underlying array is a cell or struct array, toArray
is
recursively called on each cell.numberOfElements()
for a non-sparse array, and numberOfNonZeros()
for a sparse array.public void setData(java.lang.Object data)
public int[] rowIndex()
public int[] columnIndex()
public byte[] serialize() throws java.io.IOException
java.io.IOException
- if the array cannot be serialized. For
example, executable content (function handles, class instances) cannot
be serialized.public static MWArray deserialize(byte[] data)
data
- serialized array returned from MWArray.serializepublic void dispose()
dispose
in interface Disposable
dispose
in class MWArray
public <T> T applyVisitor(AbstractMWArrayVisitor<T> v)
applyVisitor
in class MWArray
protected void validate()
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.InvalidObjectException
- Attempt to load an invalid array handle.java.io.ObjectStreamException
© 1994-2017 The MathWorks, Inc. Patents Trademarks