org.ujmp.core.matrix
Class AbstractMatrix

java.lang.Object
  extended by java.lang.Number
      extended by org.ujmp.core.matrix.AbstractMatrix
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Matrix>, HasAnnotation, BooleanCalculations, CanPerformCalculations, BasicDoubleCalculations, DoubleCalculations, BasicEntrywiseDoubleCalculations, CreatorDoubleCalculations, EntrywiseDoubleCalculations, HyperbolicDoubleCalculations, MiscEntrywiseDoubleCalculations, RoundingDoubleCalculations, TrigonometricDoubleCalculations, DecompositionDoubleCalculations, DiscretizeCalculations, GeneralDoubleCalculations, MiscGeneralDoubleCalculations, MissingValueDoubleCalculations, StatisticalDoubleCalculations, BasicMatrixProperties, Clearable, Conversions, CoordinateFunctions, CoreObject, DistanceMeasures, GettersAndSetters, HasGUIObject, HasLabel, IntCalculations, ExportMatrixInterface, Matrix, ObjectCalculations, StringCalculations
Direct Known Subclasses:
AbstractGenericMatrix

public abstract class AbstractMatrix
extends Number
implements Matrix

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ujmp.core.Matrix
Matrix.StorageType
 
Field Summary
static MatrixFactoryRoot factory
           
 
Fields inherited from interface org.ujmp.core.Matrix
ALL, chol, COLUMN, divideMatrix, divideScalar, eig, inv, LINK, lu, minusMatrix, minusScalar, mtimes, NEW, NONE, ORIG, plusMatrix, plusScalar, qr, ROW, solve, svd, timesMatrix, timesScalar, transpose, X, Y, Z
 
