com.jmatio.types
Class MLNumericArray<T extends Number>

java.lang.Object
  extended by com.jmatio.types.MLArray
      extended by com.jmatio.types.MLNumericArray<T>
Type Parameters:
T -
All Implemented Interfaces:
ByteStorageSupport<T>, GenericArrayCreator<T>
Direct Known Subclasses:
MLDouble, MLInt32, MLInt64, MLInt8, MLSingle, MLSparse, MLUInt64, MLUInt8

public abstract class MLNumericArray<T extends Number>
extends MLArray
implements GenericArrayCreator<T>, ByteStorageSupport<T>

Author:
Wojciech Gradkowski

Field Summary
 
Fields inherited from class com.jmatio.types.MLArray
attributes, dims, mtFLAG_COMPLEX, mtFLAG_GLOBAL, mtFLAG_LOGICAL, mtFLAG_TYPE, mxCELL_CLASS, mxCHAR_CLASS, mxDOUBLE_CLASS, mxFUNCTION_CLASS, mxINT16_CLASS, mxINT32_CLASS, mxINT64_CLASS, mxINT8_CLASS, mxOBJECT_CLASS, mxOPAQUE_CLASS, mxSINGLE_CLASS, mxSPARSE_CLASS, mxSTRUCT_CLASS, mxUINT16_CLASS, mxUINT32_CLASS, mxUINT64_CLASS, mxUINT8_CLASS, mxUNKNOWN_CLASS, name, type
 
Constructor Summary
MLNumericArray(String name, int[] dims, int type, int attributes)
          Normally this constructor is used only by MatFileReader and MatFileWriter
MLNumericArray(String name, int type, T[] vals, int m)
          Jama [math.nist.gov] style: construct a 2D real matrix from a one-dimensional packed array
 
Method Summary
protected  T _get(ByteBuffer buffer, int index)
           
protected  void _set(ByteBuffer buffer, T value, int index)
           
protected  void allocate()
           
 String contentToString()
           
 void dispose()
           
 boolean equals(Object o)
           
 T get(int index)
           
 T get(int m, int n)
          Does the same as getReal.
 T getImaginary(int index)
           
 T getImaginary(int m, int n)
          Gets single imaginary array element of A(m,n).
 ByteBuffer getImaginaryByteBuffer()
           
 T getReal(int index)
           
 T getReal(int m, int n)
          Gets single real array element of A(m,n).
 ByteBuffer getRealByteBuffer()
           
 void putImaginaryByteBuffer(ByteBuffer buff)
           
 void putRealByteBuffer(ByteBuffer buff)
           
 void set(T[] vector)
           
 void set(T value, int index)
          Does the same as setReal.
 void set(T value, int m, int n)
          Does the same as setReal.
 void setImaginary(T value, int index)
          Sets single real array element.
 void setImaginary(T value, int m, int n)
          Sets single imaginary array element.
 void setReal(T[] vector)
          Sets real part of matrix
 void setReal(T value, int index)
          Sets single real array element.
 void setReal(T value, int m, int n)
          Sets single real array element.
 
Methods inherited from class com.jmatio.types.MLArray
getDimensions, getFlags, getIndex, getM, getN, getName, getNameToByteArray, getNDimensions, getSize, getType, isCell, isChar, isComplex, isDouble, isEmpty, isFunctionObject, isInt16, isInt32, isInt64, isInt8, isLogical, isObject, isOpaque, isSingle, isSparse, isStruct, isUint16, isUint32, isUint64, isUint8, isUnknown, toString, typeToString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jmatio.types.GenericArrayCreator
createArray
 
Methods inherited from interface com.jmatio.types.ByteStorageSupport
buldFromBytes, getByteArray, getBytesAllocated, getStorageClazz
 

Constructor Detail

MLNumericArray

public MLNumericArray(String name,
                      int[] dims,
                      int type,
                      int attributes)
Normally this constructor is used only by MatFileReader and MatFileWriter

Parameters:
name - - array name
dims - - array dimensions
type - - array type
attributes - - array flags

MLNumericArray

public MLNumericArray(String name,
                      int type,
                      T[] vals,
                      int m)
Jama [math.nist.gov] style: construct a 2D real matrix from a one-dimensional packed array

Parameters:
name - - array name
type - - array type
vals - - One-dimensional array of doubles, packed by columns (ala Fortran).
m - - Number of rows
Method Detail

allocate

protected void allocate()

getReal

public T getReal(int m,
                 int n)
Gets single real array element of A(m,n).

Parameters:
m - - row index
n - - column index
Returns:
- array element

getReal

public T getReal(int index)
Parameters:
index -
Returns:

setReal

public void setReal(T value,
                    int m,
                    int n)
Sets single real array element.

Parameters:
value - - element value
m - - row index
n - - column index

setReal

public void setReal(T value,
                    int index)
Sets single real array element.

Parameters:
value - - element value
index - - column-packed vector index

setReal

public void setReal(T[] vector)
Sets real part of matrix

Parameters:
vector - - column-packed vector of elements

setImaginary

public void setImaginary(T value,
                         int m,
                         int n)
Sets single imaginary array element.

Parameters:
value - - element value
m - - row index
n - - column index

setImaginary

public void setImaginary(T value,
                         int index)
Sets single real array element.

Parameters:
value - - element value
index - - column-packed vector index

getImaginary

public T getImaginary(int m,
                      int n)
Gets single imaginary array element of A(m,n).

Parameters:
m - - row index
n - - column index
Returns:
- array element

getImaginary

public T getImaginary(int index)
Parameters:
index -
Returns:

set

public void set(T value,
                int m,
                int n)
Does the same as setReal.

Parameters:
value - - element value
m - - row index
n - - column index

set

public void set(T value,
                int index)
Does the same as setReal.

Parameters:
value - - element value
index - - column-packed vector index

get

public T get(int m,
             int n)
Does the same as getReal.

Parameters:
m - - row index
n - - column index
Returns:
- array element

get

public T get(int index)
Parameters:
index -
Returns:

set

public void set(T[] vector)
Parameters:
vector -

_get

protected T _get(ByteBuffer buffer,
                 int index)

_set

protected void _set(ByteBuffer buffer,
                    T value,
                    int index)

putImaginaryByteBuffer

public void putImaginaryByteBuffer(ByteBuffer buff)

getImaginaryByteBuffer

public ByteBuffer getImaginaryByteBuffer()

putRealByteBuffer

public void putRealByteBuffer(ByteBuffer buff)

getRealByteBuffer

public ByteBuffer getRealByteBuffer()

contentToString

public String contentToString()
Overrides:
contentToString in class MLArray

equals

public boolean equals(Object o)
Overrides:
equals in class Object

dispose

public void dispose()
Overrides:
dispose in class MLArray


Copyright © 2006–2014 GeoSolutions. All rights reserved.