Package org.ujmp.core
Class AbstractMatrix
- java.lang.Object
-
- java.lang.Number
-
- org.ujmp.core.AbstractMatrix
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Matrix>
,HasMetaData
,BaseMatrix
,BooleanCalculations
,CanPerformCalculations
,BasicDoubleCalculations
,DoubleCalculations
,BasicEntrywiseDoubleCalculations
,CreatorDoubleCalculations
,EntrywiseDoubleCalculations
,HyperbolicDoubleCalculations
,MiscEntrywiseDoubleCalculations
,RoundingDoubleCalculations
,TrigonometricDoubleCalculations
,DecompositionDoubleCalculations
,DiscretizeCalculations
,GeneralDoubleCalculations
,MiscGeneralDoubleCalculations
,MissingValueDoubleCalculations
,StatisticalDoubleCalculations
,BaseMatrixProperties
,Clearable
,Conversions
,CoordinateFunctions
,CoreObject
,DistanceMeasures
,ExtendedMatrixProperties
,GettersAndSetters
,HasDescription
,HasGUIObject
,HasId
,HasLabel
,IntCalculations
,Matrix
,ObjectCalculations
,StringCalculations
- Direct Known Subclasses:
AbstractGenericMatrix
public abstract class AbstractMatrix extends java.lang.Number implements Matrix
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected GUIObject
guiObject
private long
id
private MapMatrix<java.lang.String,java.lang.Object>
metaData
private static long
runningId
private static long
serialVersionUID
protected long[]
size
-
Fields inherited from interface org.ujmp.core.BaseMatrix
ALL, COLUMN, LINK, NEW, NONE, ORIG, ROW, X, Y, Z
-
Fields inherited from interface org.ujmp.core.interfaces.HasDescription
DESCRIPTION
-
Fields inherited from interface org.ujmp.core.annotation.HasMetaData
DIMENSIONMETADATA
-
Fields inherited from interface org.ujmp.core.Matrix
chol, divideMatrix, divideScalar, eig, Factory, inv, lu, minusMatrix, minusScalar, mtimes, plusMatrix, plusScalar, qr, solve, svd, timesMatrix, timesScalar, transpose
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMatrix(long[] size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 Matrixjava.lang.Iterable<long[]>
allCoordinates()
Returns an Iterator that goes over all coordinates in the Matrix.java.lang.Iterable<java.lang.Object>
allValues()
Matrix
and(Calculation.Ret returnType, boolean value)
Matrix
and(Calculation.Ret returnType, Matrix matrix)
Matrix
append(Calculation.Ret returnType, int dimension, Matrix... matrices)
Matrix
appendHorizontally(Calculation.Ret returnType, Matrix... matrices)
Matrix
appendVertically(Calculation.Ret returnType, Matrix... matrices)
Matrix
atimes(Calculation.Ret returnType, boolean ignoreNaN, Matrix matrix)
Performs an averaging matrix multiplication on the two matrices.java.math.BigDecimal
bigDecimalValue()
java.math.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.Matrix
clone()
int
compareTo(Matrix m)
boolean
containsBigDecimal(java.math.BigDecimal v)
boolean
containsBigInteger(java.math.BigInteger v)
boolean
containsBoolean(boolean v)
boolean
containsByte(byte v)
boolean
containsChar(char v)
boolean
containsDate(java.util.Date v)
boolean
containsDouble(double v)
boolean
containsFloat(float v)
boolean
containsInt(int v)
boolean
containsLong(long v)
boolean
containsMissingValues()
boolean
containsNull()
boolean
containsObject(java.lang.Object o)
boolean
containsShort(short v)
boolean
containsString(java.lang.String s)
Matrix
convert(ValueType newValueType)
Creates a copy of the matrix with the desired type for matrix entries.Matrix
convertEncoding(Calculation.Ret returnType, java.lang.String encoding)
Matrix
corrcoef(Calculation.Ret returnType, boolean ignoreNaN, boolean besselsCorrection)
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
cosineSimilarity(Calculation.Ret returnType, boolean ignoreNaN)
double
cosineSimilarityTo(Matrix m, boolean ignoreNaN)
Matrix
countMissing(Calculation.Ret returnType, int dimension)
Counts the missing values within the matrix, i.e.Matrix
cov(Calculation.Ret returnType, boolean ignoreNaN, boolean besselsCorrection)
Calculates the covariance Matrix.Matrix
cumprod(boolean ignoreNaN)
Matrix
cumsum(boolean ignoreNaN)
java.util.Date
dateValue()
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, java.lang.String selection)
Deletes rows and columns in the Matrix and returns a link to it.Matrix
delete(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number>... selection)
Delete rows and 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
deleteColumns(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> columns)
Deletes columns in the Matrix and returns a link to it.Matrix
deleteColumnsWithMissingValues(Calculation.Ret returnType)
Matrix
deleteRows(Calculation.Ret returnType, long... rows)
Deletes rows in the Matrix and returns a link to it.Matrix
deleteRows(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> rows)
Deletes rows in the Matrix and returns a link to it.Matrix
deleteRowsWithMissingValues(Calculation.Ret returnType, long threshold)
double
det()
Matrix
diag(Calculation.Ret returnType)
Matrix
diff(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
Matrix
discretize(Calculation.Ret returnType, int dimension, Discretize.DiscretizationMethod method, int numberOfBins)
Matrix
discretize(Calculation.Ret returnType, Dictionary dictionary)
Matrix
discretizeToBoolean(int targetColumnCount)
Matrix
discretizeToColumns(long column)
Matrix
divide(double divisor)
Divides every entry in the matrix by a scalar.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(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, java.lang.Object value)
Matrix
eq(Calculation.Ret returnType, Matrix matrix)
boolean
equals(java.lang.Object o)
boolean
equalsAnnotation(java.lang.Object o)
boolean
equalsContent(java.lang.Object o)
Matrix
euklideanDistance(Calculation.Ret returnType, boolean ignoreNaN)
double
euklideanDistanceTo(Matrix m, boolean ignoreNaN)
Matrix
exp(Calculation.Ret returnType)
Calculates the exponential function for all entries in the Matrix.MatrixExportDestinationSelector
exportTo()
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, java.lang.Object value)
Returns a matrix with equal size, where all entries are set to a desired value.void
fireValueChanged()
This method is used to signal changes in the object to the corresponding GUIObject if it exists.void
fireValueChanged(Coordinates coordinates, java.lang.Object object)
void
fireValueChanged(Coordinates start, Coordinates end)
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()
java.math.BigDecimal
getAsBigDecimal(long... coordinates)
java.math.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.byte[]
getAsByteArray(long... coordinates)
Returns a byte array representation of an entry in the matrix.char
getAsChar(long... coordinates)
Returns a char representation of an entry in the matrix.java.util.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.java.lang.String
getAsString(long... coordinates)
Returns a String representation of an entry in the matrix.long
getColumnCount()
long
getColumnForLabel(java.lang.Object object)
java.lang.String
getColumnLabel(long col)
java.util.List<Matrix>
getColumnList()
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()
java.lang.String
getDescription()
int
getDimensionCount()
java.lang.String
getDimensionLabel(int dimension)
java.lang.Object
getDimensionMetaData(int dimension, long... position)
double
getEuklideanValue()
BaseMatrixFactory<? extends Matrix>
getFactory()
GUIObject
getGUIObject()
Returns an object suitable for displaying on the screen.java.lang.String
getId()
Returns the String id of an object.java.lang.String
getLabel()
Returns the String label of an object.java.lang.Object
getLabelObject()
Returns the label of an object.double
getMaxValue()
double
getMeanValue()
MapMatrix<java.lang.String,java.lang.Object>
getMetaData()
java.lang.Object
getMetaData(java.lang.Object key)
Matrix
getMetaDataDimensionMatrix(int dimension)
double
getMetaDataDouble(java.lang.Object key)
Matrix
getMetaDataMatrix(java.lang.Object key)
java.lang.String
getMetaDataString(java.lang.Object key)
double
getMinValue()
long[]
getPositionForLabel(int dimension, java.lang.Object label)
java.lang.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(java.lang.Object object)
java.lang.String
getRowLabel(long row)
java.util.List<Matrix>
getRowList()
long[]
getSize()
long
getSize(int dimension)
double
getStdValue()
long
getValueCount()
double
getValueSum()
ValueType
getValueType()
long
getZCount()
Matrix
ginv()
Calculates a generalized inverse of the MatrixMatrix
grayScale(Calculation.Ret returnType, GrayScale.ColorChannel colorChannel)
Matrix
gt(Calculation.Ret returnType, double value)
Matrix
gt(Calculation.Ret returnType, Matrix matrix)
MatrixImportSourceSelector
importFrom()
Matrix
impute(Calculation.Ret returnType, Impute.ImputationMethod method, java.lang.Object... parameters)
Replaces missing values with various methodsMatrix
includeAnnotation(Calculation.Ret returnType, int dimension)
Matrix
indexOfMax(Calculation.Ret returnType, int dimension)
Finds the index of the maximum value in the matrixMatrix
indexOfMin(Calculation.Ret returnType, int dimension)
Finds the index of the minimum value in the matrixint
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
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.Matrix
logistic(Calculation.Ret returnType)
Calculates the logistic function for 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.Matrix
manhattenDistance(Calculation.Ret returnType, boolean ignoreNaN)
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.Matrix
minkowskiDistance(Calculation.Ret returnType, double p, boolean ignoreNaN)
double
minkowskiDistanceTo(Matrix m, double p, boolean ignoreNaN)
Matrix
minus(double value)
Subtracts a specified value from all entries in the matrix.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 matricesMatrix
minus(Matrix m)
Calculates the difference of the entries in both matricesMatrix
mtimes(Calculation.Ret returnType, boolean ignoreNaN, Matrix matrix)
Performs a matrix multiplication on the two matrices.Matrix
mtimes(Matrix matrix)
Performs a matrix multiplication on the two matrices.Matrix
mutualInf(Calculation.Ret returnType)
Calculates the mutual information.Matrix
nans(Calculation.Ret ret)
Returns a matrix with equal size, where all entries are set to Double.NaN.Matrix
ne(Calculation.Ret returnType, java.lang.Object value)
Matrix
ne(Calculation.Ret returnType, Matrix matrix)
java.lang.Iterable<long[]>
nonZeroCoordinates()
double
norm1()
double
norm2()
Matrix
normalize(Calculation.Ret returnType, int dimension)
double
normF()
double
normInf()
Matrix
not(Calculation.Ret returnType)
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.double
pdet()
Matrix
pinv()
Calculates the pseudo inverse of the Matrix using Singular Value Decomposition.Matrix
pinv(int k)
Calculates the pseudo inverse of the Matrix using a low rank approximation of the Singular Value Decomposition.Matrix
plus(double value)
Adds a specified value to all entries in the matrix.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 matricesMatrix
plus(Matrix m)
Calculates the sum of the entries in both matricesMatrix
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, java.util.Collection<java.lang.String> words)
Matrix
replace(Calculation.Ret returnType, java.lang.Object search, java.lang.Object replacement)
Replaces matching values in the matrix with another valueMatrix
replaceMissingBy(Matrix matrix)
Matrix
replaceRegex(Calculation.Ret returnType, java.lang.String search, java.lang.String replacement)
Replaces matching text in every entry of the matrix.Matrix
replaceRegex(Calculation.Ret returnType, java.util.regex.Pattern search, java.lang.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.void
save(java.io.File file)
void
save(java.lang.String filename)
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, java.lang.String selection)
Selects rows and columns in the Matrix and returns a link to it.Matrix
select(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number>... selection)
Selects rows and 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.Matrix
selectColumns(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> columns)
Selects columns in the Matrix and returns a link to it.java.lang.Iterable<long[]>
selectedCoordinates(long[]... selection)
Returns an Iterator that goes only over the Coordinates defined by the selection.java.lang.Iterable<long[]>
selectedCoordinates(java.lang.String selection)
Returns an Iterator that goes only over the Coordinates defined by the selection.Matrix
selectRows(Calculation.Ret returnType, long... rows)
Selects rows in the Matrix and returns a link to it.Matrix
selectRows(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> rows)
Selects rows in the Matrix and returns a link to it.void
setAsBigDecimal(java.math.BigDecimal value, long... coordinates)
void
setAsBigInteger(java.math.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
setAsByteArray(byte[] value, long... coordinates)
Sets an entry in the matrix to a byte array.void
setAsChar(char value, long... coordinates)
Sets an entry in the matrix to a char value.void
setAsDate(java.util.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(java.lang.String string, long... coordinates)
Sets an entry in the matrix to a String value.void
setColumnLabel(long col, java.lang.Object label)
Matrix
setContent(Calculation.Ret returnType, Matrix newContent, long... position)
void
setDescription(java.lang.String description)
void
setDimensionLabel(int dimension, java.lang.Object label)
void
setDimensionMetaData(int dimension, java.lang.Object label, long... position)
void
setId(java.lang.String id)
Sets the id of an objectvoid
setLabel(java.lang.Object label)
Sets the label of an objectvoid
setMetaData(java.lang.String key, java.lang.Object value)
void
setMetaData(MapMatrix<java.lang.String,java.lang.Object> metaData)
void
setMetaDataDimensionMatrix(int dimension, Matrix matrix)
void
setRowLabel(long row, java.lang.Object label)
void
setSize(long... size)
Sets the size of the matrix.void
share(int port)
void
share(java.lang.String hostname, int port)
javax.swing.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 = BMatrix
solveSPD(Matrix b)
Solve A*X = BMatrix
solveSymm(Matrix b)
Solve A*X = BMatrix
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, boolean besselsCorrection)
Calculates the standard deviation of all entries in the Matrix either per row, per column, or global.Matrix
stem(Calculation.Ret ret)
java.lang.String
stringValue()
Matrix
subMatrix(Calculation.Ret returnType, long... startAndEndCoordinates)
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[]
svd(int k)
Calculates a low rank approximation of the singular value decomposition of the matrix: A = U*S*V' but considers only the k largest singular values.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()
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(double factor)
Multiplies every entry in the matrix with a scalar.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(Matrix m)
Calculates the entrywise product of the two matrices.java.math.BigDecimal[][]
toBigDecimalArray()
BaseBigDecimalMatrix
toBigDecimalMatrix()
java.math.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)
java.util.Date[][]
toDateArray()
Converts the content of a matrix into a 2-dimensional array of Date values.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()
java.lang.String
toHtml()
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()
java.lang.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()
java.lang.String
toString()
java.lang.String[][]
toStringArray()
Converts the content of a matrix into a 2-dimensional array of Strings.StringMatrix
toStringMatrix()
double
trace()
Matrix
translate(Calculation.Ret returnType, java.lang.String sourceLanguage, java.lang.String targetLanguage)
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, boolean besselsCorrection)
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.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ujmp.core.interfaces.BaseMatrixProperties
isSparse
-
Methods inherited from interface org.ujmp.core.interfaces.CoordinateFunctions
availableCoordinates, containsCoordinates
-
Methods inherited from interface org.ujmp.core.interfaces.ExtendedMatrixProperties
byteValue, shortValue
-
Methods inherited from interface org.ujmp.core.interfaces.GettersAndSetters
getAsObject, setAsObject
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
runningId
private static long runningId
-
guiObject
protected transient GUIObject guiObject
-
size
protected long[] size
-
id
private final long id
-
metaData
private MapMatrix<java.lang.String,java.lang.Object> metaData
-
-
Method Detail
-
getRowList
public java.util.List<Matrix> getRowList()
- Specified by:
getRowList
in interfaceBaseMatrixProperties
-
getColumnList
public java.util.List<Matrix> getColumnList()
- Specified by:
getColumnList
in interfaceBaseMatrixProperties
-
getFactory
public BaseMatrixFactory<? extends Matrix> getFactory()
- Specified by:
getFactory
in interfaceBaseMatrix
-
allCoordinates
public final java.lang.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 interfaceCoordinateFunctions
- Returns:
- Iterable over all coordinates within a Matrix.
-
getCoreObjectId
public final long getCoreObjectId()
- Specified by:
getCoreObjectId
in interfaceCoreObject
-
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 interfaceGettersAndSetters
- 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 interfaceGettersAndSetters
- Parameters:
v
- double valuecoordinates
- location of the entry @
-
getPreferredObject
public final java.lang.Object getPreferredObject(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- object that represents the matrix entry best @
-
getValueType
public ValueType getValueType()
- Specified by:
getValueType
in interfaceBaseMatrixProperties
-
getMetaDataDimensionMatrix
public Matrix getMetaDataDimensionMatrix(int dimension)
- Specified by:
getMetaDataDimensionMatrix
in interfaceHasMetaData
-
getDimensionMetaData
public final java.lang.Object getDimensionMetaData(int dimension, long... position)
- Specified by:
getDimensionMetaData
in interfaceHasMetaData
-
setMetaDataDimensionMatrix
public void setMetaDataDimensionMatrix(int dimension, Matrix matrix)
- Specified by:
setMetaDataDimensionMatrix
in interfaceHasMetaData
-
getDimensionLabel
public final java.lang.String getDimensionLabel(int dimension)
- Specified by:
getDimensionLabel
in interfaceHasMetaData
-
setDimensionMetaData
public final void setDimensionMetaData(int dimension, java.lang.Object label, long... position)
- Specified by:
setDimensionMetaData
in interfaceHasMetaData
-
setDimensionLabel
public final void setDimensionLabel(int dimension, java.lang.Object label)
- Specified by:
setDimensionLabel
in interfaceHasMetaData
-
getGUIObject
public 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 interfaceHasGUIObject
- Returns:
- object suitable for displaying on the screen
-
containsMissingValues
public final boolean containsMissingValues()
- Specified by:
containsMissingValues
in interfaceExtendedMatrixProperties
-
getDimensionCount
public int getDimensionCount()
- Specified by:
getDimensionCount
in interfaceBaseMatrixProperties
-
getEuklideanValue
public final double getEuklideanValue()
- Specified by:
getEuklideanValue
in interfaceExtendedMatrixProperties
-
clone
public Matrix clone()
- Specified by:
clone
in interfaceCoreObject
- Specified by:
clone
in interfaceMatrix
- Overrides:
clone
in classjava.lang.Object
-
select
public final Matrix select(Calculation.Ret returnType, long[]... selection)
Description copied from interface:ObjectCalculations
Selects rows and columns in the Matrix and returns a link to it.- Specified by:
select
in interfaceObjectCalculations
- 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 @
-
save
public void save(java.lang.String filename) throws java.io.IOException
-
save
public void save(java.io.File file) throws java.io.IOException
-
select
public final Matrix select(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number>... selection)
Description copied from interface:ObjectCalculations
Selects rows and columns in the Matrix and returns a link to it.- Specified by:
select
in interfaceObjectCalculations
- 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 @
-
selectRows
public Matrix selectRows(Calculation.Ret returnType, long... rows)
Description copied from interface:ObjectCalculations
Selects rows in the Matrix and returns a link to it.- Specified by:
selectRows
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.rows
- selected rows- Returns:
- Link to original Matrix with desired rows @
-
select
public final Matrix select(Calculation.Ret returnType, java.lang.String selection)
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 interfaceObjectCalculations
- 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 @
-
selectColumns
public Matrix selectColumns(Calculation.Ret returnType, long... columns)
Description copied from interface:ObjectCalculations
Selects columns in the Matrix and returns a link to it.- Specified by:
selectColumns
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.- Returns:
- Link to original Matrix with desired columns @
-
selectRows
public final Matrix selectRows(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> rows)
Description copied from interface:ObjectCalculations
Selects rows in the Matrix and returns a link to it.- Specified by:
selectRows
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.rows
- selected rows- Returns:
- Link to original Matrix with desired rows @
-
selectColumns
public final Matrix selectColumns(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> columns)
Description copied from interface:ObjectCalculations
Selects columns in the Matrix and returns a link to it.- Specified by:
selectColumns
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.columns
- selected columns- Returns:
- Link to original Matrix with desired columns @
-
impute
public Matrix impute(Calculation.Ret returnType, Impute.ImputationMethod method, java.lang.Object... parameters)
Description copied from interface:MissingValueDoubleCalculations
Replaces missing values with various methods- Specified by:
impute
in interfaceMissingValueDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixmethod
- the imputation method to useparameters
- specify a set of parameters if needed- Returns:
- Matrix with missing values replaced @
-
discretize
public Matrix discretize(Calculation.Ret returnType, int dimension, Discretize.DiscretizationMethod method, int numberOfBins)
- Specified by:
discretize
in interfaceDiscretizeCalculations
-
discretize
public Matrix discretize(Calculation.Ret returnType, Dictionary dictionary)
- Specified by:
discretize
in interfaceDiscretizeCalculations
-
discretizeToBoolean
public Matrix discretizeToBoolean(int targetColumnCount)
- Specified by:
discretizeToBoolean
in interfaceDiscretizeCalculations
-
indexOfMax
public Matrix indexOfMax(Calculation.Ret returnType, int dimension)
Description copied from interface:StatisticalDoubleCalculations
Finds the index of the maximum value in the matrix- Specified by:
indexOfMax
in interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculate- Returns:
- Matrix containing the coordinates of the Maximum
-
indexOfMin
public Matrix indexOfMin(Calculation.Ret returnType, int dimension)
Description copied from interface:StatisticalDoubleCalculations
Finds the index of the minimum value in the matrix- Specified by:
indexOfMin
in interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculate- Returns:
- Matrix containing the coordinates of the Minimum
-
standardize
public Matrix standardize(Calculation.Ret returnType, int dimension)
Description copied from interface:MiscGeneralDoubleCalculations
Subtracts the mean from the matrix and divides by the standard deviation.- Specified by:
standardize
in interfaceMiscGeneralDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculate- Returns:
- Matrix with zero mean and unit variance.
-
normalize
public Matrix normalize(Calculation.Ret returnType, int dimension)
- Specified by:
normalize
in interfaceMiscGeneralDoubleCalculations
-
atimes
public Matrix atimes(Calculation.Ret returnType, boolean ignoreNaN, Matrix matrix)
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 interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredmatrix
- the second matrix- Returns:
- Matrix product
-
inv
public Matrix inv()
Description copied from interface:DecompositionDoubleCalculations
Calculates the inverse of the Matrix using either LUDecomposition (for square matrices) or QRDecomposition (otherwise).- Specified by:
inv
in interfaceDecompositionDoubleCalculations
- Returns:
- Inverse of the matrix
-
invSymm
public Matrix invSymm()
Description copied from interface:DecompositionDoubleCalculations
Calculates the inverse of the Matrix using either LUDecomposition (for square matrices) or QRDecomposition (otherwise).- Specified by:
invSymm
in interfaceDecompositionDoubleCalculations
- Returns:
- Inverse of the matrix
-
invSPD
public Matrix invSPD()
Description copied from interface:DecompositionDoubleCalculations
Calculates the inverse of a symmetric positive definite Matrix using Cholesky Decomposition.- Specified by:
invSPD
in interfaceDecompositionDoubleCalculations
- Returns:
- Inverse of the matrix
-
solve
public Matrix solve(Matrix b)
Description copied from interface:DecompositionDoubleCalculations
Solve A*X = B- Specified by:
solve
in interfaceDecompositionDoubleCalculations
- 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 interfaceDecompositionDoubleCalculations
- 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 interfaceDecompositionDoubleCalculations
- Parameters:
b
- right hand side- Returns:
- solution for X if A is square, least squares solution otherwise
-
ginv
public Matrix ginv()
Description copied from interface:DecompositionDoubleCalculations
Calculates a generalized inverse of the Matrix- Specified by:
ginv
in interfaceDecompositionDoubleCalculations
- Returns:
- Pseudo inverse of the Matrix
-
princomp
public Matrix princomp()
Description copied from interface:DecompositionDoubleCalculations
Projects the matrix into the space of the principal components.- Specified by:
princomp
in interfaceDecompositionDoubleCalculations
- Returns:
- Matrix projected on principal components.
-
pinv
public Matrix pinv()
Description copied from interface:DecompositionDoubleCalculations
Calculates the pseudo inverse of the Matrix using Singular Value Decomposition.- Specified by:
pinv
in interfaceDecompositionDoubleCalculations
- Returns:
- Pseudo inverse of the Matrix
-
pinv
public Matrix pinv(int k)
Description copied from interface:DecompositionDoubleCalculations
Calculates the pseudo inverse of the Matrix using a low rank approximation of the Singular Value Decomposition. Considers only the k largest singular values. This speeds up processing for large matrices.- Specified by:
pinv
in interfaceDecompositionDoubleCalculations
- Parameters:
k
- number of singular values to consider- Returns:
- Pseudo inverse of the Matrix
-
center
public Matrix center(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
Description copied from interface:MiscGeneralDoubleCalculations
Subtracts the mean from the matrix.- Specified by:
center
in interfaceMiscGeneralDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculateignoreNaN
- should missing values be ignored- Returns:
- Matrix with zero mean.
-
isResizable
public boolean isResizable()
- Specified by:
isResizable
in interfaceBaseMatrixProperties
-
convert
public final Matrix convert(ValueType newValueType)
Description copied from interface:ObjectCalculations
Creates a copy of the matrix with the desired type for matrix entries.- Specified by:
convert
in interfaceObjectCalculations
- Parameters:
newValueType
- defines the new format of the matrix- Returns:
- Matrix with the same entries in the new format
-
replaceRegex
public final Matrix replaceRegex(Calculation.Ret returnType, java.util.regex.Pattern search, java.lang.String replacement)
Description copied from interface:StringCalculations
Replaces matching text in every entry of the matrix.- Specified by:
replaceRegex
in interfaceStringCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixsearch
- Regular expression pattern to search forreplacement
- Replacement String- Returns:
- matrix with modified entries
-
replace
public final Matrix replace(Calculation.Ret returnType, java.lang.Object search, java.lang.Object replacement)
Description copied from interface:ObjectCalculations
Replaces matching values in the matrix with another value- Specified by:
replace
in interfaceObjectCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixsearch
- Object to search forreplacement
- Object used to replace the original value- Returns:
- matrix with modified entries @
-
replaceRegex
public final Matrix replaceRegex(Calculation.Ret returnType, java.lang.String search, java.lang.String replacement)
Description copied from interface:StringCalculations
Replaces matching text in every entry of the matrix.- Specified by:
replaceRegex
in interfaceStringCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixsearch
- Regular expression to search forreplacement
- Replacement String- Returns:
- matrix with modified entries
-
times
public Matrix times(double factor)
Description copied from interface:BasicDoubleCalculations
Multiplies every entry in the matrix with a scalar.- Specified by:
times
in interfaceBasicDoubleCalculations
- Parameters:
factor
- factor to multiply with- Returns:
- Matrix with all entries multiplied by a factor.
-
tanh
public Matrix tanh()
- Specified by:
tanh
in interfaceHyperbolicDoubleCalculations
-
times
public Matrix times(Matrix m)
Description copied from interface:BasicDoubleCalculations
Calculates the entrywise product of the two matrices.- Specified by:
times
in interfaceBasicDoubleCalculations
- Parameters:
m
- the second matrix- Returns:
- matrix with product of all entries
-
divide
public Matrix divide(Matrix m)
Description copied from interface:BasicDoubleCalculations
Calculates an entrywise division of the two matrices.- Specified by:
divide
in interfaceBasicDoubleCalculations
- Parameters:
m
- the second matrix- Returns:
- matrix with all entries divided by the second matrix's entry.
-
divide
public Matrix divide(double divisor)
Description copied from interface:BasicDoubleCalculations
Divides every entry in the matrix by a scalar.- Specified by:
divide
in interfaceBasicDoubleCalculations
- Parameters:
divisor
- factor by which to divide- Returns:
- Matrix with all entries divided by a factor.
-
divide
public Matrix divide(Calculation.Ret returnType, boolean ignoreNaN, double factor)
Description copied from interface:BasicDoubleCalculations
Divides every entry in the matrix by a scalar.- Specified by:
divide
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredfactor
- factor by which to divide- Returns:
- Matrix with all entries divided by a factor.
-
times
public Matrix times(Calculation.Ret returnType, boolean ignoreNaN, double factor)
Description copied from interface:BasicDoubleCalculations
Multiplies every entry in the matrix with a scalar.- Specified by:
times
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredfactor
- factor to multiply with- Returns:
- Matrix with all entries multiplied by a factor.
-
times
public Matrix times(Calculation.Ret returnType, boolean ignoreNaN, Matrix factor)
Description copied from interface:BasicDoubleCalculations
Multiplies every entry in the matrix with the entries of another Matrix.- Specified by:
times
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredfactor
- factor to multiply with- Returns:
- Matrix with all entries multiplied by a factor.
-
divide
public Matrix divide(Calculation.Ret returnType, boolean ignoreNaN, Matrix factor)
Description copied from interface:BasicDoubleCalculations
Divides every entry in the matrix by the entries of another matrix.- Specified by:
divide
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredfactor
- factor by which to divide- Returns:
- Matrix with all entries divided by a factor.
-
power
public final Matrix power(Calculation.Ret returnType, double power)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates this matrix to the power of the given value (entrywise).- Specified by:
power
in interfaceBasicEntrywiseDoubleCalculations
- 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.
-
power
public final Matrix power(Calculation.Ret returnType, Matrix power)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates this matrix to the power of the given matrix (entrywise).- Specified by:
power
in interfaceBasicEntrywiseDoubleCalculations
- 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.
-
gt
public final Matrix gt(Calculation.Ret returnType, Matrix matrix)
- Specified by:
gt
in interfaceBooleanCalculations
-
gt
public final Matrix gt(Calculation.Ret returnType, double value)
- Specified by:
gt
in interfaceBooleanCalculations
-
and
public final Matrix and(Calculation.Ret returnType, Matrix matrix)
- Specified by:
and
in interfaceBooleanCalculations
-
and
public final Matrix and(Calculation.Ret returnType, boolean value)
- Specified by:
and
in interfaceBooleanCalculations
-
or
public final Matrix or(Calculation.Ret returnType, Matrix matrix)
- Specified by:
or
in interfaceBooleanCalculations
-
or
public final Matrix or(Calculation.Ret returnType, boolean value)
- Specified by:
or
in interfaceBooleanCalculations
-
xor
public final Matrix xor(Calculation.Ret returnType, Matrix matrix)
- Specified by:
xor
in interfaceBooleanCalculations
-
xor
public final Matrix xor(Calculation.Ret returnType, boolean value)
- Specified by:
xor
in interfaceBooleanCalculations
-
not
public final Matrix not(Calculation.Ret returnType)
- Specified by:
not
in interfaceBooleanCalculations
-
lt
public final Matrix lt(Calculation.Ret returnType, Matrix matrix)
- Specified by:
lt
in interfaceBooleanCalculations
-
lt
public final Matrix lt(Calculation.Ret returnType, double value)
- Specified by:
lt
in interfaceBooleanCalculations
-
ge
public final Matrix ge(Calculation.Ret returnType, Matrix matrix)
- Specified by:
ge
in interfaceBooleanCalculations
-
ge
public final Matrix ge(Calculation.Ret returnType, double value)
- Specified by:
ge
in interfaceBooleanCalculations
-
le
public final Matrix le(Calculation.Ret returnType, Matrix matrix)
- Specified by:
le
in interfaceBooleanCalculations
-
le
public final Matrix le(Calculation.Ret returnType, double value)
- Specified by:
le
in interfaceBooleanCalculations
-
eq
public final Matrix eq(Calculation.Ret returnType, Matrix matrix)
- Specified by:
eq
in interfaceBooleanCalculations
-
eq
public final Matrix eq(Calculation.Ret returnType, java.lang.Object value)
- Specified by:
eq
in interfaceBooleanCalculations
-
ne
public final Matrix ne(Calculation.Ret returnType, Matrix matrix)
- Specified by:
ne
in interfaceBooleanCalculations
-
ne
public final Matrix ne(Calculation.Ret returnType, java.lang.Object value)
- Specified by:
ne
in interfaceBooleanCalculations
-
getValueCount
public long getValueCount()
- Specified by:
getValueCount
in interfaceBaseMatrixProperties
-
getCoordinatesOfMaximum
public final long[] getCoordinatesOfMaximum()
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 interfaceCoordinateFunctions
- Returns:
- Coordinates of the maximum value @
-
getCoordinatesOfMinimum
public final long[] getCoordinatesOfMinimum()
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 interfaceCoordinateFunctions
- Returns:
- Coordinates of the minimum value @
-
selectedCoordinates
public java.lang.Iterable<long[]> selectedCoordinates(java.lang.String selection)
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 interfaceCoordinateFunctions
- Parameters:
selection
- The String defining the selection of rows or columns- Returns:
- Iterable over the desired Coordinates
-
selectedCoordinates
public java.lang.Iterable<long[]> selectedCoordinates(long[]... selection)
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 interfaceCoordinateFunctions
- Parameters:
selection
- A list of long arrays defining the desired rows or columns- Returns:
- Iterable over the desired Coordinates @
-
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interfaceBaseMatrixProperties
-
nonZeroCoordinates
public java.lang.Iterable<long[]> nonZeroCoordinates()
- Specified by:
nonZeroCoordinates
in interfaceCoordinateFunctions
-
toDoubleArray
public double[][] toDoubleArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of double values.- Specified by:
toDoubleArray
in interfaceGettersAndSetters
- Returns:
- double array with matrix entries @
-
toObjectArray
public java.lang.Object[][] toObjectArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of Objects.- Specified by:
toObjectArray
in interfaceGettersAndSetters
- Returns:
- Object array with matrix entries @
-
toIntArray
public int[][] toIntArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of int values.- Specified by:
toIntArray
in interfaceGettersAndSetters
- Returns:
- int array with matrix entries @
-
toLongArray
public long[][] toLongArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of long values.- Specified by:
toLongArray
in interfaceGettersAndSetters
- Returns:
- long array with matrix entries @
-
toShortArray
public short[][] toShortArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of short values.- Specified by:
toShortArray
in interfaceGettersAndSetters
- Returns:
- short array with matrix entries @
-
toCharArray
public char[][] toCharArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of char values.- Specified by:
toCharArray
in interfaceGettersAndSetters
- Returns:
- char array with matrix entries @
-
toStringArray
public java.lang.String[][] toStringArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of Strings.- Specified by:
toStringArray
in interfaceGettersAndSetters
- Returns:
- String array with matrix entries @
-
toByteArray
public byte[][] toByteArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of byte values.- Specified by:
toByteArray
in interfaceGettersAndSetters
- Returns:
- byte array with matrix entries @
-
toBooleanArray
public boolean[][] toBooleanArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of boolean values.- Specified by:
toBooleanArray
in interfaceGettersAndSetters
- Returns:
- boolean array with matrix entries @
-
toFloatArray
public float[][] toFloatArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of float values.- Specified by:
toFloatArray
in interfaceGettersAndSetters
- Returns:
- float array with matrix entries @
-
toDateArray
public java.util.Date[][] toDateArray()
Description copied from interface:GettersAndSetters
Converts the content of a matrix into a 2-dimensional array of Date values.- Specified by:
toDateArray
in interfaceGettersAndSetters
- Returns:
- Date array with matrix entries @
-
toBigDecimalArray
public java.math.BigDecimal[][] toBigDecimalArray()
- Specified by:
toBigDecimalArray
in interfaceGettersAndSetters
-
toBigIntegerArray
public java.math.BigInteger[][] toBigIntegerArray()
- Specified by:
toBigIntegerArray
in interfaceGettersAndSetters
-
sqrt
public final Matrix sqrt(Calculation.Ret returnType)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates the square root of all the entries in a Matrix.- Specified by:
sqrt
in interfaceBasicEntrywiseDoubleCalculations
- 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
-
round
public final Matrix round(Calculation.Ret returnType)
Description copied from interface:RoundingDoubleCalculations
Returns a matrix with all entries rounded to integer values.- Specified by:
round
in interfaceRoundingDoubleCalculations
- 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
-
ceil
public final Matrix ceil(Calculation.Ret returnType)
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 interfaceRoundingDoubleCalculations
- 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
-
extractAnnotation
public final Matrix extractAnnotation(Calculation.Ret returnType, int dimension)
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 interfaceObjectCalculations
- Parameters:
returnType
- Specify whether to return a new matrix, or a linkdimension
- Which axis should be shortened to extract the labels. E.g. if you want column labels, you must specifyMatrix.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 specifyMatrix.ALL
or omit the dimensions parameter.- Returns:
- new Matrix with annotation generated from content. @
-
includeAnnotation
public final Matrix includeAnnotation(Calculation.Ret returnType, int dimension)
- Specified by:
includeAnnotation
in interfaceObjectCalculations
-
floor
public final Matrix floor(Calculation.Ret returnType)
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 interfaceRoundingDoubleCalculations
- 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
-
showGUI
public final javax.swing.JFrame showGUI()
Description copied from interface:HasGUIObject
This method will show the object in a JFrame on the screen.- Specified by:
showGUI
in interfaceHasGUIObject
-
fireValueChanged
public void fireValueChanged()
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:
fireValueChanged
in interfaceHasGUIObject
- Specified by:
fireValueChanged
in interfaceMatrix
-
fireValueChanged
public void fireValueChanged(Coordinates coordinates, java.lang.Object object)
- Specified by:
fireValueChanged
in interfaceMatrix
-
fireValueChanged
public void fireValueChanged(Coordinates start, Coordinates end)
- Specified by:
fireValueChanged
in interfaceMatrix
-
mtimes
public Matrix mtimes(Matrix matrix)
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 interfaceBasicDoubleCalculations
- Parameters:
matrix
- the second matrix- Returns:
- Matrix product
-
mtimes
public Matrix mtimes(Calculation.Ret returnType, boolean ignoreNaN, Matrix matrix)
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 interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredmatrix
- the second matrix- Returns:
- Matrix product
-
getAsBoolean
public boolean getAsBoolean(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a boolean representation of the entry @
-
setAsBoolean
public void setAsBoolean(boolean value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- boolean valuecoordinates
- location of the entry @
-
getAsInt
public int getAsInt(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- an int representation of the entry @
-
setAsInt
public void setAsInt(int value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- int valuecoordinates
- location of the entry @
-
getAsByte
public byte getAsByte(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a byte representation of the entry @
-
getAsByteArray
public byte[] getAsByteArray(long... coordinates)
Description copied from interface:GettersAndSetters
Returns a byte array representation of an entry in the matrix. The stored value will be converted to a byte array as good as possible.- Specified by:
getAsByteArray
in interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a byte array representation of the entry @
-
setAsByteArray
public void setAsByteArray(byte[] value, long... coordinates)
Description copied from interface:GettersAndSetters
Sets an entry in the matrix to a byte array. If the matrix cannot store byte array, the value will be represented as good as possible.- Specified by:
setAsByteArray
in interfaceGettersAndSetters
- Parameters:
value
- byte arraycoordinates
- location of the entry @
-
setAsByte
public void setAsByte(byte value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- byte valuecoordinates
- location of the entry @
-
getAsChar
public char getAsChar(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a char representation of the entry @
-
getAsBigInteger
public java.math.BigInteger getAsBigInteger(long... coordinates)
- Specified by:
getAsBigInteger
in interfaceGettersAndSetters
-
getAsBigDecimal
public java.math.BigDecimal getAsBigDecimal(long... coordinates)
- Specified by:
getAsBigDecimal
in interfaceGettersAndSetters
-
setAsChar
public void setAsChar(char value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- char valuecoordinates
- location of the entry @
-
setAsBigDecimal
public void setAsBigDecimal(java.math.BigDecimal value, long... coordinates)
- Specified by:
setAsBigDecimal
in interfaceGettersAndSetters
-
setAsBigInteger
public void setAsBigInteger(java.math.BigInteger value, long... coordinates)
- Specified by:
setAsBigInteger
in interfaceGettersAndSetters
-
getAsFloat
public float getAsFloat(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a float representation of the entry @
-
setAsFloat
public void setAsFloat(float value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- float valuecoordinates
- location of the entry @
-
getAsShort
public short getAsShort(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a short representation of the entry @
-
getAsMatrix
public Matrix getAsMatrix(long... coordinates)
- Specified by:
getAsMatrix
in interfaceGettersAndSetters
-
setAsMatrix
public void setAsMatrix(Matrix m, long... coordinates)
- Specified by:
setAsMatrix
in interfaceGettersAndSetters
-
setAsShort
public void setAsShort(short value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- short valuecoordinates
- location of the entry @
-
getAsLong
public long getAsLong(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a long representation of the entry @
-
setAsLong
public void setAsLong(long value, long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
value
- long valuecoordinates
- location of the entry @
-
getAsDate
public java.util.Date getAsDate(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a String representation of the entry @
-
setAsDate
public void setAsDate(java.util.Date date, long... coordinates)
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 interfaceGettersAndSetters
coordinates
- location of the entry @
-
delete
public final Matrix delete(Calculation.Ret returnType, java.lang.String selection)
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 interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.- Returns:
- Link to original Matrix with desired rows and columns deleted @
-
delete
public final Matrix delete(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number>... selection)
Description copied from interface:ObjectCalculations
Delete rows and columns in the Matrix and returns a link to it.- Specified by:
delete
in interfaceObjectCalculations
- 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 @
-
delete
public final Matrix delete(Calculation.Ret returnType, long[]... selection)
Description copied from interface:ObjectCalculations
Delete rows and columns in the Matrix and returns a link to it.- Specified by:
delete
in interfaceObjectCalculations
- 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 @
-
deleteRows
public final Matrix deleteRows(Calculation.Ret returnType, long... rows)
Description copied from interface:ObjectCalculations
Deletes rows in the Matrix and returns a link to it.- Specified by:
deleteRows
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.rows
- selected rows- Returns:
- Link to original Matrix with desired rows @
-
deleteRows
public final Matrix deleteRows(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> rows)
Description copied from interface:ObjectCalculations
Deletes rows in the Matrix and returns a link to it.- Specified by:
deleteRows
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.rows
- selected rows- Returns:
- Link to original Matrix with desired rows @
-
deleteColumns
public final Matrix deleteColumns(Calculation.Ret returnType, java.util.Collection<? extends java.lang.Number> columns)
Description copied from interface:ObjectCalculations
Deletes columns in the Matrix and returns a link to it.- Specified by:
deleteColumns
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.columns
- selected columns- Returns:
- Link to original Matrix with desired columns @
-
deleteColumns
public final Matrix deleteColumns(Calculation.Ret returnType, long... columns)
Description copied from interface:ObjectCalculations
Deletes columns in the Matrix and returns a link to it.- Specified by:
deleteColumns
in interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.- Returns:
- Link to original Matrix with desired columns @
-
minus
public Matrix minus(Calculation.Ret returnType, boolean ignoreNaN, double v)
Description copied from interface:BasicDoubleCalculations
Subtracts a specified value from all entries in the matrix.- Specified by:
minus
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredv
- the value to subtract- Returns:
- Matrix with the entries minus the value
-
minus
public Matrix minus(Calculation.Ret returnType, boolean ignoreNaN, Matrix m)
Description copied from interface:BasicDoubleCalculations
Calculates the difference of the entries in both matrices- Specified by:
minus
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredm
- The matrix to subtract- Returns:
- matrix with difference values
-
plus
public Matrix plus(Calculation.Ret returnType, boolean ignoreNaN, double v)
Description copied from interface:BasicDoubleCalculations
Adds a specified value from all entries in the matrix.- Specified by:
plus
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredv
- the value to subtract- Returns:
- Matrix with the entries plus the value
-
plus
public Matrix plus(Calculation.Ret returnType, boolean ignoreNaN, Matrix m)
Description copied from interface:BasicDoubleCalculations
Calculates the sum of the entries in both matrices- Specified by:
plus
in interfaceBasicDoubleCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.ignoreNaN
- should missing values be ignoredm
- The matrix to subtract- Returns:
- matrix with sum values
-
transpose
public Matrix transpose()
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 interfaceObjectCalculations
- Returns:
- transposed Matrix.
-
transpose
public Matrix transpose(Calculation.Ret returnType)
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 interfaceObjectCalculations
- Parameters:
returnType
- Defines if a new Matrix or a link should be returned.- Returns:
- transposed Matrix.
-
diag
public Matrix diag(Calculation.Ret returnType)
- Specified by:
diag
in interfaceObjectCalculations
-
mean
public Matrix mean(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
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 interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculateignoreNaN
- should missing values be ignored- Returns:
- Matrix with the sum of the values along the desired axis
-
var
public Matrix var(Calculation.Ret returnType, int dimension, boolean ignoreNaN, boolean besselsCorrection)
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 interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculateignoreNaN
- should missing values be ignoredbesselsCorrection
- use (n-1) instead of n- Returns:
- Matrix with the sum of the values along the desired axis
-
std
public Matrix std(Calculation.Ret returnType, int dimension, boolean ignoreNaN, boolean besselsCorrection)
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 interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculateignoreNaN
- should missing values be ignoredbesselsCorrection
- use (n-1) instead of n- Returns:
- Matrix with the sum of the values along the desired axis
-
getColumnCount
public long getColumnCount()
- Specified by:
getColumnCount
in interfaceBaseMatrixProperties
-
getRowCount
public long getRowCount()
- Specified by:
getRowCount
in interfaceBaseMatrixProperties
-
getZCount
public long getZCount()
- Specified by:
getZCount
in interfaceBaseMatrixProperties
-
getSize
public final long getSize(int dimension)
- Specified by:
getSize
in interfaceBaseMatrixProperties
-
getSize
public long[] getSize()
- Specified by:
getSize
in interfaceBaseMatrixProperties
-
prod
public Matrix prod(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
- Specified by:
prod
in interfaceStatisticalDoubleCalculations
-
diff
public Matrix diff(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
- Specified by:
diff
in interfaceStatisticalDoubleCalculations
-
sum
public final Matrix sum(Calculation.Ret returnType, int dimension, boolean ignoreNaN)
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 interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculateignoreNaN
- should missing values be ignored- Returns:
- Matrix with the sum of the values along the desired axis
-
sign
public final Matrix sign(Calculation.Ret returnType)
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 interfaceBasicEntrywiseDoubleCalculations
- 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
-
toString
public java.lang.String toString()
- Specified by:
toString
in interfaceBaseMatrixProperties
- Overrides:
toString
in classjava.lang.Object
-
ones
public final Matrix ones(Calculation.Ret ret)
Description copied from interface:CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to 1.0.- Specified by:
ones
in interfaceCreatorDoubleCalculations
- Returns:
- Matrix with ones.
-
nans
public final Matrix nans(Calculation.Ret ret)
Description copied from interface:CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to Double.NaN.- Specified by:
nans
in interfaceCreatorDoubleCalculations
- Returns:
- Matrix with NaNs.
-
fill
public final Matrix fill(Calculation.Ret ret, java.lang.Object value)
Description copied from interface:ObjectCalculations
Returns a matrix with equal size, where all entries are set to a desired value.- Specified by:
fill
in interfaceObjectCalculations
value
- fill with this value- Returns:
- Matrix with ones.
-
zeros
public final Matrix zeros(Calculation.Ret ret)
Description copied from interface:CreatorDoubleCalculations
Returns a matrix with equal size, where all entries are set to zero.- Specified by:
zeros
in interfaceCreatorDoubleCalculations
- Returns:
- Matrix with zeros.
-
eye
public final Matrix eye(Calculation.Ret ret)
Description copied from interface:CreatorDoubleCalculations
Returns a matrix with ones at the diagonal.- Specified by:
eye
in interfaceCreatorDoubleCalculations
- Returns:
- Eye matrix with ones at the diagonal
-
plus
public Matrix plus(double value)
Description copied from interface:BasicDoubleCalculations
Adds a specified value to all entries in the matrix.- Specified by:
plus
in interfaceBasicDoubleCalculations
- Parameters:
value
- the value to add- Returns:
- Matrix with the entries plus the value
-
plus
public Matrix plus(Matrix m)
Description copied from interface:BasicDoubleCalculations
Calculates the sum of the entries in both matrices- Specified by:
plus
in interfaceBasicDoubleCalculations
- Parameters:
m
- The matrix to add- Returns:
- matrix with sum values
-
minus
public Matrix minus(double value)
Description copied from interface:BasicDoubleCalculations
Subtracts a specified value from all entries in the matrix.- Specified by:
minus
in interfaceBasicDoubleCalculations
- Parameters:
value
- the value to subtract- Returns:
- Matrix with the entries minus the value
-
minus
public Matrix minus(Matrix m)
Description copied from interface:BasicDoubleCalculations
Calculates the difference of the entries in both matrices- Specified by:
minus
in interfaceBasicDoubleCalculations
- Parameters:
m
- The matrix to subtract- Returns:
- matrix with difference values
-
rand
public final Matrix rand(Calculation.Ret ret)
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 interfaceCreatorDoubleCalculations
- Returns:
- Matrix with uniformly distributed values.
-
randn
public final Matrix randn(Calculation.Ret ret)
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 interfaceCreatorDoubleCalculations
- Returns:
- Matrix with normally distributed values.
-
compareTo
public int compareTo(Matrix m)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Matrix>
-
rank
public int rank()
- Specified by:
rank
in interfaceExtendedMatrixProperties
-
isSPD
public final boolean isSPD()
- Specified by:
isSPD
in interfaceExtendedMatrixProperties
-
isSymmetric
public final boolean isSymmetric()
- Specified by:
isSymmetric
in interfaceBaseMatrixProperties
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceBaseMatrixProperties
-
abs
public final Matrix abs(Calculation.Ret returnType)
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 interfaceBasicEntrywiseDoubleCalculations
- 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.
-
log
public final Matrix log(Calculation.Ret returnType)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates the natural logarithm of all entries in the Matrix.- Specified by:
log
in interfaceBasicEntrywiseDoubleCalculations
- 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.
-
setContent
public final Matrix setContent(Calculation.Ret returnType, Matrix newContent, long... position)
- Specified by:
setContent
in interfaceExtendedMatrixProperties
-
exp
public final Matrix exp(Calculation.Ret returnType)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates the exponential function for all entries in the Matrix.- Specified by:
exp
in interfaceBasicEntrywiseDoubleCalculations
- 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.
-
logistic
public final Matrix logistic(Calculation.Ret returnType)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates the logistic function for all entries in the Matrix.- Specified by:
logistic
in interfaceBasicEntrywiseDoubleCalculations
- 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 1/(1+exp(-x)) values.
-
sortrows
public final Matrix sortrows(Calculation.Ret returnType, long column, boolean reverse)
- Specified by:
sortrows
in interfaceObjectCalculations
-
cumsum
public final Matrix cumsum(boolean ignoreNaN)
- Specified by:
cumsum
in interfaceStatisticalDoubleCalculations
-
cumprod
public final Matrix cumprod(boolean ignoreNaN)
- Specified by:
cumprod
in interfaceStatisticalDoubleCalculations
-
log2
public final Matrix log2(Calculation.Ret returnType)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates the logarithm with basis 2 of all entries in the Matrix.- Specified by:
log2
in interfaceBasicEntrywiseDoubleCalculations
- 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.
-
log10
public final Matrix log10(Calculation.Ret returnType)
Description copied from interface:BasicEntrywiseDoubleCalculations
Calculates the logarithm with basis 10 of all entries in the Matrix.- Specified by:
log10
in interfaceBasicEntrywiseDoubleCalculations
- 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.
-
isDiagonal
public final boolean isDiagonal()
- Specified by:
isDiagonal
in interfaceBaseMatrixProperties
-
isSquare
public final boolean isSquare()
- Specified by:
isSquare
in interfaceBaseMatrixProperties
-
euklideanDistanceTo
public double euklideanDistanceTo(Matrix m, boolean ignoreNaN)
- Specified by:
euklideanDistanceTo
in interfaceDistanceMeasures
-
det
public double det()
- Specified by:
det
in interfaceExtendedMatrixProperties
-
pdet
public double pdet()
- Specified by:
pdet
in interfaceExtendedMatrixProperties
-
isSingular
public boolean isSingular()
- Specified by:
isSingular
in interfaceBaseMatrixProperties
-
manhattenDistanceTo
public double manhattenDistanceTo(Matrix m, boolean ignoreNaN)
- Specified by:
manhattenDistanceTo
in interfaceDistanceMeasures
-
manhattenDistance
public Matrix manhattenDistance(Calculation.Ret returnType, boolean ignoreNaN)
- Specified by:
manhattenDistance
in interfaceDistanceMeasures
-
euklideanDistance
public Matrix euklideanDistance(Calculation.Ret returnType, boolean ignoreNaN)
- Specified by:
euklideanDistance
in interfaceDistanceMeasures
-
minkowskiDistance
public final Matrix minkowskiDistance(Calculation.Ret returnType, double p, boolean ignoreNaN)
- Specified by:
minkowskiDistance
in interfaceDistanceMeasures
-
cosineSimilarity
public final Matrix cosineSimilarity(Calculation.Ret returnType, boolean ignoreNaN)
- Specified by:
cosineSimilarity
in interfaceDistanceMeasures
-
cosineSimilarityTo
public double cosineSimilarityTo(Matrix m, boolean ignoreNaN)
- Specified by:
cosineSimilarityTo
in interfaceDistanceMeasures
-
minkowskiDistanceTo
public double minkowskiDistanceTo(Matrix m, double p, boolean ignoreNaN)
- Specified by:
minkowskiDistanceTo
in interfaceDistanceMeasures
-
chebyshevDistanceTo
public double chebyshevDistanceTo(Matrix m, boolean ignoreNaN)
- Specified by:
chebyshevDistanceTo
in interfaceDistanceMeasures
-
min
public Matrix min(Calculation.Ret returnType, int dimension)
Description copied from interface:StatisticalDoubleCalculations
Calculates the mimimum of the values in the matrix either rowwise, columnwise, or global.- Specified by:
min
in interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- the axis along which should be calculated, e.g. ROW=0, COLUMN=1 or ALL- Returns:
- A new matrix containing the minimum values
-
max
public Matrix max(Calculation.Ret returnType, int dimension)
Description copied from interface:StatisticalDoubleCalculations
Calculates the maximum of the values in the matrix either rowwise, columnwise, or global.- Specified by:
max
in interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- the axis along which should be calculated, e.g. ROW=0, COLUMN=1 or ALL- Returns:
- A new matrix containing the maximum values
-
addMissing
public final Matrix addMissing(Calculation.Ret returnType, int dimension, double... percentMissing)
Description copied from interface:MissingValueDoubleCalculations
Adds a specified amount of missing values (Double.NaN) to the Matrix- Specified by:
addMissing
in interfaceMissingValueDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculatepercentMissing
- defines how many values are missing 0.0 to 1.0- Returns:
- Matrix with missing values @
-
countMissing
public Matrix countMissing(Calculation.Ret returnType, int dimension)
Description copied from interface:MissingValueDoubleCalculations
Counts the missing values within the matrix, i.e. Infinity or NaN- Specified by:
countMissing
in interfaceMissingValueDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original Matrixdimension
- The axis along which to calculate- Returns:
- Matrix with counts of missing values @
-
isScalar
public final boolean isScalar()
- Specified by:
isScalar
in interfaceBaseMatrixProperties
-
isRowVector
public final boolean isRowVector()
- Specified by:
isRowVector
in interfaceBaseMatrixProperties
-
isColumnVector
public final boolean isColumnVector()
- Specified by:
isColumnVector
in interfaceBaseMatrixProperties
-
isMultidimensionalMatrix
public final boolean isMultidimensionalMatrix()
- Specified by:
isMultidimensionalMatrix
in interfaceBaseMatrixProperties
-
sinh
public Matrix sinh(Calculation.Ret returnType)
Description copied from interface:HyperbolicDoubleCalculations
Calculates the hyperbolic sinus of all entries in the matrix.- Specified by:
sinh
in interfaceHyperbolicDoubleCalculations
- 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
-
cosh
public Matrix cosh(Calculation.Ret returnType)
Description copied from interface:HyperbolicDoubleCalculations
Calculates the hyperbolic cosinus of all entries in the matrix.- Specified by:
cosh
in interfaceHyperbolicDoubleCalculations
- 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
-
tanh
public Matrix tanh(Calculation.Ret returnType)
Description copied from interface:HyperbolicDoubleCalculations
Calculates the hyperbolic tangens of all entries in the matrix.- Specified by:
tanh
in interfaceHyperbolicDoubleCalculations
- 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
-
sin
public Matrix sin(Calculation.Ret returnType)
Description copied from interface:TrigonometricDoubleCalculations
Calculates the sinus of all entries in the matrix.- Specified by:
sin
in interfaceTrigonometricDoubleCalculations
- 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
-
cos
public Matrix cos(Calculation.Ret returnType)
Description copied from interface:TrigonometricDoubleCalculations
Calculates the cosinus of all entries in the matrix.- Specified by:
cos
in interfaceTrigonometricDoubleCalculations
- 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
-
tril
public Matrix tril(Calculation.Ret returnType, int k)
- Specified by:
tril
in interfaceObjectCalculations
-
triu
public Matrix triu(Calculation.Ret returnType, int k)
- Specified by:
triu
in interfaceObjectCalculations
-
tan
public Matrix tan(Calculation.Ret returnType)
Description copied from interface:TrigonometricDoubleCalculations
Calculates the tangens of all entries in the matrix.- Specified by:
tan
in interfaceTrigonometricDoubleCalculations
- 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
-
cov
public Matrix cov(Calculation.Ret returnType, boolean ignoreNaN, boolean besselsCorrection)
Description copied from interface:StatisticalDoubleCalculations
Calculates the covariance Matrix. Each row is an observation and each column is a variable.- Specified by:
cov
in interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original MatrixignoreNaN
- should missing values be ignoredbesselsCorrection
- use (n-1) instead of n- Returns:
- Covariance Matrix
-
corrcoef
public Matrix corrcoef(Calculation.Ret returnType, boolean ignoreNaN, boolean besselsCorrection)
Description copied from interface:StatisticalDoubleCalculations
Calculates the Pearson correlation. Each row is an observation and each column is a variable.- Specified by:
corrcoef
in interfaceStatisticalDoubleCalculations
- Parameters:
returnType
- Select whether a new or a linked Matrix is returned, or if the operation is performed on the original MatrixignoreNaN
- should missing values be ignoredbesselsCorrection
- use (n-1) instead of n- Returns:
- Covariance Matrix
-
mutualInf
public Matrix mutualInf(Calculation.Ret returnType)
Description copied from interface:StatisticalDoubleCalculations
Calculates the mutual information. Each row is an observation and each column is a variable.- Specified by:
mutualInf
in interfaceStatisticalDoubleCalculations
- 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
-
pairedTTest
public Matrix pairedTTest(Calculation.Ret returnType)
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 interfaceStatisticalDoubleCalculations
- 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
-
bootstrap
public Matrix bootstrap(Calculation.Ret returnType)
- Specified by:
bootstrap
in interfaceObjectCalculations
-
grayScale
public Matrix grayScale(Calculation.Ret returnType, GrayScale.ColorChannel colorChannel)
- Specified by:
grayScale
in interfaceMiscEntrywiseDoubleCalculations
-
translate
public Matrix translate(Calculation.Ret returnType, java.lang.String sourceLanguage, java.lang.String targetLanguage)
- Specified by:
translate
in interfaceStringCalculations
-
lowerCase
public Matrix lowerCase(Calculation.Ret returnType)
- Specified by:
lowerCase
in interfaceStringCalculations
-
upperCase
public Matrix upperCase(Calculation.Ret returnType)
- Specified by:
upperCase
in interfaceStringCalculations
-
convertEncoding
public Matrix convertEncoding(Calculation.Ret returnType, java.lang.String encoding)
- Specified by:
convertEncoding
in interfaceStringCalculations
-
tfIdf
public Matrix tfIdf(boolean calculateTf, boolean calculateIdf, boolean normalize)
- Specified by:
tfIdf
in interfaceStringCalculations
-
removePunctuation
public Matrix removePunctuation(Calculation.Ret ret)
- Specified by:
removePunctuation
in interfaceStringCalculations
-
stem
public Matrix stem(Calculation.Ret ret)
- Specified by:
stem
in interfaceStringCalculations
-
removeWords
public Matrix removeWords(Calculation.Ret ret, java.util.Collection<java.lang.String> words)
- Specified by:
removeWords
in interfaceStringCalculations
-
unique
public Matrix unique(Calculation.Ret returnType)
- Specified by:
unique
in interfaceObjectCalculations
-
uniqueValueCount
public Matrix uniqueValueCount(Calculation.Ret returnType, int dimension)
- Specified by:
uniqueValueCount
in interfaceObjectCalculations
-
bootstrap
public Matrix bootstrap(Calculation.Ret returnType, int count)
- Specified by:
bootstrap
in interfaceObjectCalculations
-
transpose
public Matrix transpose(Calculation.Ret returnType, int dimension1, int dimension2)
- Specified by:
transpose
in interfaceObjectCalculations
-
swap
public Matrix swap(Calculation.Ret returnType, int dimension, long pos1, long pos2)
- Specified by:
swap
in interfaceObjectCalculations
-
flipdim
public Matrix flipdim(Calculation.Ret returnType, int dimension)
- Specified by:
flipdim
in interfaceObjectCalculations
-
shuffle
public final Matrix shuffle(Calculation.Ret returnType)
- Specified by:
shuffle
in interfaceObjectCalculations
-
trace
public final double trace()
- Specified by:
trace
in interfaceExtendedMatrixProperties
-
setLabel
public void setLabel(java.lang.Object label)
Description copied from interface:HasLabel
Sets the label of an object
-
getLabel
public final java.lang.String getLabel()
Description copied from interface:HasLabel
Returns the String label of an object.
-
setAsString
public void setAsString(java.lang.String string, long... coordinates)
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 interfaceGettersAndSetters
coordinates
- location of the entry @
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnly
in interfaceBaseMatrixProperties
-
getAsString
public java.lang.String getAsString(long... coordinates)
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 interfaceGettersAndSetters
- Parameters:
coordinates
- location of the entry- Returns:
- a String representation of the entry @
-
getMaxValue
public final double getMaxValue()
- Specified by:
getMaxValue
in interfaceExtendedMatrixProperties
-
getMinValue
public final double getMinValue()
- Specified by:
getMinValue
in interfaceExtendedMatrixProperties
-
getMeanValue
public final double getMeanValue()
- Specified by:
getMeanValue
in interfaceExtendedMatrixProperties
-
getStdValue
public final double getStdValue()
- Specified by:
getStdValue
in interfaceExtendedMatrixProperties
-
getValueSum
public final double getValueSum()
- Specified by:
getValueSum
in interfaceExtendedMatrixProperties
-
getAbsoluteValueSum
public final double getAbsoluteValueSum()
- Specified by:
getAbsoluteValueSum
in interfaceExtendedMatrixProperties
-
getColumnLabel
public final java.lang.String getColumnLabel(long col)
- Specified by:
getColumnLabel
in interfaceHasMetaData
-
getRowLabel
public final java.lang.String getRowLabel(long row)
- Specified by:
getRowLabel
in interfaceHasMetaData
-
getRowForLabel
public final long getRowForLabel(java.lang.Object object)
- Specified by:
getRowForLabel
in interfaceHasMetaData
-
getColumnForLabel
public final long getColumnForLabel(java.lang.Object object)
- Specified by:
getColumnForLabel
in interfaceHasMetaData
-
getPositionForLabel
public final long[] getPositionForLabel(int dimension, java.lang.Object label)
- Specified by:
getPositionForLabel
in interfaceHasMetaData
-
setColumnLabel
public final void setColumnLabel(long col, java.lang.Object label)
- Specified by:
setColumnLabel
in interfaceHasMetaData
-
setRowLabel
public final void setRowLabel(long row, java.lang.Object label)
- Specified by:
setRowLabel
in interfaceHasMetaData
-
getAbsoluteValueMean
public final double getAbsoluteValueMean()
- Specified by:
getAbsoluteValueMean
in interfaceExtendedMatrixProperties
-
toRowVector
public final Matrix toRowVector(Calculation.Ret returnType)
- Specified by:
toRowVector
in interfaceObjectCalculations
-
toColumnVector
public final Matrix toColumnVector(Calculation.Ret returnType)
- Specified by:
toColumnVector
in interfaceObjectCalculations
-
replaceMissingBy
public Matrix replaceMissingBy(Matrix matrix)
- Specified by:
replaceMissingBy
in interfaceMiscGeneralDoubleCalculations
-
deleteColumnsWithMissingValues
public final Matrix deleteColumnsWithMissingValues(Calculation.Ret returnType)
- Specified by:
deleteColumnsWithMissingValues
in interfaceMissingValueDoubleCalculations
-
deleteRowsWithMissingValues
public final Matrix deleteRowsWithMissingValues(Calculation.Ret returnType, long threshold)
- Specified by:
deleteRowsWithMissingValues
in interfaceMissingValueDoubleCalculations
-
appendHorizontally
public final Matrix appendHorizontally(Calculation.Ret returnType, Matrix... matrices)
- Specified by:
appendHorizontally
in interfaceMiscGeneralDoubleCalculations
-
allValues
public java.lang.Iterable<java.lang.Object> allValues()
- Specified by:
allValues
in interfaceBaseMatrixProperties
-
appendVertically
public final Matrix appendVertically(Calculation.Ret returnType, Matrix... matrices)
- Specified by:
appendVertically
in interfaceMiscGeneralDoubleCalculations
-
append
public final Matrix append(Calculation.Ret returnType, int dimension, Matrix... matrices)
- Specified by:
append
in interfaceMiscGeneralDoubleCalculations
-
discretizeToColumns
public final Matrix discretizeToColumns(long column)
- Specified by:
discretizeToColumns
in interfaceDiscretizeCalculations
-
subMatrix
public final Matrix subMatrix(Calculation.Ret returnType, long... startAndEndCoordinates)
- Specified by:
subMatrix
in interfaceObjectCalculations
-
svd
public Matrix[] svd()
Description copied from interface:DecompositionDoubleCalculations
Calculates the singular value decomposition of the matrix: A = U*S*V'- Specified by:
svd
in interfaceDecompositionDoubleCalculations
- Returns:
- Singular value decomposition of the matrix.
-
svd
public final Matrix[] svd(int k)
Description copied from interface:DecompositionDoubleCalculations
Calculates a low rank approximation of the singular value decomposition of the matrix: A = U*S*V' but considers only the k largest singular values. This speeds up processing for large matrices.- Specified by:
svd
in interfaceDecompositionDoubleCalculations
- Parameters:
k
- number of singular values to consider- Returns:
- Singular value decomposition of the matrix.
-
eig
public Matrix[] eig()
Description copied from interface:DecompositionDoubleCalculations
Calculates the Eigen decomposition of the matrix.- Specified by:
eig
in interfaceDecompositionDoubleCalculations
- Returns:
- Eigen decomposition of the matrix.
-
eigSymm
public Matrix[] eigSymm()
Description copied from interface:DecompositionDoubleCalculations
Calculates the Eigen decomposition of a symmetric matrix.- Specified by:
eigSymm
in interfaceDecompositionDoubleCalculations
- Returns:
- Eigen decomposition of the matrix.
-
qr
public Matrix[] qr()
Description copied from interface:DecompositionDoubleCalculations
Calculates a QR decomposition of the matrix.- Specified by:
qr
in interfaceDecompositionDoubleCalculations
- Returns:
- QR decomposition of the matrix.
-
lu
public Matrix[] lu()
Description copied from interface:DecompositionDoubleCalculations
Calculates a LU decomposition of the matrix.- Specified by:
lu
in interfaceDecompositionDoubleCalculations
- Returns:
- LU decomposition of the matrix.
-
chol
public Matrix chol()
Description copied from interface:DecompositionDoubleCalculations
Calculates a Cholesky decomposition of the matrix.- Specified by:
chol
in interfaceDecompositionDoubleCalculations
- Returns:
- Cholesky decomposition of the matrix.
-
setSize
public void setSize(long... size)
Description copied from interface:BaseMatrixProperties
Sets the size of the matrix. This is an optional method that is not implemented for all matrices. If this method is not implemented, aMatrixException
is thrown.- Specified by:
setSize
in interfaceBaseMatrixProperties
- Parameters:
size
- the new size of the matrix
-
reshape
public final Matrix reshape(Calculation.Ret returnType, long... newSize)
- Specified by:
reshape
in interfaceObjectCalculations
-
squeeze
public final Matrix squeeze(Calculation.Ret returnType)
- Specified by:
squeeze
in interfaceObjectCalculations
-
doubleValue
public final double doubleValue()
- Specified by:
doubleValue
in interfaceExtendedMatrixProperties
- Specified by:
doubleValue
in classjava.lang.Number
-
intValue
public final int intValue()
- Specified by:
intValue
in interfaceExtendedMatrixProperties
- Specified by:
intValue
in classjava.lang.Number
-
charValue
public final char charValue()
- Specified by:
charValue
in interfaceExtendedMatrixProperties
-
bigIntegerValue
public final java.math.BigInteger bigIntegerValue()
- Specified by:
bigIntegerValue
in interfaceExtendedMatrixProperties
-
bigDecimalValue
public final java.math.BigDecimal bigDecimalValue()
- Specified by:
bigDecimalValue
in interfaceExtendedMatrixProperties
-
fadeIn
public final Matrix fadeIn(Calculation.Ret ret, int dimension)
- Specified by:
fadeIn
in interfaceMiscGeneralDoubleCalculations
-
fadeOut
public final Matrix fadeOut(Calculation.Ret ret, int dimension)
- Specified by:
fadeOut
in interfaceMiscGeneralDoubleCalculations
-
floatValue
public final float floatValue()
- Specified by:
floatValue
in interfaceExtendedMatrixProperties
- Specified by:
floatValue
in classjava.lang.Number
-
longValue
public final long longValue()
- Specified by:
longValue
in interfaceExtendedMatrixProperties
- Specified by:
longValue
in classjava.lang.Number
-
dateValue
public final java.util.Date dateValue()
- Specified by:
dateValue
in interfaceExtendedMatrixProperties
-
booleanValue
public final boolean booleanValue()
- Specified by:
booleanValue
in interfaceExtendedMatrixProperties
-
stringValue
public final java.lang.String stringValue()
- Specified by:
stringValue
in interfaceExtendedMatrixProperties
-
getRMS
public final double getRMS()
- Specified by:
getRMS
in interfaceExtendedMatrixProperties
-
getMetaData
public final java.lang.Object getMetaData(java.lang.Object key)
- Specified by:
getMetaData
in interfaceHasMetaData
-
getMetaDataMatrix
public final Matrix getMetaDataMatrix(java.lang.Object key)
- Specified by:
getMetaDataMatrix
in interfaceHasMetaData
-
getMetaDataDouble
public final double getMetaDataDouble(java.lang.Object key)
- Specified by:
getMetaDataDouble
in interfaceHasMetaData
-
getMetaDataString
public final java.lang.String getMetaDataString(java.lang.Object key)
- Specified by:
getMetaDataString
in interfaceHasMetaData
-
getMetaData
public final MapMatrix<java.lang.String,java.lang.Object> getMetaData()
- Specified by:
getMetaData
in interfaceHasMetaData
-
setMetaData
public final void setMetaData(MapMatrix<java.lang.String,java.lang.Object> metaData)
- Specified by:
setMetaData
in interfaceHasMetaData
-
setMetaData
public final void setMetaData(java.lang.String key, java.lang.Object value)
- Specified by:
setMetaData
in interfaceHasMetaData
-
equalsAnnotation
public final boolean equalsAnnotation(java.lang.Object o)
- Specified by:
equalsAnnotation
in interfaceBaseMatrixProperties
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfaceBaseMatrixProperties
- Overrides:
equals
in classjava.lang.Object
-
equalsContent
public final boolean equalsContent(java.lang.Object o)
- Specified by:
equalsContent
in interfaceBaseMatrixProperties
-
toBooleanMatrix
public final BooleanMatrix toBooleanMatrix()
- Specified by:
toBooleanMatrix
in interfaceConversions
-
toByteMatrix
public final ByteMatrix toByteMatrix()
- Specified by:
toByteMatrix
in interfaceConversions
-
toCharMatrix
public final CharMatrix toCharMatrix()
- Specified by:
toCharMatrix
in interfaceConversions
-
toDoubleMatrix
public final DoubleMatrix toDoubleMatrix()
- Specified by:
toDoubleMatrix
in interfaceConversions
-
toFloatMatrix
public final FloatMatrix toFloatMatrix()
- Specified by:
toFloatMatrix
in interfaceConversions
-
toIntMatrix
public final IntMatrix toIntMatrix()
- Specified by:
toIntMatrix
in interfaceConversions
-
toLongMatrix
public final LongMatrix toLongMatrix()
- Specified by:
toLongMatrix
in interfaceConversions
-
toBigDecimalMatrix
public final BaseBigDecimalMatrix toBigDecimalMatrix()
- Specified by:
toBigDecimalMatrix
in interfaceConversions
-
toBigIntegerMatrix
public final BigIntegerMatrix toBigIntegerMatrix()
- Specified by:
toBigIntegerMatrix
in interfaceConversions
-
toObjectMatrix
public final ObjectMatrix toObjectMatrix()
- Specified by:
toObjectMatrix
in interfaceConversions
-
toShortMatrix
public final ShortMatrix toShortMatrix()
- Specified by:
toShortMatrix
in interfaceConversions
-
toStringMatrix
public final StringMatrix toStringMatrix()
- Specified by:
toStringMatrix
in interfaceConversions
-
norm1
public double norm1()
- Specified by:
norm1
in interfaceExtendedMatrixProperties
-
norm2
public double norm2()
- Specified by:
norm2
in interfaceExtendedMatrixProperties
-
normInf
public double normInf()
- Specified by:
normInf
in interfaceExtendedMatrixProperties
-
normF
public double normF()
- Specified by:
normF
in interfaceExtendedMatrixProperties
-
toListMatrix
public ListMatrix<?> toListMatrix()
- Specified by:
toListMatrix
in interfaceConversions
-
toSetMatrix
public SetMatrix<?> toSetMatrix()
- Specified by:
toSetMatrix
in interfaceConversions
-
toMapMatrix
public MapMatrix<?,?> toMapMatrix()
- Specified by:
toMapMatrix
in interfaceConversions
-
containsBigInteger
public boolean containsBigInteger(java.math.BigInteger v)
- Specified by:
containsBigInteger
in interfaceExtendedMatrixProperties
-
containsBigDecimal
public boolean containsBigDecimal(java.math.BigDecimal v)
- Specified by:
containsBigDecimal
in interfaceExtendedMatrixProperties
-
containsDate
public boolean containsDate(java.util.Date v)
- Specified by:
containsDate
in interfaceExtendedMatrixProperties
-
containsObject
public boolean containsObject(java.lang.Object o)
- Specified by:
containsObject
in interfaceExtendedMatrixProperties
-
containsString
public boolean containsString(java.lang.String s)
- Specified by:
containsString
in interfaceExtendedMatrixProperties
-
containsBoolean
public boolean containsBoolean(boolean v)
- Specified by:
containsBoolean
in interfaceExtendedMatrixProperties
-
containsByte
public boolean containsByte(byte v)
- Specified by:
containsByte
in interfaceExtendedMatrixProperties
-
containsChar
public boolean containsChar(char v)
- Specified by:
containsChar
in interfaceExtendedMatrixProperties
-
containsDouble
public boolean containsDouble(double v)
- Specified by:
containsDouble
in interfaceExtendedMatrixProperties
-
containsFloat
public boolean containsFloat(float v)
- Specified by:
containsFloat
in interfaceExtendedMatrixProperties
-
containsInt
public boolean containsInt(int v)
- Specified by:
containsInt
in interfaceExtendedMatrixProperties
-
containsLong
public boolean containsLong(long v)
- Specified by:
containsLong
in interfaceExtendedMatrixProperties
-
containsShort
public boolean containsShort(short v)
- Specified by:
containsShort
in interfaceExtendedMatrixProperties
-
containsNull
public boolean containsNull()
- Specified by:
containsNull
in interfaceExtendedMatrixProperties
-
exportTo
public MatrixExportDestinationSelector exportTo()
-
importFrom
public MatrixImportSourceSelector importFrom()
- Specified by:
importFrom
in interfaceMatrix
-
getId
public final java.lang.String getId()
Description copied from interface:HasId
Returns the String id of an object.
-
setId
public final void setId(java.lang.String id)
Description copied from interface:HasId
Sets the id of an object
-
getDescription
public final java.lang.String getDescription()
- Specified by:
getDescription
in interfaceHasDescription
-
getLabelObject
public final java.lang.Object getLabelObject()
Description copied from interface:HasLabel
Returns the label of an object.- Specified by:
getLabelObject
in interfaceHasLabel
- Returns:
- the label
-
setDescription
public final void setDescription(java.lang.String description)
- Specified by:
setDescription
in interfaceHasDescription
-
share
public final void share(java.lang.String hostname, int port) throws java.net.UnknownHostException, java.io.IOException
-
-