Constructor Summary
AbstractMatrix()
           
 
Method Summary
 Matrix abs(Calculation.Ret returnType)
          Calculates the absolute values of all entries in a Matrix.
 Matrix addMissing(Calculation.Ret returnType, int dimension, double... percentMissing)
          Adds a specified amount of missing values (Double.NaN) to the Matrix
 Iterable<long[]> allCoordinates()
          Returns an Iterator that goes over all coordinates in the Matrix.
 Iterable<Object> allValues()
           
 Matrix and(Calculation.Ret returnType, boolean value)
           
 Matrix and(Calculation.Ret returnType, Matrix matrix)
           
 Matrix append(int dimension, Matrix m)
           
 Matrix appendHorizontally(Matrix m)
           
 Matrix appendVertically(Matrix m)
           
 Matrix atimes(Calculation.Ret returnType, boolean ignoreNaN, Matrix matrix)
          Performs an averaging matrix multiplication on the two matrices.
 Iterable<long[]> availableCoordinates()
          Returns an Iterator that only goes over the coordinates in the Matrix that are stored.
 BigDecimal bigDecimalValue()
           
 BigInteger bigIntegerValue()
           
 boolean booleanValue()
           
 Matrix bootstrap(Calculation.Ret returnType)
           
 Matrix bootstrap(Calculation.Ret returnType, int count)
           
 Matrix ceil(Calculation.Ret returnType)
          Returns a matrix with all entries rounded up to the next integer.
 Matrix center(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
          Subtracts the mean from the matrix.
 char charValue()
           
 double chebyshevDistanceTo(Matrix m, boolean ignoreNaN)
           
 Matrix chol()
          Calculates a Cholesky decomposition of the matrix.
 void clear()
           
 Matrix clone()
           
 int compareTo(Matrix m)
           
 boolean containsBigDecimal(BigDecimal v)
           
 boolean containsBigInteger(BigInteger v)
           
 boolean containsBoolean(boolean v)
           
 boolean containsByte(byte v)
           
 boolean containsChar(char v)
           
 boolean containsDate(Date v)
           
 boolean containsDouble(double v)
           
 boolean containsFloat(float v)
           
 boolean containsInt(int v)
           
 boolean containsLong(long v)
           
 boolean containsMissingValues()
           
 boolean containsNull()
           
 boolean containsObject(Object o)
           
 boolean containsShort(short v)
           
 boolean containsString(String s)
           
 Matrix convert(ValueType newValueType)
          Creates a copy of the matrix with the desired type for matrix entries.
 Matrix copy()
          Deprecated. Please do not use this method anymore, it will be removed. use matrix.clone() instead
 Matrix corrcoef(Calculation.Ret returnType, boolean ignoreNaN)
          Calculates the Pearson correlation.
 Matrix cos(Calculation.Ret returnType)
          Calculates the cosinus of all entries in the matrix.
 Matrix cosh(Calculation.Ret returnType)
          Calculates the hyperbolic cosinus of all entries in the matrix.
 Matrix countMissing(Calculation.Ret returnType, int dimension)
          Counts the missing values within the matrix, i.e.
 Matrix cov(Calculation.Ret returnType, boolean ignoreNaN)
          Calculates the covariance Matrix.
 Matrix cumprod(boolean ignoreNaN)
           
 Matrix cumsum(boolean ignoreNaN)
           
 Date dateValue()
           
 Matrix delete(Calculation.Ret returnType, Collection<? extends Number>... selection)
          Delete rows and columns in the Matrix and returns a link to it.
 Matrix delete(Calculation.Ret returnType, long[]... selection)
          Delete rows and columns in the Matrix and returns a link to it.
 Matrix delete(Calculation.Ret returnType, String selection)
          Deletes rows and columns in the Matrix and returns a link to it.
 Matrix deleteColumns(Calculation.Ret returnType, Collection<? extends Number> columns)
          Deletes columns in the Matrix and returns a link to it.
 Matrix deleteColumns(Calculation.Ret returnType, long... columns)
          Deletes columns in the Matrix and returns a link to it.
 Matrix deleteColumnsWithMissingValues(Calculation.Ret returnType)
           
 Matrix deleteRows(Calculation.Ret returnType, Collection<? extends Number> rows)
          Deletes rows in the Matrix and returns a link to it.
 Matrix deleteRows(Calculation.Ret returnType, long... rows)
          Deletes rows in the Matrix and returns a link to it.
 Matrix deleteRowsWithMissingValues(Calculation.Ret returnType, long threshold)
           
 double det()
           
 Matrix diff(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
           
 Matrix discretize(Calculation.Ret returnType, int dimension, Discretize.DiscretizationMethod method, int numberOfBins)
           
 Matrix discretizeToColumns(long column)
           
 Matrix divide(Calculation.Ret returnType, boolean ignoreNaN, double factor)
          Divides every entry in the matrix by a scalar.
 Matrix divide(Calculation.Ret returnType, boolean ignoreNaN, Matrix factor)
          Divides every entry in the matrix by the entries of another matrix.
 Matrix divide(double divisor)
          Divides every entry in the matrix by a scalar.
 Matrix divide(Matrix m)
          Calculates an entrywise division of the two matrices.
 double doubleValue()
           
 Matrix[] eig()
          Calculates the Eigen decomposition of the matrix.
 Matrix[] eigSymm()
          Calculates the Eigen decomposition of a symmetric matrix.
 Matrix eq(Calculation.Ret returnType, Matrix matrix)
           
 Matrix eq(Calculation.Ret returnType, Object value)
           
 boolean equals(Object o)
           
 boolean equalsAnnotation(Object o)
           
 boolean equalsContent(Object o)
           
 double euklideanDistanceTo(Matrix m, boolean ignoreNaN)
           
 Matrix exp(Calculation.Ret returnType)
          Calculates the exponential function all entries in the Matrix.
 void exportToClipboard(FileFormat format, Object... parameters)
           
 void exportToFile(FileFormat format, File file, Object... parameters)
           
 void exportToFile(FileFormat format, String filename, Object... parameters)
           
 void exportToFile(File file, Object... parameters)
           
 void exportToFile(String file, Object... parameters)
           
 void exportToStream(FileFormat format, OutputStream outputStream, Object... parameters)
           
 String exportToString(FileFormat format, Object... parameters)
           
 void exportToWriter(FileFormat format, Writer writer, Object... parameters)
           
 Matrix extractAnnotation(Calculation.Ret returnType, int dimension)
          Generates annotation such as row or column labels from the content of this matrix.
 Matrix eye(Calculation.Ret ret)
          Returns a matrix with ones at the diagonal.
 Matrix fadeIn(Calculation.Ret ret, int dimension)
           
 Matrix fadeOut(Calculation.Ret ret, int dimension)
           
 Matrix fill(Calculation.Ret ret, Object value)
          Returns a matrix with equal size, where all entries are set to a desired value.
 Matrix flipdim(Calculation.Ret returnType, int dimension)
           
 float floatValue()
           
 Matrix floor(Calculation.Ret returnType)
          Returns a matrix with all entries rounded down to the next integer.
 Matrix ge(Calculation.Ret returnType, double value)
           
 Matrix ge(Calculation.Ret returnType, Matrix matrix)
           
 double getAbsoluteValueMean()
           
 double getAbsoluteValueSum()
           
 Annotation getAnnotation()
           
 BigDecimal getAsBigDecimal(long... coordinates)
           
 BigInteger getAsBigInteger(long... coordinates)
           
 boolean getAsBoolean(long... coordinates)
          Returns a byte representation of an entry in the matrix.
 byte getAsByte(long... coordinates)
          Returns a byte representation of an entry in the matrix.
 char getAsChar(long... coordinates)
          Returns a char representation of an entry in the matrix.
 Date getAsDate(long... coordinates)
          Returns a Date representation of an entry in the matrix.
 double getAsDouble(long... coordinates)
          Returns a double representation of an entry in the matrix.
 float getAsFloat(long... coordinates)
          Returns a float representation of an entry in the matrix.
 int getAsInt(long... coordinates)
          Returns an int representation of an entry in the matrix.
 long getAsLong(long... coordinates)
          Returns a long representation of an entry in the matrix.
 Matrix getAsMatrix(long... coordinates)
           
 short getAsShort(long... coordinates)
          Returns a short representation of an entry in the matrix.
 String getAsString(long... coordinates)
          Returns a String representation of an entry in the matrix.
 Object getAxisAnnotation(int axis)
           
 Object getAxisAnnotation(int axis, long... position)
           
 long getColumnCount()
           
 long getColumnForLabel(Object object)
           
 String getColumnLabel(long col)
           
 Object getColumnObject(long col)
           
 long[] getCoordinatesOfMaximum()
          Returns the position of the maximum value in a Matrix.
 long[] getCoordinatesOfMinimum()
          Returns the position of the minimum value in a Matrix.
 long getCoreObjectId()
           
 int getDimensionCount()
           
 double getEuklideanValue()
           
 MatrixFactoryRoot getFactory()
           
 GUIObject getGUIObject()
          Returns an object suitable for displaying on the screen.
 String getLabel()
          Returns the String label of an object.
 Object getMatrixAnnotation()
           
 double getMaxValue()
           
 double getMeanValue()
           
 double getMinValue()
           
 long[] getPositionForLabel(int dimension, Object label)
           
 Object getPreferredObject(long... coordinates)
          Returns a representation of the entry in the matrix that reflects the true object best.
 double getRMS()
           
 long getRowCount()
           
 long getRowForLabel(Object object)
           
 String getRowLabel(long row)
           
 Object getRowObject(long row)
           
 long getSize(int dimension)
           
 double getStdValue()
           
 long getValueCount()
           
 double getValueSum()
           
 ValueType getValueType()
           
 long getZCount()
           
 Matrix ginv()
          Calculates a generalized inverse of the Matrix
 Matrix gt(Calculation.Ret returnType, double value)
           
 Matrix gt(Calculation.Ret returnType, Matrix matrix)
           
 Matrix impute(Calculation.Ret returnType, Impute.ImputationMethod method, Object... parameters)
          Replaces missing values with various methods
 Matrix includeAnnotation(Calculation.Ret returnType, int dimension)
           
 Matrix indexOfMax(Calculation.Ret returnType, int dimension)
          Finds the index of the maximum value in the matrix
 Matrix indexOfMin(Calculation.Ret returnType, int dimension)
          Finds the index of the minimum value in the matrix
 int intValue()
           
 Matrix inv()
          Calculates the inverse of the Matrix using either LUDecomposition (for square matrices) or QRDecomposition (otherwise).
 Matrix invSPD()
          Calculates the inverse of a symmetric positive definite Matrix using Cholesky Decomposition.
 Matrix invSymm()
          Calculates the inverse of the Matrix using either LUDecomposition (for square matrices) or QRDecomposition (otherwise).
 boolean isColumnVector()
           
 boolean isDiagonal()
           
 boolean isEmpty()
           
 boolean isMultidimensionalMatrix()
           
 boolean isReadOnly()
           
 boolean isResizable()
           
 boolean isRowVector()
           
 boolean isScalar()
           
 boolean isSingular()
           
 boolean isSparse()
           
 boolean isSPD()
           
 boolean isSquare()
           
 boolean isSymmetric()
           
 boolean isTransient()
           
 Matrix le(Calculation.Ret returnType, double value)
           
 Matrix le(Calculation.Ret returnType, Matrix matrix)
           
 Matrix log(Calculation.Ret returnType)
          Calculates the natural logarithm of all entries in the Matrix.
 Matrix log10(Calculation.Ret returnType)
          Calculates the logarithm with basis 10 of all entries in the Matrix.
 Matrix log2(Calculation.Ret returnType)
          Calculates the logarithm with basis 2 of all entries in the Matrix.
 long longValue()
           
 Matrix lowerCase(Calculation.Ret returnType)
           
 Matrix lt(Calculation.Ret returnType, double value)
           
 Matrix lt(Calculation.Ret returnType, Matrix matrix)
           
 Matrix[] lu()
          Calculates a LU decomposition of the matrix.
 double manhattenDistanceTo(Matrix m, boolean ignoreNaN)
           
 Matrix max(Calculation.Ret returnType, int dimension)
          Calculates the maximum of the values in the matrix either rowwise, columnwise, or global.
 Matrix mean(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
          Calculates the mean of all entries in the Matrix either per row, per column, or global.
 Matrix min(Calculation.Ret returnType, int dimension)
          Calculates the mimimum of the values in the matrix either rowwise, columnwise, or global.
 double minkowskiDistanceTo(Matrix m, double p, boolean ignoreNaN)
           
 Matrix minus(Calculation.Ret returnType, boolean ignoreNaN, double v)
          Subtracts a specified value from all entries in the matrix.
 Matrix minus(Calculation.Ret returnType, boolean ignoreNaN, Matrix m)
          Calculates the difference of the entries in both matrices
 Matrix minus(double value)
          Subtracts a specified value from all entries in the matrix.
 Matrix minus(Matrix m)
          Calculates the difference of the entries in both matrices
 Matrix mtimes(Calculation.Ret returnType, boolean ignoreNaN, double value)
          Equal to times()
 Matrix mtimes(Calculation.Ret returnType, boolean ignoreNaN, Matrix matrix)
          Performs a matrix multiplication on the two matrices.
 Matrix mtimes(double value)
          Equal to times()
 Matrix mtimes(Matrix matrix)
          Performs a matrix multiplication on the two matrices.
 Matrix mutualInf(Calculation.Ret returnType)
          Calculates the mutual information.
 Matrix ne(Calculation.Ret returnType, Matrix matrix)
           
 Matrix ne(Calculation.Ret returnType, Object value)
           
 Iterable<long[]> nonZeroCoordinates()
           
 double norm1()
           
 double norm2()
           
 Matrix normalize(Calculation.Ret returnType, int dimension)
           
 double normF()
           
 double normInf()
           
 Matrix not(Calculation.Ret returnType)
           
 void notifyGUIObject()
          This method is used to signal changes in the object to the corresponding GUIObject if it exists.
 Matrix ones(Calculation.Ret ret)
          Returns a matrix with equal size, where all entries are set to 1.0.
 Matrix or(Calculation.Ret returnType, boolean value)
           
 Matrix or(Calculation.Ret returnType, Matrix matrix)
           
 Matrix pairedTTest(Calculation.Ret returnType)
          Calculates a paired T-Test on the matrix.
 Matrix pinv()
          Calculates the pseudo inverse of the Matrix using Singular Value Decomposition.
 Matrix plus(Calculation.Ret returnType, boolean ignoreNaN, double v)
          Adds a specified value from all entries in the matrix.
 Matrix plus(Calculation.Ret returnType, boolean ignoreNaN, Matrix m)
          Calculates the sum of the entries in both matrices
 Matrix plus(double value)
          Adds a specified value to all entries in the matrix.
 Matrix plus(Matrix m)
          Calculates the sum of the entries in both matrices
 Matrix power(Calculation.Ret returnType, double power)
          Calculates this matrix to the power of the given value (entrywise).
 Matrix power(Calculation.Ret returnType, Matrix power)
          Calculates this matrix to the power of the given matrix (entrywise).
 Matrix princomp()
          Projects the matrix into the space of the principal components.
 Matrix prod(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
           
 Matrix[] qr()
          Calculates a QR decomposition of the matrix.
 Matrix rand(Calculation.Ret ret)
          Returns a matrix with equal size, where all entries are set to uniform random values between 0.0 and 1.0.
 Matrix randn(Calculation.Ret ret)
          Returns a matrix with equal size, where all entries are set to random values which are normally distributed with 0.0 mean and 1.0 standard deviation.
 int rank()
           
 Matrix removePunctuation(Calculation.Ret ret)
           
 Matrix removeWords(Calculation.Ret ret, Collection<String> words)
           
 Matrix replace(Calculation.Ret returnType, Object search, Object replacement)
          Replaces matching values in the matrix with another value
 Matrix replaceMissingBy(Matrix matrix)
           
 Matrix replaceRegex(Calculation.Ret returnType, Pattern search, String replacement)
          Replaces matching text in every entry of the matrix.
 Matrix replaceRegex(Calculation.Ret returnType, String search, String replacement)
          Replaces matching text in every entry of the matrix.
 Matrix reshape(Calculation.Ret returnType, long... newSize)
           
 Matrix round(Calculation.Ret returnType)
          Returns a matrix with all entries rounded to integer values.
 Matrix select(Calculation.Ret returnType, Collection<? extends Number>... selection)
          Selects rows and columns in the Matrix and returns a link to it.
 Matrix select(Calculation.Ret returnType, long[]... selection)
          Selects rows and columns in the Matrix and returns a link to it.
 Matrix select(Calculation.Ret returnType, String selection)
          Selects rows and columns in the Matrix and returns a link to it.
 Matrix selectColumns(Calculation.Ret returnType, Collection<? extends Number> columns)
          Selects columns in the Matrix and returns a link to it.
 Matrix selectColumns(Calculation.Ret returnType, long... columns)
          Selects columns in the Matrix and returns a link to it.
 Iterable<long[]> selectedCoordinates(long[]... selection)
          Returns an Iterator that goes only over the Coordinates defined by the selection.
 Iterable<long[]> selectedCoordinates(String selection)
          Returns an Iterator that goes only over the Coordinates defined by the selection.
 Matrix selectRows(Calculation.Ret returnType, Collection<? extends Number> rows)
          Selects rows in the Matrix and returns a link to it.
 Matrix selectRows(Calculation.Ret returnType, long... rows)
          Selects rows in the Matrix and returns a link to it.
 void setAnnotation(Annotation annotation)
           
 void setAsBigDecimal(BigDecimal value, long... coordinates)
           
 void setAsBigInteger(BigInteger value, long... coordinates)
           
 void setAsBoolean(boolean value, long... coordinates)
          Sets an entry in the matrix to a boolean value.
 void setAsByte(byte value, long... coordinates)
          Sets an entry in the matrix to a byte value.
 void setAsChar(char value, long... coordinates)
          Sets an entry in the matrix to a char value.
 void setAsDate(Date date, long... coordinates)
          Sets an entry in the matrix to a Date value.
 void setAsDouble(double v, long... coordinates)
          Sets an entry in the matrix to a double value.
 void setAsFloat(float value, long... coordinates)
          Sets an entry in the matrix to a float value.
 void setAsInt(int value, long... coordinates)
          Sets an entry in the matrix to an int value.
 void setAsLong(long value, long... coordinates)
          Sets an entry in the matrix to a long value.
 void setAsMatrix(Matrix m, long... coordinates)
           
 void setAsShort(short value, long... coordinates)
          Sets an entry in the matrix to a short value.
 void setAsString(String string, long... coordinates)
          Sets an entry in the matrix to a String value.
 void setAxisAnnotation(int axis, Object label)
           
 void setAxisAnnotation(int axis, Object label, long... position)
           
 void setColumnLabel(long col, String label)
           
 void setColumnObject(long col, Object label)
           
 void setLabel(String label)
          Sets the label of an object
 void setMatrixAnnotation(Object value)
           
 void setRowLabel(long row, String label)
           
 void setRowObject(long row, Object label)
           
 void setSize(long... size)
          Sets the size of the matrix.
 JFrame showGUI()
          This method will show the object in a JFrame on the screen.
 Matrix shuffle(Calculation.Ret returnType)
           
 Matrix sign(Calculation.Ret returnType)
          Calculates the sign of the entries in a Matrix.
 Matrix sin(Calculation.Ret returnType)
          Calculates the sinus of all entries in the matrix.
 Matrix sinh(Calculation.Ret returnType)
          Calculates the hyperbolic sinus of all entries in the matrix.
 Matrix solve(Matrix b)
          Solve A*X = B
 Matrix solveSPD(Matrix b)
          Solve A*X = B
 Matrix solveSymm(Matrix b)
          Solve A*X = B
 Matrix sortrows(Calculation.Ret returnType, long column, boolean reverse)
           
 Matrix sqrt(Calculation.Ret returnType)
          Calculates the square root of all the entries in a Matrix.
 Matrix squeeze(Calculation.Ret returnType)
           
 Matrix standardize(Calculation.Ret returnType, int dimension)
          Subtracts the mean from the matrix and divides by the standard deviation.
 Matrix std(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
          Calculates the standard deviation of all entries in the Matrix either per row, per column, or global.
 Matrix stem(Calculation.Ret ret)
           
 String stringValue()
           
 Matrix subMatrix(Calculation.Ret returnType, long startRow, long startColumn, long endRow, long endColumn)
           
 Matrix sum(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
          Calculates the sum of all entries in the Matrix either per row, per column, or global.
 Matrix[] svd()
          Calculates the singular value decomposition of the matrix: A = U*S*V'
 Matrix swap(Calculation.Ret returnType, int dimension, long pos1, long pos2)
           
 Matrix tan(Calculation.Ret returnType)
          Calculates the tangens of all entries in the matrix.
 Matrix tanh(Calculation.Ret returnType)
          Calculates the hyperbolic tangens of all entries in the matrix.
 Matrix tfIdf(boolean calculateTf, boolean calculateIdf, boolean normalize)
           
 Matrix times(Calculation.Ret returnType, boolean ignoreNaN, double factor)
          Multiplies every entry in the matrix with a scalar.
 Matrix times(Calculation.Ret returnType, boolean ignoreNaN, Matrix factor)
          Multiplies every entry in the matrix with the entries of another Matrix.
 Matrix times(double factor)
          Multiplies every entry in the matrix with a scalar.
 Matrix times(Matrix m)
          Calculates the entrywise product of the two matrices.
 BigDecimal[][] toBigDecimalArray()
           
 BigDecimalMatrix toBigDecimalMatrix()
           
 BigInteger[][] toBigIntegerArray()
           
 BigIntegerMatrix toBigIntegerMatrix()
           
 boolean[][] toBooleanArray()
          Converts the content of a matrix into a 2-dimensional array of boolean values.
 BooleanMatrix toBooleanMatrix()
           
 byte[][] toByteArray()
          Converts the content of a matrix into a 2-dimensional array of byte values.
 ByteMatrix toByteMatrix()
           
 char[][] toCharArray()
          Converts the content of a matrix into a 2-dimensional array of char values.
 CharMatrix toCharMatrix()
           
 Matrix toColumnVector(Calculation.Ret returnType)
           
 Date[][] toDateArray()
          Converts the content of a matrix into a 2-dimensional array of Date values.
 DateMatrix toDateMatrix()
           
 double[][] toDoubleArray()
          Converts the content of a matrix into a 2-dimensional array of double values.
 DoubleMatrix toDoubleMatrix()
           
 float[][] toFloatArray()
          Converts the content of a matrix into a 2-dimensional array of float values.
 FloatMatrix toFloatMatrix()
           
 int[][] toIntArray()
          Converts the content of a matrix into a 2-dimensional array of int values.
 IntMatrix toIntMatrix()
           
 ListMatrix<?> toListMatrix()
           
 long[][] toLongArray()
          Converts the content of a matrix into a 2-dimensional array of long values.
 LongMatrix toLongMatrix()
           
 MapMatrix<?,?> toMapMatrix()
           
 Object[][] toObjectArray()
          Converts the content of a matrix into a 2-dimensional array of Objects.
 ObjectMatrix toObjectMatrix()
           
 Matrix toRowVector(Calculation.Ret returnType)
           
 SetMatrix<?> toSetMatrix()
           
 short[][] toShortArray()
          Converts the content of a matrix into a 2-dimensional array of short values.
 ShortMatrix toShortMatrix()
           
 String toString()
           
 String[][] toStringArray()
          Converts the content of a matrix into a 2-dimensional array of Strings.
 StringMatrix toStringMatrix()
           
 double trace()
           
 Matrix transpose()
          Returns the transpose of the Matrix, where rows and columns are exchanged.
 Matrix transpose(Calculation.Ret returnType)
          Returns the transpose of the Matrix, where rows and columns are exchanged.
 Matrix transpose(Calculation.Ret returnType, int dimension1, int dimension2)
           
 Matrix tril(Calculation.Ret returnType, int k)
           
 Matrix triu(Calculation.Ret returnType, int k)
           
 Matrix unique(Calculation.Ret returnType)
           
 Matrix uniqueValueCount(Calculation.Ret returnType, int dimension)
           
 Matrix upperCase(Calculation.Ret returnType)
           
 Matrix var(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
          Calculates the variance of all entries in the Matrix either per row, per column, or global.
 Matrix xor(Calculation.Ret returnType, boolean value)
           
 Matrix xor(Calculation.Ret returnType, Matrix matrix)
           
 Matrix zeros(Calculation.Ret ret)
          Returns a matrix with equal size, where all entries are set to zero.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ujmp.core.interfaces.CoordinateFunctions
contains
 
Methods inherited from interface org.ujmp.core.interfaces.GettersAndSetters
getAsObject, setAsObject
 
Methods inherited from interface org.ujmp.core.interfaces.BasicMatrixProperties
byteValue, getSize, getStorageType, shortValue
 

Field Detail

factory

public static MatrixFactoryRoot factory
Constructor Detail

AbstractMatrix

public AbstractMatrix()
Method Detail

allCoordinates

public Iterable<long[]> allCoordinates()
Description copied from interface: CoordinateFunctions
Returns an Iterator that goes over all coordinates in the Matrix. It goes from 0,0 to the size of the Matrix.

Specified by:
allCoordinates in interface CoordinateFunctions
Returns:
Iterable over all coordinates within a Matrix.

getCoreObjectId

public final long getCoreObjectId()
Specified by:
getCoreObjectId in interface CoreObject

getAsDouble

public double getAsDouble(long... coordinates)
Description copied from interface: GettersAndSetters
Returns a double representation of an entry in the matrix. The stored value will be converted to a double as good as possible.

Specified by:
getAsDouble in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a double representation of the entry

setAsDouble

public void setAsDouble(double v,
                        long... coordinates)
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a double value. If the matrix cannot store double values, the value will be represented as good as possible.

Specified by:
setAsDouble in interface GettersAndSetters
Parameters:
v - double value
coordinates - location of the entry

getPreferredObject

public final Object getPreferredObject(long... coordinates)
                                throws MatrixException
Description copied from interface: GettersAndSetters
Returns a representation of the entry in the matrix that reflects the true object best. E.g. if the entry is a String "-5.3", this method returns a double with the equivalent value. For a String "text" the string itself is returned.

Specified by:
getPreferredObject in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
object that represents the matrix entry best
Throws:
MatrixException

getMatrixAnnotation

public final Object getMatrixAnnotation()
Specified by:
getMatrixAnnotation in interface HasAnnotation

getValueType

public ValueType getValueType()
Specified by:
getValueType in interface BasicMatrixProperties

setMatrixAnnotation

public final void setMatrixAnnotation(Object value)
Specified by:
setMatrixAnnotation in interface HasAnnotation

getAxisAnnotation

public final Object getAxisAnnotation(int axis,
                                      long... position)
Specified by:
getAxisAnnotation in interface HasAnnotation

getAxisAnnotation

public final Object getAxisAnnotation(int axis)
Specified by:
getAxisAnnotation in interface HasAnnotation

setAxisAnnotation

public final void setAxisAnnotation(int axis,
                                    Object label,
                                    long... position)
Specified by:
setAxisAnnotation in interface HasAnnotation

setAxisAnnotation

public final void setAxisAnnotation(int axis,
                                    Object label)
Specified by:
setAxisAnnotation in interface HasAnnotation

getGUIObject

public final GUIObject getGUIObject()
Description copied from interface: HasGUIObject
Returns an object suitable for displaying on the screen. Ensures that, for each basic object, only one GUIObject can be returned.

Specified by:
getGUIObject in interface HasGUIObject
Returns:
object suitable for displaying on the screen

containsMissingValues

public final boolean containsMissingValues()
                                    throws MatrixException
Specified by:
containsMissingValues in interface BasicMatrixProperties
Throws:
MatrixException

getEuklideanValue

public final double getEuklideanValue()
                               throws MatrixException
Specified by:
getEuklideanValue in interface BasicMatrixProperties
Throws:
MatrixException

clone

public Matrix clone()
Specified by:
clone in interface CoreObject
Specified by:
clone in interface Matrix
Overrides:
clone in class Object

select

public final Matrix select(Calculation.Ret returnType,
                           long[]... selection)
                    throws MatrixException
Description copied from interface: ObjectCalculations
Selects rows and columns in the Matrix and returns a link to it.

Specified by:
select in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
selection - selected rows and columns
Returns:
Link to original Matrix with desired rows and columns
Throws:
MatrixException

select

public final Matrix select(Calculation.Ret returnType,
                           Collection<? extends Number>... selection)
                    throws MatrixException
Description copied from interface: ObjectCalculations
Selects rows and columns in the Matrix and returns a link to it.

Specified by:
select in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
selection - selected rows and columns
Returns:
Link to original Matrix with desired rows and columns
Throws:
MatrixException

selectRows

public Matrix selectRows(Calculation.Ret returnType,
                         long... rows)
                  throws MatrixException
Description copied from interface: ObjectCalculations
Selects rows in the Matrix and returns a link to it.

Specified by:
selectRows in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
rows - selected rows
Returns:
Link to original Matrix with desired rows
Throws:
MatrixException

select

public final Matrix select(Calculation.Ret returnType,
                           String selection)
                    throws MatrixException
Description copied from interface: ObjectCalculations
Selects rows and columns in the Matrix and returns a link to it. Selections can be made in Matlab/Octave style or similar, e.g. "1,2,5-6,8:5;*". Dimensions are separated by ';'. Selections in one dimension are separated by spaces or ','. Ranges are selected using '-' or ':'. A whole dimension can be selected with '*'.

Specified by:
select in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
selection - String defining the selection
Returns:
Link to original Matrix with desired rows and columns
Throws:
MatrixException

selectColumns

public Matrix selectColumns(Calculation.Ret returnType,
                            long... columns)
                     throws MatrixException
Description copied from interface: ObjectCalculations
Selects columns in the Matrix and returns a link to it.

Specified by:
selectColumns in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
Returns:
Link to original Matrix with desired columns
Throws:
MatrixException

selectRows

public final Matrix selectRows(Calculation.Ret returnType,
                               Collection<? extends Number> rows)
                        throws MatrixException
Description copied from interface: ObjectCalculations
Selects rows in the Matrix and returns a link to it.

Specified by:
selectRows in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
rows - selected rows
Returns:
Link to original Matrix with desired rows
Throws:
MatrixException

selectColumns

public final Matrix selectColumns(Calculation.Ret returnType,
                                  Collection<? extends Number> columns)
                           throws MatrixException
Description copied from interface: ObjectCalculations
Selects columns in the Matrix and returns a link to it.

Specified by:
selectColumns in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
columns - selected columns
Returns:
Link to original Matrix with desired columns
Throws:
MatrixException

impute

public Matrix impute(Calculation.Ret returnType,
                     Impute.ImputationMethod method,
                     Object... parameters)
              throws MatrixException
Description copied from interface: MissingValueDoubleCalculations
Replaces missing values with various methods

Specified by:
impute in interface MissingValueDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
method - the imputation method to use
parameters - specify a set of parameters if needed
Returns:
Matrix with missing values replaced
Throws:
MatrixException

discretize

public Matrix discretize(Calculation.Ret returnType,
                         int dimension,
                         Discretize.DiscretizationMethod method,
                         int numberOfBins)
                  throws MatrixException
Specified by:
discretize in interface IntCalculations
Throws:
MatrixException

indexOfMax

public Matrix indexOfMax(Calculation.Ret returnType,
                         int dimension)
                  throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Finds the index of the maximum value in the matrix

Specified by:
indexOfMax in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
Returns:
Matrix containing the coordinates of the Maximum
Throws:
MatrixException

indexOfMin

public Matrix indexOfMin(Calculation.Ret returnType,
                         int dimension)
                  throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Finds the index of the minimum value in the matrix

Specified by:
indexOfMin in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
Returns:
Matrix containing the coordinates of the Minimum
Throws:
MatrixException

standardize

public Matrix standardize(Calculation.Ret returnType,
                          int dimension)
                   throws MatrixException
Description copied from interface: MiscGeneralDoubleCalculations
Subtracts the mean from the matrix and divides by the standard deviation.

Specified by:
standardize in interface MiscGeneralDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
Returns:
Matrix with zero mean and unit variance.
Throws:
MatrixException

normalize

public Matrix normalize(Calculation.Ret returnType,
                        int dimension)
                 throws MatrixException
Specified by:
normalize in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

atimes

public Matrix atimes(Calculation.Ret returnType,
                     boolean ignoreNaN,
                     Matrix matrix)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Performs an averaging matrix multiplication on the two matrices. The matrices must be 2-dimensional and have the correct size.

Specified by:
atimes in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
matrix - the second matrix
Returns:
Matrix product
Throws:
MatrixException

inv

public Matrix inv()
           throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the inverse of the Matrix using either LUDecomposition (for square matrices) or QRDecomposition (otherwise).

Specified by:
inv in interface DecompositionDoubleCalculations
Returns:
Inverse of the matrix
Throws:
MatrixException

invSymm

public Matrix invSymm()
               throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the inverse of the Matrix using either LUDecomposition (for square matrices) or QRDecomposition (otherwise).

Specified by:
invSymm in interface DecompositionDoubleCalculations
Returns:
Inverse of the matrix
Throws:
MatrixException

invSPD

public Matrix invSPD()
              throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the inverse of a symmetric positive definite Matrix using Cholesky Decomposition.

Specified by:
invSPD in interface DecompositionDoubleCalculations
Returns:
Inverse of the matrix
Throws:
MatrixException

solve

public Matrix solve(Matrix b)
Description copied from interface: DecompositionDoubleCalculations
Solve A*X = B

Specified by:
solve in interface DecompositionDoubleCalculations
Parameters:
b - right hand side
Returns:
solution for X if A is square, least squares solution otherwise

solveSymm

public Matrix solveSymm(Matrix b)
Description copied from interface: DecompositionDoubleCalculations
Solve A*X = B

Specified by:
solveSymm in interface DecompositionDoubleCalculations
Parameters:
b - right hand side
Returns:
solution for X if A is square, least squares solution otherwise

solveSPD

public Matrix solveSPD(Matrix b)
Description copied from interface: DecompositionDoubleCalculations
Solve A*X = B

Specified by:
solveSPD in interface DecompositionDoubleCalculations
Parameters:
b - right hand side
Returns:
solution for X if A is square, least squares solution otherwise

ginv

public Matrix ginv()
            throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates a generalized inverse of the Matrix

Specified by:
ginv in interface DecompositionDoubleCalculations
Returns:
Pseudo inverse of the Matrix
Throws:
MatrixException

princomp

public Matrix princomp()
                throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Projects the matrix into the space of the principal components.

Specified by:
princomp in interface DecompositionDoubleCalculations
Returns:
Matrix projected on principal components.
Throws:
MatrixException

pinv

public Matrix pinv()
            throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the pseudo inverse of the Matrix using Singular Value Decomposition.

Specified by:
pinv in interface DecompositionDoubleCalculations
Returns:
Pseudo inverse of the Matrix
Throws:
MatrixException

center

public Matrix center(Calculation.Ret returnType,
                     int dimension,
                     boolean ignoreNaN)
              throws MatrixException
Description copied from interface: MiscGeneralDoubleCalculations
Subtracts the mean from the matrix.

Specified by:
center in interface MiscGeneralDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
ignoreNaN - should missing values be ignored
Returns:
Matrix with zero mean.
Throws:
MatrixException

copy

public Matrix copy()
            throws MatrixException
Deprecated. Please do not use this method anymore, it will be removed. use matrix.clone() instead

Specified by:
copy in interface ObjectCalculations
Throws:
MatrixException

isResizable

public boolean isResizable()
Specified by:
isResizable in interface BasicMatrixProperties

convert

public final Matrix convert(ValueType newValueType)
                     throws MatrixException
Description copied from interface: ObjectCalculations
Creates a copy of the matrix with the desired type for matrix entries.

Specified by:
convert in interface ObjectCalculations
Parameters:
newValueType - defines the new format of the matrix
Returns:
Matrix with the same entries in the new format
Throws:
MatrixException

replaceRegex

public final Matrix replaceRegex(Calculation.Ret returnType,
                                 Pattern search,
                                 String replacement)
                          throws MatrixException
Description copied from interface: StringCalculations
Replaces matching text in every entry of the matrix.

Specified by:
replaceRegex in interface StringCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
search - Regular expression pattern to search for
replacement - Replacement String
Returns:
matrix with modified entries
Throws:
MatrixException

replace

public final Matrix replace(Calculation.Ret returnType,
                            Object search,
                            Object replacement)
                     throws MatrixException
Description copied from interface: ObjectCalculations
Replaces matching values in the matrix with another value

Specified by:
replace in interface ObjectCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
search - Object to search for
replacement - Object used to replace the original value
Returns:
matrix with modified entries
Throws:
MatrixException

replaceRegex

public final Matrix replaceRegex(Calculation.Ret returnType,
                                 String search,
                                 String replacement)
                          throws MatrixException
Description copied from interface: StringCalculations
Replaces matching text in every entry of the matrix.

Specified by:
replaceRegex in interface StringCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
search - Regular expression to search for
replacement - Replacement String
Returns:
matrix with modified entries
Throws:
MatrixException

times

public Matrix times(double factor)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Multiplies every entry in the matrix with a scalar.

Specified by:
times in interface BasicDoubleCalculations
Parameters:
factor - factor to multiply with
Returns:
Matrix with all entries multiplied by a factor.
Throws:
MatrixException

times

public Matrix times(Matrix m)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Calculates the entrywise product of the two matrices.

Specified by:
times in interface BasicDoubleCalculations
Parameters:
m - the second matrix
Returns:
matrix with product of all entries
Throws:
MatrixException

divide

public Matrix divide(Matrix m)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Calculates an entrywise division of the two matrices.

Specified by:
divide in interface BasicDoubleCalculations
Parameters:
m - the second matrix
Returns:
matrix with all entries divided by the second matrix's entry.
Throws:
MatrixException

divide

public Matrix divide(double divisor)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Divides every entry in the matrix by a scalar.

Specified by:
divide in interface BasicDoubleCalculations
Parameters:
divisor - factor by which to divide
Returns:
Matrix with all entries divided by a factor.
Throws:
MatrixException

divide

public Matrix divide(Calculation.Ret returnType,
                     boolean ignoreNaN,
                     double factor)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Divides every entry in the matrix by a scalar.

Specified by:
divide in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
factor - factor by which to divide
Returns:
Matrix with all entries divided by a factor.
Throws:
MatrixException

times

public Matrix times(Calculation.Ret returnType,
                    boolean ignoreNaN,
                    double factor)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Multiplies every entry in the matrix with a scalar.

Specified by:
times in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
factor - factor to multiply with
Returns:
Matrix with all entries multiplied by a factor.
Throws:
MatrixException

times

public Matrix times(Calculation.Ret returnType,
                    boolean ignoreNaN,
                    Matrix factor)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Multiplies every entry in the matrix with the entries of another Matrix.

Specified by:
times in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
factor - factor to multiply with
Returns:
Matrix with all entries multiplied by a factor.
Throws:
MatrixException

divide

public Matrix divide(Calculation.Ret returnType,
                     boolean ignoreNaN,
                     Matrix factor)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Divides every entry in the matrix by the entries of another matrix.

Specified by:
divide in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
factor - factor by which to divide
Returns:
Matrix with all entries divided by a factor.
Throws:
MatrixException

power

public final Matrix power(Calculation.Ret returnType,
                          double power)
                   throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates this matrix to the power of the given value (entrywise).

Specified by:
power in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with all entries to the power of factor.
Throws:
MatrixException

power

public final Matrix power(Calculation.Ret returnType,
                          Matrix power)
                   throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates this matrix to the power of the given matrix (entrywise).

Specified by:
power in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
matrix with all entries to the power of the second matrix's entry.
Throws:
MatrixException

gt

public final Matrix gt(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
gt in interface BooleanCalculations
Throws:
MatrixException

gt

public final Matrix gt(Calculation.Ret returnType,
                       double value)
                throws MatrixException
Specified by:
gt in interface BooleanCalculations
Throws:
MatrixException

and

public final Matrix and(Calculation.Ret returnType,
                        Matrix matrix)
                 throws MatrixException
Specified by:
and in interface BooleanCalculations
Throws:
MatrixException

and

public final Matrix and(Calculation.Ret returnType,
                        boolean value)
                 throws MatrixException
Specified by:
and in interface BooleanCalculations
Throws:
MatrixException

or

public final Matrix or(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
or in interface BooleanCalculations
Throws:
MatrixException

or

public final Matrix or(Calculation.Ret returnType,
                       boolean value)
                throws MatrixException
Specified by:
or in interface BooleanCalculations
Throws:
MatrixException

xor

public final Matrix xor(Calculation.Ret returnType,
                        Matrix matrix)
                 throws MatrixException
Specified by:
xor in interface BooleanCalculations
Throws:
MatrixException

xor

public final Matrix xor(Calculation.Ret returnType,
                        boolean value)
                 throws MatrixException
Specified by:
xor in interface BooleanCalculations
Throws:
MatrixException

not

public final Matrix not(Calculation.Ret returnType)
                 throws MatrixException
Specified by:
not in interface BooleanCalculations
Throws:
MatrixException

lt

public final Matrix lt(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
lt in interface BooleanCalculations
Throws:
MatrixException

lt

public final Matrix lt(Calculation.Ret returnType,
                       double value)
                throws MatrixException
Specified by:
lt in interface BooleanCalculations
Throws:
MatrixException

ge

public final Matrix ge(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
ge in interface BooleanCalculations
Throws:
MatrixException

ge

public final Matrix ge(Calculation.Ret returnType,
                       double value)
                throws MatrixException
Specified by:
ge in interface BooleanCalculations
Throws:
MatrixException

le

public final Matrix le(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
le in interface BooleanCalculations
Throws:
MatrixException

le

public final Matrix le(Calculation.Ret returnType,
                       double value)
                throws MatrixException
Specified by:
le in interface BooleanCalculations
Throws:
MatrixException

eq

public final Matrix eq(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
eq in interface BooleanCalculations
Throws:
MatrixException

eq

public final Matrix eq(Calculation.Ret returnType,
                       Object value)
                throws MatrixException
Specified by:
eq in interface BooleanCalculations
Throws:
MatrixException

ne

public final Matrix ne(Calculation.Ret returnType,
                       Matrix matrix)
                throws MatrixException
Specified by:
ne in interface BooleanCalculations
Throws:
MatrixException

ne

public final Matrix ne(Calculation.Ret returnType,
                       Object value)
                throws MatrixException
Specified by:
ne in interface BooleanCalculations
Throws:
MatrixException

getValueCount

public long getValueCount()
Specified by:
getValueCount in interface BasicMatrixProperties

getCoordinatesOfMaximum

public final long[] getCoordinatesOfMaximum()
                                     throws MatrixException
Description copied from interface: CoordinateFunctions
Returns the position of the maximum value in a Matrix. If there is more than one equal maximum values, the first that is found is returned (not necessarily with the lowest coordinates). If no maximum can be found (because there are no numbers in the matrix or all numbers are NaN), the coordinates -1,-1 are returned.

Specified by:
getCoordinatesOfMaximum in interface CoordinateFunctions
Returns:
Coordinates of the maximum value
Throws:
MatrixException

getCoordinatesOfMinimum

public final long[] getCoordinatesOfMinimum()
                                     throws MatrixException
Description copied from interface: CoordinateFunctions
Returns the position of the minimum value in a Matrix. If there is more than one equal minimum values, the first that is found is returned (not necessarily with the lowest coordinates). If no minimum can be found (because there are no numbers in the matrix or all numbers are NaN), the coordinates -1,-1 are returned.

Specified by:
getCoordinatesOfMinimum in interface CoordinateFunctions
Returns:
Coordinates of the minimum value
Throws:
MatrixException

selectedCoordinates

public Iterable<long[]> selectedCoordinates(String selection)
                                     throws MatrixException
Description copied from interface: CoordinateFunctions
Returns an Iterator that goes only over the Coordinates defined by the selection. The selection is a Matlab/Octave style String, to define what rows or columns should be considered. E.g. "(2:5,[1,3,5,7:9])" to select rows 2 to 5 and the columns 1, 3, 5, 7, 8 and 9. Note that, in UJMP numbering starts at 0 unlike in Matlab and Octave

Specified by:
selectedCoordinates in interface CoordinateFunctions
Parameters:
selection - The String defining the selection of rows or columns
Returns:
Iterable over the desired Coordinates
Throws:
MatrixException

selectedCoordinates

public Iterable<long[]> selectedCoordinates(long[]... selection)
                                     throws MatrixException
Description copied from interface: CoordinateFunctions
Returns an Iterator that goes only over the Coordinates defined by the selection. The selections consists of a list of long arrays, one for each dimension. The first array contains the row numbers that should be selected, the second the column numbers, and so on.

Specified by:
selectedCoordinates in interface CoordinateFunctions
Parameters:
selection - A list of long arrays defining the desired rows or columns
Returns:
Iterable over the desired Coordinates
Throws:
MatrixException

isTransient

public boolean isTransient()
Specified by:
isTransient in interface BasicMatrixProperties

nonZeroCoordinates

public Iterable<long[]> nonZeroCoordinates()
Specified by:
nonZeroCoordinates in interface CoordinateFunctions

availableCoordinates

public Iterable<long[]> availableCoordinates()
Description copied from interface: CoordinateFunctions
Returns an Iterator that only goes over the coordinates in the Matrix that are stored. For most Matrices, this is the same as allCoordinates(). For sparse Matrices, it iterates only over the entries in it.

Specified by:
availableCoordinates in interface CoordinateFunctions
Returns:
Iterable over the saved entries in a Matrix.

toDoubleArray

public double[][] toDoubleArray()
                         throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of double values.

Specified by:
toDoubleArray in interface GettersAndSetters
Returns:
double array with matrix entries
Throws:
MatrixException

toObjectArray

public Object[][] toObjectArray()
                         throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of Objects.

Specified by:
toObjectArray in interface GettersAndSetters
Returns:
Object array with matrix entries
Throws:
MatrixException

toIntArray

public int[][] toIntArray()
                   throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of int values.

Specified by:
toIntArray in interface GettersAndSetters
Returns:
int array with matrix entries
Throws:
MatrixException

toLongArray

public long[][] toLongArray()
                     throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of long values.

Specified by:
toLongArray in interface GettersAndSetters
Returns:
long array with matrix entries
Throws:
MatrixException

toShortArray

public short[][] toShortArray()
                       throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of short values.

Specified by:
toShortArray in interface GettersAndSetters
Returns:
short array with matrix entries
Throws:
MatrixException

toCharArray

public char[][] toCharArray()
                     throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of char values.

Specified by:
toCharArray in interface GettersAndSetters
Returns:
char array with matrix entries
Throws:
MatrixException

toStringArray

public String[][] toStringArray()
                         throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of Strings.

Specified by:
toStringArray in interface GettersAndSetters
Returns:
String array with matrix entries
Throws:
MatrixException

toByteArray

public byte[][] toByteArray()
                     throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of byte values.

Specified by:
toByteArray in interface GettersAndSetters
Returns:
byte array with matrix entries
Throws:
MatrixException

toBooleanArray

public boolean[][] toBooleanArray()
                           throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of boolean values.

Specified by:
toBooleanArray in interface GettersAndSetters
Returns:
boolean array with matrix entries
Throws:
MatrixException

toFloatArray

public float[][] toFloatArray()
                       throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of float values.

Specified by:
toFloatArray in interface GettersAndSetters
Returns:
float array with matrix entries
Throws:
MatrixException

toDateArray

public Date[][] toDateArray()
                     throws MatrixException
Description copied from interface: GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of Date values.

Specified by:
toDateArray in interface GettersAndSetters
Returns:
Date array with matrix entries
Throws:
MatrixException

toBigDecimalArray

public BigDecimal[][] toBigDecimalArray()
                                 throws MatrixException
Specified by:
toBigDecimalArray in interface GettersAndSetters
Throws:
MatrixException

toBigIntegerArray

public BigInteger[][] toBigIntegerArray()
                                 throws MatrixException
Specified by:
toBigIntegerArray in interface GettersAndSetters
Throws:
MatrixException

sqrt

public final Matrix sqrt(Calculation.Ret returnType)
                  throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the square root of all the entries in a Matrix.

Specified by:
sqrt in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix containing the square roots of all entries
Throws:
MatrixException

round

public final Matrix round(Calculation.Ret returnType)
                   throws MatrixException
Description copied from interface: RoundingDoubleCalculations
Returns a matrix with all entries rounded to integer values.

Specified by:
round in interface RoundingDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with rounded values
Throws:
MatrixException

ceil

public final Matrix ceil(Calculation.Ret returnType)
                  throws MatrixException
Description copied from interface: RoundingDoubleCalculations
Returns a matrix with all entries rounded up to the next integer. The result is a new Matrix.

Specified by:
ceil in interface RoundingDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with rounded values
Throws:
MatrixException

extractAnnotation

public final Matrix extractAnnotation(Calculation.Ret returnType,
                                      int dimension)
                               throws MatrixException
Description copied from interface: ObjectCalculations
Generates annotation such as row or column labels from the content of this matrix. This is useful for example for data imported from CSV files with labels in the first line.

Specified by:
extractAnnotation in interface ObjectCalculations
Parameters:
returnType - Specify whether to return a new matrix, or a link
dimension - Which axis should be shortened to extract the labels. E.g. if you want column labels, you must specify Matrix.ROW, which does not seem very intuitive at first glance. However, if you're dealing with multi-dimensional data, this becomes more clear. If you want annotation generated for all dimensions, you can specify Matrix.ALL or omit the dimensions parameter.
Returns:
new Matrix with annotation generated from content.
Throws:
MatrixException

includeAnnotation

public final Matrix includeAnnotation(Calculation.Ret returnType,
                                      int dimension)
                               throws MatrixException
Specified by:
includeAnnotation in interface ObjectCalculations
Throws:
MatrixException

floor

public final Matrix floor(Calculation.Ret returnType)
                   throws MatrixException
Description copied from interface: RoundingDoubleCalculations
Returns a matrix with all entries rounded down to the next integer. The result is a new Matrix.

Specified by:
floor in interface RoundingDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with rounded values
Throws:
MatrixException

showGUI

public final JFrame showGUI()
Description copied from interface: HasGUIObject
This method will show the object in a JFrame on the screen.

Specified by:
showGUI in interface HasGUIObject

notifyGUIObject

public void notifyGUIObject()
Description copied from interface: HasGUIObject
This method is used to signal changes in the object to the corresponding GUIObject if it exists.

Maybe this method can be deleted, when all changes are made trough the GUIObject?

Specified by:
notifyGUIObject in interface HasGUIObject

mtimes

public Matrix mtimes(Matrix matrix)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Performs a matrix multiplication on the two matrices. The matrices must be 2-dimensional and have the correct size.

Specified by:
mtimes in interface BasicDoubleCalculations
Parameters:
matrix - the second matrix
Returns:
Matrix product
Throws:
MatrixException

mtimes

public Matrix mtimes(Calculation.Ret returnType,
                     boolean ignoreNaN,
                     Matrix matrix)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Performs a matrix multiplication on the two matrices. The matrices must be 2-dimensional and have the correct size.

Specified by:
mtimes in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
matrix - the second matrix
Returns:
Matrix product
Throws:
MatrixException

mtimes

public Matrix mtimes(double value)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Equal to times()

Specified by:
mtimes in interface BasicDoubleCalculations
Parameters:
value - the value
Returns:
Matrix product
Throws:
MatrixException

mtimes

public Matrix mtimes(Calculation.Ret returnType,
                     boolean ignoreNaN,
                     double value)
              throws MatrixException
Description copied from interface: BasicDoubleCalculations
Equal to times()

Specified by:
mtimes in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
value - the value to multiply
Returns:
Matrix product
Throws:
MatrixException

getAsBoolean

public boolean getAsBoolean(long... coordinates)
                     throws MatrixException
Description copied from interface: GettersAndSetters
Returns a byte representation of an entry in the matrix. The stored value will be converted to a boolean as good as possible.

Specified by:
getAsBoolean in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a boolean representation of the entry
Throws:
MatrixException

setAsBoolean

public void setAsBoolean(boolean value,
                         long... coordinates)
                  throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a boolean value. If the matrix cannot store byte values, the value will be represented as good as possible.

Specified by:
setAsBoolean in interface GettersAndSetters
Parameters:
value - boolean value
coordinates - location of the entry
Throws:
MatrixException

getAsInt

public int getAsInt(long... coordinates)
             throws MatrixException
Description copied from interface: GettersAndSetters
Returns an int representation of an entry in the matrix. The stored value will be converted to an int as good as possible.

Specified by:
getAsInt in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
an int representation of the entry
Throws:
MatrixException

setAsInt

public void setAsInt(int value,
                     long... coordinates)
              throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to an int value. If the matrix cannot store int values, the value will be represented as good as possible.

Specified by:
setAsInt in interface GettersAndSetters
Parameters:
value - int value
coordinates - location of the entry
Throws:
MatrixException

getAsByte

public byte getAsByte(long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Returns a byte representation of an entry in the matrix. The stored value will be converted to a byte as good as possible.

Specified by:
getAsByte in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a byte representation of the entry
Throws:
MatrixException

setAsByte

public void setAsByte(byte value,
                      long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a byte value. If the matrix cannot store byte values, the value will be represented as good as possible.

Specified by:
setAsByte in interface GettersAndSetters
Parameters:
value - byte value
coordinates - location of the entry
Throws:
MatrixException

getAsChar

public char getAsChar(long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Returns a char representation of an entry in the matrix. The stored value will be converted to a char as good as possible.

Specified by:
getAsChar in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a char representation of the entry
Throws:
MatrixException

getAsBigInteger

public BigInteger getAsBigInteger(long... coordinates)
                           throws MatrixException
Specified by:
getAsBigInteger in interface GettersAndSetters
Throws:
MatrixException

getAsBigDecimal

public BigDecimal getAsBigDecimal(long... coordinates)
                           throws MatrixException
Specified by:
getAsBigDecimal in interface GettersAndSetters
Throws:
MatrixException

setAsChar

public void setAsChar(char value,
                      long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a char value. If the matrix cannot store char values, the value will be represented as good as possible.

Specified by:
setAsChar in interface GettersAndSetters
Parameters:
value - char value
coordinates - location of the entry
Throws:
MatrixException

setAsBigDecimal

public void setAsBigDecimal(BigDecimal value,
                            long... coordinates)
                     throws MatrixException
Specified by:
setAsBigDecimal in interface GettersAndSetters
Throws:
MatrixException

setAsBigInteger

public void setAsBigInteger(BigInteger value,
                            long... coordinates)
                     throws MatrixException
Specified by:
setAsBigInteger in interface GettersAndSetters
Throws:
MatrixException

getAsFloat

public float getAsFloat(long... coordinates)
                 throws MatrixException
Description copied from interface: GettersAndSetters
Returns a float representation of an entry in the matrix. The stored value will be converted to a float as good as possible.

Specified by:
getAsFloat in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a float representation of the entry
Throws:
MatrixException

setAsFloat

public void setAsFloat(float value,
                       long... coordinates)
                throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a float value. If the matrix cannot store float values, the value will be represented as good as possible.

Specified by:
setAsFloat in interface GettersAndSetters
Parameters:
value - float value
coordinates - location of the entry
Throws:
MatrixException

getAsShort

public short getAsShort(long... coordinates)
                 throws MatrixException
Description copied from interface: GettersAndSetters
Returns a short representation of an entry in the matrix. The stored value will be converted to a short as good as possible.

Specified by:
getAsShort in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a short representation of the entry
Throws:
MatrixException

getAsMatrix

public Matrix getAsMatrix(long... coordinates)
                   throws MatrixException
Specified by:
getAsMatrix in interface GettersAndSetters
Throws:
MatrixException

setAsMatrix

public void setAsMatrix(Matrix m,
                        long... coordinates)
                 throws MatrixException
Specified by:
setAsMatrix in interface GettersAndSetters
Throws:
MatrixException

setAsShort

public void setAsShort(short value,
                       long... coordinates)
                throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a short value. If the matrix cannot store short values, the value will be represented as good as possible.

Specified by:
setAsShort in interface GettersAndSetters
Parameters:
value - short value
coordinates - location of the entry
Throws:
MatrixException

getAsLong

public long getAsLong(long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Returns a long representation of an entry in the matrix. The stored value will be converted to a long as good as possible.

Specified by:
getAsLong in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a long representation of the entry
Throws:
MatrixException

setAsLong

public void setAsLong(long value,
                      long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a long value. If the matrix cannot store long values, the value will be represented as good as possible.

Specified by:
setAsLong in interface GettersAndSetters
Parameters:
value - long value
coordinates - location of the entry
Throws:
MatrixException

getAsDate

public Date getAsDate(long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Returns a Date representation of an entry in the matrix. The stored value will be converted to a Date object as good as possible.

Specified by:
getAsDate in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a String representation of the entry
Throws:
MatrixException

setAsDate

public void setAsDate(Date date,
                      long... coordinates)
               throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a Date value. If the matrix cannot store Date objects, the value will be represented as good as possible.

Specified by:
setAsDate in interface GettersAndSetters
coordinates - location of the entry
Throws:
MatrixException

delete

public final Matrix delete(Calculation.Ret returnType,
                           String selection)
                    throws MatrixException
Description copied from interface: ObjectCalculations
Deletes rows and columns in the Matrix and returns a link to it. Selections can be made in Matlab/Octave style or similar, e.g. "1,2,5-6,8:5;*". Dimensions are separated by ';'. Selections in one dimension are separated by spaces or ','. Ranges are selected using '-' or ':'. A whole dimension can be selected with '*'.

Specified by:
delete in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
selection - String defining the selection
Returns:
Link to original Matrix with desired rows and columns deleted
Throws:
MatrixException

delete

public final Matrix delete(Calculation.Ret returnType,
                           Collection<? extends Number>... selection)
                    throws MatrixException
Description copied from interface: ObjectCalculations
Delete rows and columns in the Matrix and returns a link to it.

Specified by:
delete in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
selection - selected rows and columns
Returns:
Link to original Matrix with desired rows and columns
Throws:
MatrixException

delete

public final Matrix delete(Calculation.Ret returnType,
                           long[]... selection)
                    throws MatrixException
Description copied from interface: ObjectCalculations
Delete rows and columns in the Matrix and returns a link to it.

Specified by:
delete in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
selection - selected rows and columns
Returns:
Link to original Matrix with desired rows and columns
Throws:
MatrixException

deleteRows

public final Matrix deleteRows(Calculation.Ret returnType,
                               long... rows)
                        throws MatrixException
Description copied from interface: ObjectCalculations
Deletes rows in the Matrix and returns a link to it.

Specified by:
deleteRows in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
rows - selected rows
Returns:
Link to original Matrix with desired rows
Throws:
MatrixException

deleteRows

public final Matrix deleteRows(Calculation.Ret returnType,
                               Collection<? extends Number> rows)
                        throws MatrixException
Description copied from interface: ObjectCalculations
Deletes rows in the Matrix and returns a link to it.

Specified by:
deleteRows in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
rows - selected rows
Returns:
Link to original Matrix with desired rows
Throws:
MatrixException

deleteColumns

public final Matrix deleteColumns(Calculation.Ret returnType,
                                  Collection<? extends Number> columns)
                           throws MatrixException
Description copied from interface: ObjectCalculations
Deletes columns in the Matrix and returns a link to it.

Specified by:
deleteColumns in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
columns - selected columns
Returns:
Link to original Matrix with desired columns
Throws:
MatrixException

deleteColumns

public final Matrix deleteColumns(Calculation.Ret returnType,
                                  long... columns)
                           throws MatrixException
Description copied from interface: ObjectCalculations
Deletes columns in the Matrix and returns a link to it.

Specified by:
deleteColumns in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
Returns:
Link to original Matrix with desired columns
Throws:
MatrixException

minus

public Matrix minus(Calculation.Ret returnType,
                    boolean ignoreNaN,
                    double v)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Subtracts a specified value from all entries in the matrix.

Specified by:
minus in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
v - the value to subtract
Returns:
Matrix with the entries minus the value
Throws:
MatrixException

minus

public Matrix minus(Calculation.Ret returnType,
                    boolean ignoreNaN,
                    Matrix m)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Calculates the difference of the entries in both matrices

Specified by:
minus in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
m - The matrix to subtract
Returns:
matrix with difference values
Throws:
MatrixException

plus

public Matrix plus(Calculation.Ret returnType,
                   boolean ignoreNaN,
                   double v)
            throws MatrixException
Description copied from interface: BasicDoubleCalculations
Adds a specified value from all entries in the matrix.

Specified by:
plus in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
v - the value to subtract
Returns:
Matrix with the entries plus the value
Throws:
MatrixException

plus

public Matrix plus(Calculation.Ret returnType,
                   boolean ignoreNaN,
                   Matrix m)
            throws MatrixException
Description copied from interface: BasicDoubleCalculations
Calculates the sum of the entries in both matrices

Specified by:
plus in interface BasicDoubleCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
ignoreNaN - should missing values be ignored
m - The matrix to subtract
Returns:
matrix with sum values
Throws:
MatrixException

transpose

public Matrix transpose()
                 throws MatrixException
Description copied from interface: ObjectCalculations
Returns the transpose of the Matrix, where rows and columns are exchanged. This works also if the Matrix has more than two dimensions.

Specified by:
transpose in interface ObjectCalculations
Returns:
transposed Matrix.
Throws:
MatrixException

transpose

public Matrix transpose(Calculation.Ret returnType)
                 throws MatrixException
Description copied from interface: ObjectCalculations
Returns the transpose of the Matrix, where rows and columns are exchanged. This works also if the Matrix has more than two dimensions.

Specified by:
transpose in interface ObjectCalculations
Parameters:
returnType - Defines if a new Matrix or a link should be returned.
Returns:
transposed Matrix.
Throws:
MatrixException

mean

public Matrix mean(Calculation.Ret returnType,
                   int dimension,
                   boolean ignoreNaN)
            throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the mean of all entries in the Matrix either per row, per column, or global.

Specified by:
mean in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
ignoreNaN - should missing values be ignored
Returns:
Matrix with the sum of the values along the desired axis
Throws:
MatrixException

var

public Matrix var(Calculation.Ret returnType,
                  int dimension,
                  boolean ignoreNaN)
           throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the variance of all entries in the Matrix either per row, per column, or global.

Specified by:
var in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
ignoreNaN - should missing values be ignored
Returns:
Matrix with the sum of the values along the desired axis
Throws:
MatrixException

std

public Matrix std(Calculation.Ret returnType,
                  int dimension,
                  boolean ignoreNaN)
           throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the standard deviation of all entries in the Matrix either per row, per column, or global.

Specified by:
std in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
ignoreNaN - should missing values be ignored
Returns:
Matrix with the sum of the values along the desired axis
Throws:
MatrixException

getColumnCount

public long getColumnCount()
Specified by:
getColumnCount in interface BasicMatrixProperties

getRowCount

public long getRowCount()
Specified by:
getRowCount in interface BasicMatrixProperties

getZCount

public long getZCount()
Specified by:
getZCount in interface BasicMatrixProperties

getSize

public final long getSize(int dimension)
Specified by:
getSize in interface BasicMatrixProperties

prod

public Matrix prod(Calculation.Ret returnType,
                   int dimension,
                   boolean ignoreNaN)
            throws MatrixException
Specified by:
prod in interface StatisticalDoubleCalculations
Throws:
MatrixException

diff

public Matrix diff(Calculation.Ret returnType,
                   int dimension,
                   boolean ignoreNaN)
            throws MatrixException
Specified by:
diff in interface StatisticalDoubleCalculations
Throws:
MatrixException

sum

public final Matrix sum(Calculation.Ret returnType,
                        int dimension,
                        boolean ignoreNaN)
                 throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the sum of all entries in the Matrix either per row, per column, or global.

Specified by:
sum in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
ignoreNaN - should missing values be ignored
Returns:
Matrix with the sum of the values along the desired axis
Throws:
MatrixException

sign

public final Matrix sign(Calculation.Ret returnType)
                  throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the sign of the entries in a Matrix. For values greater than zero, 1.0 is returned. Negative values will give -1.0 as return value. 0.0 is returned for entries equal to zero.

Specified by:
sign in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with signum values
Throws:
MatrixException

toString

public String toString()
Specified by:
toString in interface BasicMatrixProperties
Overrides:
toString in class Object

getDimensionCount

public final int getDimensionCount()
Specified by:
getDimensionCount in interface BasicMatrixProperties

ones

public final Matrix ones(Calculation.Ret ret)
                  throws MatrixException
Description copied from interface: CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to 1.0.

Specified by:
ones in interface CreatorDoubleCalculations
Returns:
Matrix with ones.
Throws:
MatrixException

fill

public final Matrix fill(Calculation.Ret ret,
                         Object value)
                  throws MatrixException
Description copied from interface: ObjectCalculations
Returns a matrix with equal size, where all entries are set to a desired value.

Specified by:
fill in interface ObjectCalculations
value - fill with this value
Returns:
Matrix with ones.
Throws:
MatrixException

zeros

public final Matrix zeros(Calculation.Ret ret)
                   throws MatrixException
Description copied from interface: CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to zero.

Specified by:
zeros in interface CreatorDoubleCalculations
Returns:
Matrix with zeros.
Throws:
MatrixException

eye

public final Matrix eye(Calculation.Ret ret)
                 throws MatrixException
Description copied from interface: CreatorDoubleCalculations
Returns a matrix with ones at the diagonal.

Specified by:
eye in interface CreatorDoubleCalculations
Returns:
Eye matrix with ones at the diagonal
Throws:
MatrixException

plus

public Matrix plus(double value)
            throws MatrixException
Description copied from interface: BasicDoubleCalculations
Adds a specified value to all entries in the matrix.

Specified by:
plus in interface BasicDoubleCalculations
Parameters:
value - the value to add
Returns:
Matrix with the entries plus the value
Throws:
MatrixException

plus

public Matrix plus(Matrix m)
            throws MatrixException
Description copied from interface: BasicDoubleCalculations
Calculates the sum of the entries in both matrices

Specified by:
plus in interface BasicDoubleCalculations
Parameters:
m - The matrix to add
Returns:
matrix with sum values
Throws:
MatrixException

minus

public Matrix minus(double value)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Subtracts a specified value from all entries in the matrix.

Specified by:
minus in interface BasicDoubleCalculations
Parameters:
value - the value to subtract
Returns:
Matrix with the entries minus the value
Throws:
MatrixException

minus

public Matrix minus(Matrix m)
             throws MatrixException
Description copied from interface: BasicDoubleCalculations
Calculates the difference of the entries in both matrices

Specified by:
minus in interface BasicDoubleCalculations
Parameters:
m - The matrix to subtract
Returns:
matrix with difference values
Throws:
MatrixException

clear

public void clear()
Specified by:
clear in interface Clearable

rand

public final Matrix rand(Calculation.Ret ret)
                  throws MatrixException
Description copied from interface: CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to uniform random values between 0.0 and 1.0.

Specified by:
rand in interface CreatorDoubleCalculations
Returns:
Matrix with uniformly distributed values.
Throws:
MatrixException

randn

public final Matrix randn(Calculation.Ret ret)
                   throws MatrixException
Description copied from interface: CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to random values which are normally distributed with 0.0 mean and 1.0 standard deviation.

Specified by:
randn in interface CreatorDoubleCalculations
Returns:
Matrix with normally distributed values.
Throws:
MatrixException

compareTo

public final int compareTo(Matrix m)
Specified by:
compareTo in interface Comparable<Matrix>

rank

public int rank()
         throws MatrixException
Specified by:
rank in interface BasicMatrixProperties
Throws:
MatrixException

isSPD

public final boolean isSPD()
Specified by:
isSPD in interface BasicMatrixProperties

isSymmetric

public final boolean isSymmetric()
Specified by:
isSymmetric in interface BasicMatrixProperties

isEmpty

public boolean isEmpty()
                throws MatrixException
Specified by:
isEmpty in interface BasicMatrixProperties
Throws:
MatrixException

abs

public final Matrix abs(Calculation.Ret returnType)
                 throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the absolute values of all entries in a Matrix. Positive values stay the same, negative values change sign.

Specified by:
abs in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
A new Matrix with absolute values.
Throws:
MatrixException

log

public final Matrix log(Calculation.Ret returnType)
                 throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the natural logarithm of all entries in the Matrix.

Specified by:
log in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with logarithm values.
Throws:
MatrixException

exp

public final Matrix exp(Calculation.Ret returnType)
                 throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the exponential function all entries in the Matrix.

Specified by:
exp in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with exp values.
Throws:
MatrixException

sortrows

public final Matrix sortrows(Calculation.Ret returnType,
                             long column,
                             boolean reverse)
                      throws MatrixException
Specified by:
sortrows in interface ObjectCalculations
Throws:
MatrixException

cumsum

public final Matrix cumsum(boolean ignoreNaN)
                    throws MatrixException
Specified by:
cumsum in interface StatisticalDoubleCalculations
Throws:
MatrixException

cumprod

public final Matrix cumprod(boolean ignoreNaN)
                     throws MatrixException
Specified by:
cumprod in interface StatisticalDoubleCalculations
Throws:
MatrixException

log2

public final Matrix log2(Calculation.Ret returnType)
                  throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the logarithm with basis 2 of all entries in the Matrix.

Specified by:
log2 in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with logarithm values.
Throws:
MatrixException

log10

public final Matrix log10(Calculation.Ret returnType)
                   throws MatrixException
Description copied from interface: BasicEntrywiseDoubleCalculations
Calculates the logarithm with basis 10 of all entries in the Matrix.

Specified by:
log10 in interface BasicEntrywiseDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with logarithm values.
Throws:
MatrixException

isDiagonal

public final boolean isDiagonal()
                         throws MatrixException
Specified by:
isDiagonal in interface BasicMatrixProperties
Throws:
MatrixException

isSquare

public final boolean isSquare()
Specified by:
isSquare in interface BasicMatrixProperties

euklideanDistanceTo

public double euklideanDistanceTo(Matrix m,
                                  boolean ignoreNaN)
                           throws MatrixException
Specified by:
euklideanDistanceTo in interface DistanceMeasures
Throws:
MatrixException

det

public double det()
           throws MatrixException
Specified by:
det in interface BasicMatrixProperties
Throws:
MatrixException

isSingular

public boolean isSingular()
                   throws MatrixException
Specified by:
isSingular in interface BasicMatrixProperties
Throws:
MatrixException

manhattenDistanceTo

public double manhattenDistanceTo(Matrix m,
                                  boolean ignoreNaN)
                           throws MatrixException
Specified by:
manhattenDistanceTo in interface DistanceMeasures
Throws:
MatrixException

minkowskiDistanceTo

public double minkowskiDistanceTo(Matrix m,
                                  double p,
                                  boolean ignoreNaN)
                           throws MatrixException
Specified by:
minkowskiDistanceTo in interface DistanceMeasures
Throws:
MatrixException

chebyshevDistanceTo

public double chebyshevDistanceTo(Matrix m,
                                  boolean ignoreNaN)
                           throws MatrixException
Specified by:
chebyshevDistanceTo in interface DistanceMeasures
Throws:
MatrixException

min

public Matrix min(Calculation.Ret returnType,
                  int dimension)
           throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the mimimum of the values in the matrix either rowwise, columnwise, or global.

Specified by:
min in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - the axis along which should be calculated, e.g. ROW=0, COLUMN=1 or ALL
Returns:
A new matrix containing the minimum values
Throws:
MatrixException

max

public Matrix max(Calculation.Ret returnType,
                  int dimension)
           throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the maximum of the values in the matrix either rowwise, columnwise, or global.

Specified by:
max in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - the axis along which should be calculated, e.g. ROW=0, COLUMN=1 or ALL
Returns:
A new matrix containing the maximum values
Throws:
MatrixException

addMissing

public final Matrix addMissing(Calculation.Ret returnType,
                               int dimension,
                               double... percentMissing)
                        throws MatrixException
Description copied from interface: MissingValueDoubleCalculations
Adds a specified amount of missing values (Double.NaN) to the Matrix

Specified by:
addMissing in interface MissingValueDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
percentMissing - defines how many values are missing 0.0 to 1.0
Returns:
Matrix with missing values
Throws:
MatrixException

countMissing

public Matrix countMissing(Calculation.Ret returnType,
                           int dimension)
                    throws MatrixException
Description copied from interface: MissingValueDoubleCalculations
Counts the missing values within the matrix, i.e. Infinity or NaN

Specified by:
countMissing in interface MissingValueDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
dimension - The axis along which to calculate
Returns:
Matrix with counts of missing values
Throws:
MatrixException

isScalar

public final boolean isScalar()
Specified by:
isScalar in interface BasicMatrixProperties

isRowVector

public final boolean isRowVector()
Specified by:
isRowVector in interface BasicMatrixProperties

isColumnVector

public final boolean isColumnVector()
Specified by:
isColumnVector in interface BasicMatrixProperties

isMultidimensionalMatrix

public final boolean isMultidimensionalMatrix()
Specified by:
isMultidimensionalMatrix in interface BasicMatrixProperties

sinh

public Matrix sinh(Calculation.Ret returnType)
            throws MatrixException
Description copied from interface: HyperbolicDoubleCalculations
Calculates the hyperbolic sinus of all entries in the matrix.

Specified by:
sinh in interface HyperbolicDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with hyperbolic sinus values
Throws:
MatrixException

cosh

public Matrix cosh(Calculation.Ret returnType)
            throws MatrixException
Description copied from interface: HyperbolicDoubleCalculations
Calculates the hyperbolic cosinus of all entries in the matrix.

Specified by:
cosh in interface HyperbolicDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with hyperbolic cosinus values
Throws:
MatrixException

tanh

public Matrix tanh(Calculation.Ret returnType)
            throws MatrixException
Description copied from interface: HyperbolicDoubleCalculations
Calculates the hyperbolic tangens of all entries in the matrix.

Specified by:
tanh in interface HyperbolicDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with hyperbolic tangens values
Throws:
MatrixException

sin

public Matrix sin(Calculation.Ret returnType)
           throws MatrixException
Description copied from interface: TrigonometricDoubleCalculations
Calculates the sinus of all entries in the matrix.

Specified by:
sin in interface TrigonometricDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with sinus values
Throws:
MatrixException

cos

public Matrix cos(Calculation.Ret returnType)
           throws MatrixException
Description copied from interface: TrigonometricDoubleCalculations
Calculates the cosinus of all entries in the matrix.

Specified by:
cos in interface TrigonometricDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with cosinus values
Throws:
MatrixException

tril

public Matrix tril(Calculation.Ret returnType,
                   int k)
            throws MatrixException
Specified by:
tril in interface ObjectCalculations
Throws:
MatrixException

triu

public Matrix triu(Calculation.Ret returnType,
                   int k)
            throws MatrixException
Specified by:
triu in interface ObjectCalculations
Throws:
MatrixException

tan

public Matrix tan(Calculation.Ret returnType)
           throws MatrixException
Description copied from interface: TrigonometricDoubleCalculations
Calculates the tangens of all entries in the matrix.

Specified by:
tan in interface TrigonometricDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with tangens values
Throws:
MatrixException

cov

public Matrix cov(Calculation.Ret returnType,
                  boolean ignoreNaN)
           throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the covariance Matrix. Each row is an observation and each column is a variable.

Specified by:
cov in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
ignoreNaN - should missing values be ignored
Returns:
Covariance Matrix
Throws:
MatrixException

corrcoef

public Matrix corrcoef(Calculation.Ret returnType,
                       boolean ignoreNaN)
                throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the Pearson correlation. Each row is an observation and each column is a variable.

Specified by:
corrcoef in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
ignoreNaN - should missing values be ignored
Returns:
Covariance Matrix
Throws:
MatrixException

mutualInf

public Matrix mutualInf(Calculation.Ret returnType)
                 throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates the mutual information. Each row is an observation and each column is a variable.

Specified by:
mutualInf in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with mutual information
Throws:
MatrixException

pairedTTest

public Matrix pairedTTest(Calculation.Ret returnType)
                   throws MatrixException
Description copied from interface: StatisticalDoubleCalculations
Calculates a paired T-Test on the matrix. Each row is an observation and each column is a variable.

Specified by:
pairedTTest in interface StatisticalDoubleCalculations
Parameters:
returnType - Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrix
Returns:
Matrix with p-values of the T-Test
Throws:
MatrixException

bootstrap

public Matrix bootstrap(Calculation.Ret returnType)
                 throws MatrixException
Specified by:
bootstrap in interface ObjectCalculations
Throws:
MatrixException

lowerCase

public Matrix lowerCase(Calculation.Ret returnType)
                 throws MatrixException
Specified by:
lowerCase in interface StringCalculations
Throws:
MatrixException

upperCase

public Matrix upperCase(Calculation.Ret returnType)
                 throws MatrixException
Specified by:
upperCase in interface StringCalculations
Throws:
MatrixException

tfIdf

public Matrix tfIdf(boolean calculateTf,
                    boolean calculateIdf,
                    boolean normalize)
             throws MatrixException
Specified by:
tfIdf in interface StringCalculations
Throws:
MatrixException

removePunctuation

public Matrix removePunctuation(Calculation.Ret ret)
                         throws MatrixException
Specified by:
removePunctuation in interface StringCalculations
Throws:
MatrixException

stem

public Matrix stem(Calculation.Ret ret)
            throws MatrixException
Specified by:
stem in interface StringCalculations
Throws:
MatrixException

removeWords

public Matrix removeWords(Calculation.Ret ret,
                          Collection<String> words)
                   throws MatrixException
Specified by:
removeWords in interface StringCalculations
Throws:
MatrixException

unique

public Matrix unique(Calculation.Ret returnType)
              throws MatrixException
Specified by:
unique in interface ObjectCalculations
Throws:
MatrixException

uniqueValueCount

public Matrix uniqueValueCount(Calculation.Ret returnType,
                               int dimension)
                        throws MatrixException
Specified by:
uniqueValueCount in interface ObjectCalculations
Throws:
MatrixException

bootstrap

public Matrix bootstrap(Calculation.Ret returnType,
                        int count)
                 throws MatrixException
Specified by:
bootstrap in interface ObjectCalculations
Throws:
MatrixException

transpose

public Matrix transpose(Calculation.Ret returnType,
                        int dimension1,
                        int dimension2)
                 throws MatrixException
Specified by:
transpose in interface ObjectCalculations
Throws:
MatrixException

swap

public Matrix swap(Calculation.Ret returnType,
                   int dimension,
                   long pos1,
                   long pos2)
            throws MatrixException
Specified by:
swap in interface ObjectCalculations
Throws:
MatrixException

flipdim

public Matrix flipdim(Calculation.Ret returnType,
                      int dimension)
               throws MatrixException
Specified by:
flipdim in interface ObjectCalculations
Throws:
MatrixException

shuffle

public final Matrix shuffle(Calculation.Ret returnType)
                     throws MatrixException
Specified by:
shuffle in interface ObjectCalculations
Throws:
MatrixException

trace

public final double trace()
                   throws MatrixException
Specified by:
trace in interface BasicMatrixProperties
Throws:
MatrixException

exportToFile

public final void exportToFile(File file,
                               Object... parameters)
                        throws MatrixException,
                               IOException
Specified by:
exportToFile in interface ExportMatrixInterface
Throws:
MatrixException
IOException

exportToClipboard

public final void exportToClipboard(FileFormat format,
                                    Object... parameters)
                             throws MatrixException,
                                    IOException
Specified by:
exportToClipboard in interface ExportMatrixInterface
Throws:
MatrixException
IOException

exportToFile

public final void exportToFile(String file,
                               Object... parameters)
                        throws MatrixException,
                               IOException
Specified by:
exportToFile in interface ExportMatrixInterface
Throws:
MatrixException
IOException

exportToFile

public final void exportToFile(FileFormat format,
                               String filename,
                               Object... parameters)
                        throws MatrixException,
                               IOException
Specified by:
exportToFile in interface ExportMatrixInterface
Throws:
MatrixException
IOException

exportToFile

public final void exportToFile(FileFormat format,
                               File file,
                               Object... parameters)
                        throws MatrixException,
                               IOException
Specified by:
exportToFile in interface ExportMatrixInterface
Throws:
MatrixException
IOException

exportToStream

public final void exportToStream(FileFormat format,
                                 OutputStream outputStream,
                                 Object... parameters)
                          throws MatrixException,
                                 IOException
Specified by:
exportToStream in interface ExportMatrixInterface
Throws:
MatrixException
IOException

exportToWriter

public final void exportToWriter(FileFormat format,
                                 Writer writer,
                                 Object... parameters)
                          throws MatrixException,
                                 IOException
Specified by:
exportToWriter in interface ExportMatrixInterface
Throws:
MatrixException
IOException

setLabel

public final void setLabel(String label)
Description copied from interface: HasLabel
Sets the label of an object

Specified by:
setLabel in interface HasLabel
Parameters:
label - the new label.

getLabel

public final String getLabel()
Description copied from interface: HasLabel
Returns the String label of an object.

Specified by:
getLabel in interface HasLabel
Returns:
the label

setAsString

public void setAsString(String string,
                        long... coordinates)
                 throws MatrixException
Description copied from interface: GettersAndSetters
Sets an entry in the matrix to a String value. If the matrix cannot store Strings, the value will be represented as good as possible.

Specified by:
setAsString in interface GettersAndSetters
coordinates - location of the entry
Throws:
MatrixException

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface BasicMatrixProperties

getAsString

public String getAsString(long... coordinates)
                   throws MatrixException
Description copied from interface: GettersAndSetters
Returns a String representation of an entry in the matrix. The stored value will be converted to a String as good as possible.

Specified by:
getAsString in interface GettersAndSetters
Parameters:
coordinates - location of the entry
Returns:
a String representation of the entry
Throws:
MatrixException

getMaxValue

public final double getMaxValue()
                         throws MatrixException
Specified by:
getMaxValue in interface BasicMatrixProperties
Throws:
MatrixException

getMinValue

public final double getMinValue()
                         throws MatrixException
Specified by:
getMinValue in interface BasicMatrixProperties
Throws:
MatrixException

getMeanValue

public final double getMeanValue()
                          throws MatrixException
Specified by:
getMeanValue in interface BasicMatrixProperties
Throws:
MatrixException

getStdValue

public final double getStdValue()
                         throws MatrixException
Specified by:
getStdValue in interface BasicMatrixProperties
Throws:
MatrixException

getValueSum

public final double getValueSum()
                         throws MatrixException
Specified by:
getValueSum in interface BasicMatrixProperties
Throws:
MatrixException

getAbsoluteValueSum

public final double getAbsoluteValueSum()
                                 throws MatrixException
Specified by:
getAbsoluteValueSum in interface BasicMatrixProperties
Throws:
MatrixException

getColumnLabel

public final String getColumnLabel(long col)
Specified by:
getColumnLabel in interface HasAnnotation

getRowLabel

public final String getRowLabel(long row)
Specified by:
getRowLabel in interface HasAnnotation

getRowForLabel

public final long getRowForLabel(Object object)
Specified by:
getRowForLabel in interface HasAnnotation

getColumnForLabel

public final long getColumnForLabel(Object object)
Specified by:
getColumnForLabel in interface HasAnnotation

getPositionForLabel

public final long[] getPositionForLabel(int dimension,
                                        Object label)
Specified by:
getPositionForLabel in interface HasAnnotation

getRowObject

public final Object getRowObject(long row)
Specified by:
getRowObject in interface HasAnnotation

getColumnObject

public final Object getColumnObject(long col)
Specified by:
getColumnObject in interface HasAnnotation

setColumnLabel

public final void setColumnLabel(long col,
                                 String label)
Specified by:
setColumnLabel in interface HasAnnotation

setRowLabel

public final void setRowLabel(long row,
                              String label)
Specified by:
setRowLabel in interface HasAnnotation

setRowObject

public final void setRowObject(long row,
                               Object label)
Specified by:
setRowObject in interface HasAnnotation

setColumnObject

public final void setColumnObject(long col,
                                  Object label)
Specified by:
setColumnObject in interface HasAnnotation

getAbsoluteValueMean

public final double getAbsoluteValueMean()
                                  throws MatrixException
Specified by:
getAbsoluteValueMean in interface BasicMatrixProperties
Throws:
MatrixException

toRowVector

public final Matrix toRowVector(Calculation.Ret returnType)
                         throws MatrixException
Specified by:
toRowVector in interface ObjectCalculations
Throws:
MatrixException

toColumnVector

public final Matrix toColumnVector(Calculation.Ret returnType)
                            throws MatrixException
Specified by:
toColumnVector in interface ObjectCalculations
Throws:
MatrixException

replaceMissingBy

public Matrix replaceMissingBy(Matrix matrix)
                        throws MatrixException
Specified by:
replaceMissingBy in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

deleteColumnsWithMissingValues

public final Matrix deleteColumnsWithMissingValues(Calculation.Ret returnType)
                                            throws MatrixException
Specified by:
deleteColumnsWithMissingValues in interface MissingValueDoubleCalculations
Throws:
MatrixException

deleteRowsWithMissingValues

public final Matrix deleteRowsWithMissingValues(Calculation.Ret returnType,
                                                long threshold)
                                         throws MatrixException
Specified by:
deleteRowsWithMissingValues in interface MissingValueDoubleCalculations
Throws:
MatrixException

appendHorizontally

public final Matrix appendHorizontally(Matrix m)
                                throws MatrixException
Specified by:
appendHorizontally in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

allValues

public Iterable<Object> allValues()
Specified by:
allValues in interface BasicMatrixProperties

appendVertically

public final Matrix appendVertically(Matrix m)
                              throws MatrixException
Specified by:
appendVertically in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

append

public final Matrix append(int dimension,
                           Matrix m)
                    throws MatrixException
Specified by:
append in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

discretizeToColumns

public final Matrix discretizeToColumns(long column)
                                 throws MatrixException
Specified by:
discretizeToColumns in interface DiscretizeCalculations
Throws:
MatrixException

subMatrix

public final Matrix subMatrix(Calculation.Ret returnType,
                              long startRow,
                              long startColumn,
                              long endRow,
                              long endColumn)
                       throws MatrixException
Specified by:
subMatrix in interface ObjectCalculations
Throws:
MatrixException

svd

public Matrix[] svd()
             throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the singular value decomposition of the matrix: A = U*S*V'

Specified by:
svd in interface DecompositionDoubleCalculations
Returns:
Singular value decomposition of the matrix.
Throws:
MatrixException

eig

public Matrix[] eig()
             throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the Eigen decomposition of the matrix.

Specified by:
eig in interface DecompositionDoubleCalculations
Returns:
Eigen decomposition of the matrix.
Throws:
MatrixException

eigSymm

public Matrix[] eigSymm()
                 throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates the Eigen decomposition of a symmetric matrix.

Specified by:
eigSymm in interface DecompositionDoubleCalculations
Returns:
Eigen decomposition of the matrix.
Throws:
MatrixException

qr

public Matrix[] qr()
            throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates a QR decomposition of the matrix.

Specified by:
qr in interface DecompositionDoubleCalculations
Returns:
QR decomposition of the matrix.
Throws:
MatrixException

lu

public Matrix[] lu()
            throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates a LU decomposition of the matrix.

Specified by:
lu in interface DecompositionDoubleCalculations
Returns:
LU decomposition of the matrix.
Throws:
MatrixException

chol

public Matrix chol()
            throws MatrixException
Description copied from interface: DecompositionDoubleCalculations
Calculates a Cholesky decomposition of the matrix.

Specified by:
chol in interface DecompositionDoubleCalculations
Returns:
Cholesky decomposition of the matrix.
Throws:
MatrixException

exportToString

public final String exportToString(FileFormat format,
                                   Object... parameters)
                            throws MatrixException,
                                   IOException
Specified by:
exportToString in interface ExportMatrixInterface
Throws:
MatrixException
IOException

setSize

public void setSize(long... size)
Description copied from interface: BasicMatrixProperties
Sets the size of the matrix. This is an optional method that is not implemented for all matrices. If this method is not implemented, a MatrixException is thrown.

Specified by:
setSize in interface BasicMatrixProperties
Parameters:
size - the new size of the matrix

reshape

public final Matrix reshape(Calculation.Ret returnType,
                            long... newSize)
Specified by:
reshape in interface ObjectCalculations

squeeze

public final Matrix squeeze(Calculation.Ret returnType)
Specified by:
squeeze in interface ObjectCalculations

doubleValue

public final double doubleValue()
                         throws MatrixException
Specified by:
doubleValue in interface BasicMatrixProperties
Specified by:
doubleValue in class Number
Throws:
MatrixException

intValue

public final int intValue()
                   throws MatrixException
Specified by:
intValue in interface BasicMatrixProperties
Specified by:
intValue in class Number
Throws:
MatrixException

charValue

public final char charValue()
                     throws MatrixException
Specified by:
charValue in interface BasicMatrixProperties
Throws:
MatrixException

bigIntegerValue

public final BigInteger bigIntegerValue()
                                 throws MatrixException
Specified by:
bigIntegerValue in interface BasicMatrixProperties
Throws:
MatrixException

bigDecimalValue

public final BigDecimal bigDecimalValue()
                                 throws MatrixException
Specified by:
bigDecimalValue in interface BasicMatrixProperties
Throws:
MatrixException

fadeIn

public final Matrix fadeIn(Calculation.Ret ret,
                           int dimension)
                    throws MatrixException
Specified by:
fadeIn in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

fadeOut

public final Matrix fadeOut(Calculation.Ret ret,
                            int dimension)
                     throws MatrixException
Specified by:
fadeOut in interface MiscGeneralDoubleCalculations
Throws:
MatrixException

floatValue

public final float floatValue()
                       throws MatrixException
Specified by:
floatValue in interface BasicMatrixProperties
Specified by:
floatValue in class Number
Throws:
MatrixException

longValue

public final long longValue()
                     throws MatrixException
Specified by:
longValue in interface BasicMatrixProperties
Specified by:
longValue in class Number
Throws:
MatrixException

dateValue

public final Date dateValue()
                     throws MatrixException
Specified by:
dateValue in interface BasicMatrixProperties
Throws:
MatrixException

booleanValue

public final boolean booleanValue()
                           throws MatrixException
Specified by:
booleanValue in interface BasicMatrixProperties
Throws:
MatrixException

stringValue

public final String stringValue()
                         throws MatrixException
Specified by:
stringValue in interface BasicMatrixProperties
Throws:
MatrixException

getRMS

public final double getRMS()
                    throws MatrixException
Specified by:
getRMS in interface BasicMatrixProperties
Throws:
MatrixException

getAnnotation

public final Annotation getAnnotation()
Specified by:
getAnnotation in interface HasAnnotation

setAnnotation

public final void setAnnotation(Annotation annotation)
Specified by:
setAnnotation in interface HasAnnotation

equalsAnnotation

public final boolean equalsAnnotation(Object o)
Specified by:
equalsAnnotation in interface BasicMatrixProperties

equals

public final boolean equals(Object o)
Specified by:
equals in interface BasicMatrixProperties
Overrides:
equals in class Object

equalsContent

public final boolean equalsContent(Object o)
Specified by:
equalsContent in interface BasicMatrixProperties

toBooleanMatrix

public final BooleanMatrix toBooleanMatrix()
Specified by:
toBooleanMatrix in interface Conversions

toByteMatrix

public final ByteMatrix toByteMatrix()
Specified by:
toByteMatrix in interface Conversions

toCharMatrix

public final CharMatrix toCharMatrix()
Specified by:
toCharMatrix in interface Conversions

toDateMatrix

public final DateMatrix toDateMatrix()
Specified by:
toDateMatrix in interface Conversions

toDoubleMatrix

public final DoubleMatrix toDoubleMatrix()
Specified by:
toDoubleMatrix in interface Conversions

toFloatMatrix

public final FloatMatrix toFloatMatrix()
Specified by:
toFloatMatrix in interface Conversions

toIntMatrix

public final IntMatrix toIntMatrix()
Specified by:
toIntMatrix in interface Conversions

toLongMatrix

public final LongMatrix toLongMatrix()
Specified by:
toLongMatrix in interface Conversions

toBigDecimalMatrix

public final BigDecimalMatrix toBigDecimalMatrix()
Specified by:
toBigDecimalMatrix in interface Conversions

toBigIntegerMatrix

public final BigIntegerMatrix toBigIntegerMatrix()
Specified by:
toBigIntegerMatrix in interface Conversions

toObjectMatrix

public final ObjectMatrix toObjectMatrix()
Specified by:
toObjectMatrix in interface Conversions

toShortMatrix

public final ShortMatrix toShortMatrix()
Specified by:
toShortMatrix in interface Conversions

toStringMatrix

public final StringMatrix toStringMatrix()
Specified by:
toStringMatrix in interface Conversions

norm1

public double norm1()
Specified by:
norm1 in interface BasicMatrixProperties

norm2

public double norm2()
Specified by:
norm2 in interface BasicMatrixProperties

normInf

public double normInf()
Specified by:
normInf in interface BasicMatrixProperties

normF

public double normF()
Specified by:
normF in interface BasicMatrixProperties

toListMatrix

public ListMatrix<?> toListMatrix()
Specified by:
toListMatrix in interface Conversions

toSetMatrix

public SetMatrix<?> toSetMatrix()
Specified by:
toSetMatrix in interface Conversions

toMapMatrix

public MapMatrix<?,?> toMapMatrix()
Specified by:
toMapMatrix in interface Conversions

isSparse

public final boolean isSparse()
Specified by:
isSparse in interface BasicMatrixProperties

containsBigInteger

public boolean containsBigInteger(BigInteger v)
Specified by:
containsBigInteger in interface BasicMatrixProperties

containsBigDecimal

public boolean containsBigDecimal(BigDecimal v)
Specified by:
containsBigDecimal in interface BasicMatrixProperties

containsDate

public boolean containsDate(Date v)
Specified by:
containsDate in interface BasicMatrixProperties

containsObject

public boolean containsObject(Object o)
Specified by:
containsObject in interface BasicMatrixProperties

containsString

public boolean containsString(String s)
Specified by:
containsString in interface BasicMatrixProperties

containsBoolean

public boolean containsBoolean(boolean v)
Specified by:
containsBoolean in interface BasicMatrixProperties

containsByte

public boolean containsByte(byte v)
Specified by:
containsByte in interface BasicMatrixProperties

containsChar

public boolean containsChar(char v)
Specified by:
containsChar in interface BasicMatrixProperties

containsDouble

public boolean containsDouble(double v)
Specified by:
containsDouble in interface BasicMatrixProperties

containsFloat

public boolean containsFloat(float v)
Specified by:
containsFloat in interface BasicMatrixProperties

containsInt

public boolean containsInt(int v)
Specified by:
containsInt in interface BasicMatrixProperties

containsLong

public boolean containsLong(long v)
Specified by:
containsLong in interface BasicMatrixProperties

containsShort

public boolean containsShort(short v)
Specified by:
containsShort in interface BasicMatrixProperties

containsNull

public boolean containsNull()
Specified by:
containsNull in interface BasicMatrixProperties

getFactory

public MatrixFactoryRoot getFactory()
Specified by:
getFactory in interface Matrix


Copyright © 2010. All Rights Reserved.