public class MatrixType extends GraphType implements AsciiComm
MatrixType sets GraphType.independentVariables = 2 and GraphType.dependentVariables = 1, so it represents the values of a scalar function of two independent variables. If the variables are sampled uniformly, then the object holds only the sampled data and two Triplets indicating how the sampling is done. If the independent variables are sampled irregularly, then the object holds the sampling values as well. Users can test method isIndependentTriplet (or method isUniform ) to see which case holds.
TrianaType
,
GraphType
,
Arithmetic
,
VectorType
,
Triplet
,
Serialized FormNOT_CONNECTED, NOT_READY, OUT_OF_RANGE
Constructor and Description |
---|
MatrixType()
Creates a new empty MatrixType, but with the specific dimensions of this class
|
MatrixType(double[][] z)
Creates a new real MatrixType with a uniformly sampled independent variables by using the 2D argument array
z of doubles as the data and assuming that the independent variables are simply the indices of the data
array, ie x runs from 0 to z.length - 1 in steps of 1 and y runs from 0 to
z[0].length - 1 in steps of 1.
|
MatrixType(double[] x,
double[] y,
double[][] z)
Creates a new real MatrixType using the first argument array of doubles as the sampling values of the first
independent variable (x), the second argument array as the samples of the second independent variable
(y), and the third argument 2D array of doubles as the dependent variable real data.
|
MatrixType(double[] xr,
double[] xi,
double[] yr,
double[] yi,
double[][] zr,
double[][] zi)
Creates a new complex-valued MatrixType with complex independent variables by using the first two argument arrays
of doubles as the real part and imaginary part of the first independent variable (x), the third and fourth
arguments as the real and imaginary parts of the second independent variable (y), and the fifth and sixth
argument double[][] arrays as the real and imaginary parts of the dependent variable.
|
MatrixType(Triplet xTr,
Triplet yTr,
double[][] z)
Creates a new real MatrixType with a uniformly sampled independent variable by using the first argument as the as
the Triplet that determines how the first independent variable (x) is uniformly sampled, the second
Triplet argument to determine how the second independent variable (y) is uniformly sampled, and the third
argument as the dependent variable real data.
|
MatrixType(Triplet xTr,
Triplet yTr,
double[][] zr,
double[][] zi)
Creates a new complex-valued MatrixType with real uniformly-sampled independent variables by using the first two
(Triplet) arguments to determine how the independent variables are uniformly sampled, the third argument
(double[][]) as the real part of the dependent variable data, and the fourth argument (double[][]) as the
imaginary part.
|
Modifier and Type | Method and Description |
---|---|
TrianaType |
copyMe()
This is one of the most important methods of Triana data.
|
double[][] |
getData()
Returns the (real part of the) data array for the dependent variable.
|
double[][] |
getDataImag()
Returns the imaginary part of the data array for the dependent variable.
|
double[][] |
getDataReal()
A synonym for getData.
|
double[] |
getXorYArray(int dim)
Returns the real part of the data values for the given independent variable.
|
double[] |
getXorYImag(int dim)
Returns the imaginary part of the data array for the given independent variable.
|
double[] |
getXorYReal(int dim)
A synonym for getXYArray.
|
Triplet |
getXorYTriplet(int dim)
Method getXorYTriplet returns the Triplet that determines the values of the given independent variable.
|
void |
initialiseData()
Sets the data array(s) to zero if they have been allocated.
|
void |
initialiseDataComplex(int xlen,
int ylen)
Allocates the real and imaginary parts of the data to double arrays of the given lengths and then sets their
elements to zero.
|
void |
initialiseDataReal(int xlen,
int ylen)
Allocates the real part of the data to a double array of the given lengths and then sets its elements to zero.
|
boolean |
isCompatible(TrianaType obj)
Tests the argument object to determine if it makes sense to perform arithmetic operations between it and the
current object.
|
int[] |
length()
A synonym for size.
|
void |
setData(double[][] data)
Sets the argument double[][] array as the dependent variable.
|
void |
setData(double[][] dataReal,
double[][] dataImag)
Sets the two argument double[][] arrays as the real and imaginary parts of the dependent variable.
|
void |
setXorY(double[] xReal,
double[] xImag,
int dim)
This variant of method setXorY sets the first two argument double[] arrays as the real and imaginary parts of the
independent variable whose index is the third argument.
|
void |
setXorY(java.lang.Object data,
int dim)
Sets the first argument Object as the independent variable for the index given by the second argument.
|
int[] |
size()
Returns an array containing the sizes or lengths of the two dimensions of the dependent data array.
|
boolean |
testDataModel()
Tests to make sure this Object obeys the MatrixType data model.
|
add, addToTitle, convertDependentDataArraysToBytes, convertDependentDataArraysToDoubles, convertDependentDataArraysToFloats, convertDependentDataArraysToInts, convertDependentDataArraysToLongs, convertDependentDataArraysToShorts, copyData, copyLabels, copyParameters, divide, equals, getDataArrayClass, getDataArrayImag, getDataArrayImag, getDataArrayImagAsBytes, getDataArrayImagAsDoubles, getDataArrayImagAsFloats, getDataArrayImagAsInts, getDataArrayImagAsLongs, getDataArrayImagAsShorts, getDataArrayReal, getDataArrayReal, getDataArrayRealAsBytes, getDataArrayRealAsDoubles, getDataArrayRealAsFloats, getDataArrayRealAsInts, getDataArrayRealAsLongs, getDataArrayRealAsShorts, getDataArrayTypeNames, getDependentLabels, getDependentVariableDimensions, getDependentVariables, getDimensionLengths, getDimensionLengths, getGraphArrayImag, getGraphArrayImagLog10, getGraphArrayReal, getGraphArrayRealLog10, getIndependentArrayImag, getIndependentArrayReal, getIndependentLabels, getIndependentScaleImag, getIndependentScaleImagLog10, getIndependentScaleReal, getIndependentScaleRealLog10, getIndependentTriplet, getIndependentVariables, getLabels, getLabelsColumn, getTitle, inputFromStream, isArithmeticArray, isArithmeticData, isCompatible, isDependentComplex, isIndependentComplex, isPrimitiveArray, isPrimitiveData, isTriplet, isUniform, maxDependentGraphingValuesImag, maxDependentGraphingValuesReal, maxDependentVariablesImag, maxDependentVariablesReal, maxIndependentScalesImag, maxIndependentScalesReal, maxIndependentVariablesImag, maxIndependentVariablesReal, minDependentGraphingValuesImag, minDependentGraphingValuesReal, minDependentVariablesImag, minDependentVariablesReal, minIndependentScalesImag, minIndependentScalesReal, minIndependentVariablesImag, minIndependentVariablesReal, multiply, outputToStream, resetDependent, resetIndependent, restrictToSubdomain, restrictToSubdomain, setDataArrayImag, setDataArrayReal, setDefaultAxisLabelling, setDependentLabels, setDependentVariableDimensions, setDimensionLengths, setDimensionLengths, setDimensions, setIndependentArrayImag, setIndependentArrayReal, setIndependentLabels, setIndependentTriplet, setIndependentTriplet, setLabels, setTitle, subtract
containerSize, dataExists, deleteFromContainer, getDataContainer, getFromContainer, getSequenceNumber, insertIntoContainer, inspectDataContainer, setDataContainer, setSequenceNumber, updateObsoletePointers
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
inputFromStream, outputToStream
public MatrixType()
public MatrixType(double[][] z)
z
- The two-dimensional matrix of datapublic MatrixType(double[] x, double[] y, double[][] z)
x
- The values of the first independent variabley
- The values of the second independent variablez
- The two-dimensional matrix of datapublic MatrixType(Triplet xTr, Triplet yTr, double[][] z)
new Triplet(length, start, step)
xTr
- The Triplet giving the uniformly sampled values of the first independent variableyTr
- The Triplet giving the uniformly sampled values of the second independent variablez
- The two-dimensional matrix of dataTriplet
public MatrixType(Triplet xTr, Triplet yTr, double[][] zr, double[][] zi)
xTr
- The Triplet giving the uniformly sampled values of the first independent variableyTr
- The Triplet giving the uniformly sampled values of the second independent variablezr
- The two-dimensional matrix of real part of the datazi
- The two-dimensional matrix of imaginary part of the dataTriplet
public MatrixType(double[] xr, double[] xi, double[] yr, double[] yi, double[][] zr, double[][] zi)
public int[] size()
public int[] length()
public double[][] getData()
public double[][] getDataImag()
public double[][] getDataReal()
public void setData(double[][] data)
data
- The new datapublic void setData(double[][] dataReal, double[][] dataImag)
dataReal
- The real part of the new datadataImag
- The imaginary part of the new datapublic void initialiseData()
public void initialiseDataReal(int xlen, int ylen)
xlen
- The size of the first dimension of the matrixylen
- The size of the second dimension of the matrixpublic void initialiseDataComplex(int xlen, int ylen)
xlen
- The size of the first dimension of the matrixylen
- The size of the second dimension of the matrixpublic double[] getXorYArray(int dim)
dim
- The index of the independent variable being examinedTriplet
public Triplet getXorYTriplet(int dim)
dim
- The index of the independent variable being examinedTriplet
public double[] getXorYImag(int dim)
dim
- The index of the independent variable being examinedpublic double[] getXorYReal(int dim)
dim
- The index of the independent variable being examinedpublic void setXorY(java.lang.Object data, int dim)
data
- The new data, either a Triplet or a double[]dim
- The index of the independent variable being setTriplet
public void setXorY(double[] xReal, double[] xImag, int dim)
xReal
- The real part of the independent variablexImag
- The imaginary part of the independent variabledim
- The index of the independent variable being setpublic boolean testDataModel()
testDataModel
in class GraphType
Triplet
public TrianaType copyMe()
To override, the programmer should not invoke the super.copyMe method. Instead, create an object of the current type and call methods copyData and copyParameters. If these have been written correctly, then they will do the copying. The code should createTool, for type YourType:
YourType y = null; try { y = (YourType)getClass().newInstance(); y.copyData( this ); y.copyParameters( this ); y.setLegend( this.getLegend() ); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return y;
The copied object's data should be identical to the original. The method here modifies only one item: a String indicating that the object was created as a copy is added to the description StringVector.
public boolean isCompatible(TrianaType obj)
In MatrixType, this method only tests for compatibility with superior classes, and to see that the input object is a Histogram.
Classes derived from this should over-ride this method with further tests as appropriate. The over-riding method should normally have the first lines
boolean test = super.isCompatible( obj );followed by other tests. If other types not subclassed from GraphType or Const should be allowed to be compatible then other tests must be implemented.
obj
- The data object to be compared with the current one