ch.javasoft.smx.impl
Class DefaultLongMatrix
java.lang.Object
ch.javasoft.smx.impl.DefaultLongMatrix
- All Implemented Interfaces:
- LongMatrix, MatrixBase<Long>, ReadableBigIntegerMatrix<Long>, ReadableBigIntegerRationalMatrix<Long>, ReadableDoubleMatrix<Long>, ReadableLongMatrix<Long>, ReadableLongRationalMatrix<Long>, ReadableMatrix<Long>, WritableIntMatrix<Long>, WritableLongMatrix<Long>, WritableMatrix<Long>, Cloneable
public class DefaultLongMatrix
- extends Object
- implements LongMatrix
The DefaultLongMatrix is the default implementation of LongMatrix. It
contains a 1-dimensional array with all the matrix values.
|
Method Summary |
void |
add(int row,
int col,
int value)
|
void |
add(int row,
int col,
long value)
|
void |
addRowToOtherRow(int srcRow,
int srcFactor,
int dstRow,
int dstFactor)
|
void |
addRowToOtherRow(int srcRow,
long srcFactor,
int dstRow,
long dstFactor)
|
DefaultLongMatrix |
clone()
|
static DefaultLongMatrix |
diag(long[] values)
|
static DefaultLongMatrix |
diag(long value,
int len)
|
boolean |
equals(Object obj)
|
BigFraction |
getBigFractionValueAt(int row,
int col)
|
BigInteger[] |
getBigIntegerColumn(int col)
|
BigInteger[][] |
getBigIntegerColumns()
|
BigInteger |
getBigIntegerDenominatorAt(int row,
int col)
|
BigInteger |
getBigIntegerNumeratorAt(int row,
int col)
|
BigInteger[] |
getBigIntegerRow(int row)
|
BigInteger[][] |
getBigIntegerRows()
|
BigInteger |
getBigIntegerValueAt(int row,
int col)
|
int |
getColumnCount()
|
double[] |
getDoubleColumn(int col)
|
double[][] |
getDoubleColumns()
|
double[] |
getDoubleRow(int row)
|
double[][] |
getDoubleRows()
|
double |
getDoubleValueAt(int row,
int col)
|
long[] |
getLongColumn(int col)
|
static long[] |
getLongColumn(ReadableLongMatrix mx,
int col)
|
long[][] |
getLongColumns()
|
static long[][] |
getLongColumns(ReadableLongMatrix mx)
|
long |
getLongDenominatorAt(int row,
int col)
|
long |
getLongNumeratorAt(int row,
int col)
|
long[] |
getLongRow(int row)
|
static long[] |
getLongRow(ReadableLongMatrix mx,
int row)
|
long[][] |
getLongRows()
|
static long[][] |
getLongRows(ReadableLongMatrix mx)
|
long |
getLongValueAt(int row,
int col)
|
MatrixOperations<Long> |
getMatrixOperations()
|
LongOperations |
getNumberOperations()
|
Long[][] |
getNumberRows()
|
static Long[][] |
getNumberRows(ReadableLongMatrix<Long> mx)
|
Long |
getNumberValueAt(int row,
int col)
|
int |
getRowCount()
|
int |
getSignumAt(int row,
int col)
|
int |
hashCode()
|
static DefaultLongMatrix |
identity(int len)
|
void |
multiply(int row,
int col,
int factor)
|
void |
multiply(int row,
int col,
long factor)
|
void |
multiplyRow(int row,
int factor)
|
void |
multiplyRow(int row,
long factor)
|
void |
negate(int row,
int col)
|
DefaultLongMatrix |
newInstance(int rows,
int cols)
|
DefaultLongMatrix |
newInstance(Long[][] data,
boolean rowsInDim1)
|
void |
setValueAt(int row,
int col,
int value)
|
void |
setValueAt(int row,
int col,
Integer value)
|
void |
setValueAt(int row,
int col,
long value)
|
void |
setValueAt(int row,
int col,
Long value)
|
ReadableBigIntegerMatrix |
subBigIntegerMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
|
BigIntegerRationalMatrix |
subBigIntegerRationalMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
|
DoubleMatrix |
subDoubleMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
|
LongMatrix |
subLongMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
|
LongRationalMatrix |
subLongRationalMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
|
void |
swapColumns(int colA,
int colB)
|
void |
swapRows(int rowA,
int rowB)
|
void |
toArray(BigInteger[] array)
|
void |
toArray(double[] array)
|
void |
toArray(long[] array)
|
static void |
toArray(ReadableLongMatrix mx,
long[] array)
|
BigInteger[] |
toBigIntegerArray()
|
BigIntegerMatrix |
toBigIntegerMatrix(boolean enforceNewInstance)
|
BigIntegerRationalMatrix |
toBigIntegerRationalMatrix(boolean enforceNewInstance)
|
double[] |
toDoubleArray()
|
DoubleMatrix |
toDoubleMatrix(boolean enforceNewInstance)
|
long[] |
toLongArray()
|
LongMatrix |
toLongMatrix(boolean enforceNewInstance)
|
LongRationalMatrix |
toLongRationalMatrix(boolean enforceNewInstance)
|
String |
toMultilineString()
|
static String |
toMultilineString(ReadableLongMatrix mx)
|
LongMatrix |
toReadableMatrix(boolean enforceNewInstance)
|
String |
toString()
|
static String |
toString(ReadableLongMatrix mx)
|
protected static String |
toString(ReadableLongMatrix mx,
String prefix,
String postfix,
String rowPrefix,
String rowPostfix,
String rowSeparator,
String colPrefix,
String colPostfix,
String colSeparator)
|
LongMatrix |
toWritableMatrix(boolean enforceNewInstance)
|
DefaultLongMatrix |
transpose()
|
void |
writeTo(OutputStream out)
|
static void |
writeTo(OutputStream out,
ReadableLongMatrix mx)
|
protected static void |
writeTo(PrintWriter writer,
ReadableLongMatrix mx,
String prefix,
String postfix,
String rowPrefix,
String rowPostfix,
String rowSeparator,
String colPrefix,
String colPostfix,
String colSeparator)
|
void |
writeTo(Writer writer)
|
static void |
writeTo(Writer writer,
ReadableLongMatrix mx)
|
void |
writeToMultiline(OutputStream out)
|
static void |
writeToMultiline(OutputStream out,
ReadableLongMatrix mx)
|
void |
writeToMultiline(Writer writer)
|
static void |
writeToMultiline(Writer writer,
ReadableLongMatrix mx)
|
DefaultLongMatrix
public DefaultLongMatrix(int rowCount,
int colCount)
DefaultLongMatrix
public DefaultLongMatrix(long[] values,
int rowCount,
int columnCount)
DefaultLongMatrix
public DefaultLongMatrix(long[][] values,
boolean rowsInDim1)
- Initializes the matrix from a 2-dim long array. The resulting
rows relate to the first dimension if
rowsInDim1 is
true, or to the second dimension otherwise.
If the second dimension has different lengths, the maximum value
is taken, missing values are initialized with 0.
- Parameters:
values - The 2-dim long array with the source valuesrowsInDim1 - If true, the 1st dimension will become
rows in the resulting DefaultDoubleMatrix,
the columns relate to the 2nd dimension.
If false, it is vice versa.
DefaultLongMatrix
public DefaultLongMatrix(Long[][] values,
boolean rowsInDim1)
- Initializes the matrix from a 2-dim long array. The resulting
rows relate to the first dimension if
rowsInDim1 is
true, or to the second dimension otherwise.
If the second dimension has different lengths, the maximum value
is taken, missing values are initialized with 0.
- Parameters:
values - The 2-dim long array with the source valuesrowsInDim1 - If true, the 1st dimension will become
rows in the resulting DefaultDoubleMatrix,
the columns relate to the 2nd dimension.
If false, it is vice versa.
DefaultLongMatrix
public DefaultLongMatrix(ReadableLongMatrix mx)
diag
public static DefaultLongMatrix diag(long[] values)
diag
public static DefaultLongMatrix diag(long value,
int len)
identity
public static DefaultLongMatrix identity(int len)
getNumberOperations
public LongOperations getNumberOperations()
- Specified by:
getNumberOperations in interface MatrixBase<Long>
getMatrixOperations
public MatrixOperations<Long> getMatrixOperations()
- Specified by:
getMatrixOperations in interface MatrixBase<Long>
getLongValueAt
public long getLongValueAt(int row,
int col)
- Specified by:
getLongValueAt in interface ReadableLongMatrix<Long>
getSignumAt
public int getSignumAt(int row,
int col)
- Specified by:
getSignumAt in interface ReadableMatrix<Long>
getLongNumeratorAt
public long getLongNumeratorAt(int row,
int col)
- Specified by:
getLongNumeratorAt in interface ReadableLongRationalMatrix<Long>
getLongDenominatorAt
public long getLongDenominatorAt(int row,
int col)
- Specified by:
getLongDenominatorAt in interface ReadableLongRationalMatrix<Long>
getBigIntegerNumeratorAt
public BigInteger getBigIntegerNumeratorAt(int row,
int col)
- Specified by:
getBigIntegerNumeratorAt in interface ReadableBigIntegerRationalMatrix<Long>
getBigIntegerDenominatorAt
public BigInteger getBigIntegerDenominatorAt(int row,
int col)
- Specified by:
getBigIntegerDenominatorAt in interface ReadableBigIntegerRationalMatrix<Long>
getDoubleValueAt
public double getDoubleValueAt(int row,
int col)
- Specified by:
getDoubleValueAt in interface ReadableDoubleMatrix<Long>
getBigFractionValueAt
public BigFraction getBigFractionValueAt(int row,
int col)
- Specified by:
getBigFractionValueAt in interface ReadableBigIntegerRationalMatrix<Long>
getRowCount
public int getRowCount()
- Specified by:
getRowCount in interface MatrixBase<Long>
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount in interface MatrixBase<Long>
setValueAt
public void setValueAt(int row,
int col,
int value)
- Specified by:
setValueAt in interface WritableIntMatrix<Long>
setValueAt
public void setValueAt(int row,
int col,
long value)
- Specified by:
setValueAt in interface WritableLongMatrix<Long>
setValueAt
public void setValueAt(int row,
int col,
Integer value)
setValueAt
public void setValueAt(int row,
int col,
Long value)
- Specified by:
setValueAt in interface WritableMatrix<Long>
swapRows
public void swapRows(int rowA,
int rowB)
- Specified by:
swapRows in interface WritableMatrix<Long>
swapColumns
public void swapColumns(int colA,
int colB)
- Specified by:
swapColumns in interface WritableMatrix<Long>
getNumberValueAt
public Long getNumberValueAt(int row,
int col)
- Specified by:
getNumberValueAt in interface ReadableMatrix<Long>
toArray
public void toArray(long[] array)
- Specified by:
toArray in interface ReadableLongMatrix<Long>
toArray
public static void toArray(ReadableLongMatrix mx,
long[] array)
toDoubleArray
public double[] toDoubleArray()
- Specified by:
toDoubleArray in interface ReadableDoubleMatrix<Long>
toLongArray
public long[] toLongArray()
- Specified by:
toLongArray in interface ReadableLongMatrix<Long>
toArray
public void toArray(double[] array)
- Specified by:
toArray in interface ReadableDoubleMatrix<Long>
getDoubleColumn
public double[] getDoubleColumn(int col)
- Specified by:
getDoubleColumn in interface ReadableDoubleMatrix<Long>
getDoubleColumns
public double[][] getDoubleColumns()
- Specified by:
getDoubleColumns in interface ReadableDoubleMatrix<Long>
getDoubleRow
public double[] getDoubleRow(int row)
- Specified by:
getDoubleRow in interface ReadableDoubleMatrix<Long>
getDoubleRows
public double[][] getDoubleRows()
- Specified by:
getDoubleRows in interface ReadableDoubleMatrix<Long>
getLongColumn
public long[] getLongColumn(int col)
- Specified by:
getLongColumn in interface ReadableLongMatrix<Long>
getLongColumn
public static long[] getLongColumn(ReadableLongMatrix mx,
int col)
getLongRow
public long[] getLongRow(int row)
- Specified by:
getLongRow in interface ReadableLongMatrix<Long>
getLongRow
public static long[] getLongRow(ReadableLongMatrix mx,
int row)
getLongColumns
public long[][] getLongColumns()
- Specified by:
getLongColumns in interface ReadableLongMatrix<Long>
getLongColumns
public static long[][] getLongColumns(ReadableLongMatrix mx)
getLongRows
public long[][] getLongRows()
- Specified by:
getLongRows in interface ReadableLongMatrix<Long>
getLongRows
public static long[][] getLongRows(ReadableLongMatrix mx)
getNumberRows
public Long[][] getNumberRows()
- Specified by:
getNumberRows in interface ReadableMatrix<Long>
getNumberRows
public static Long[][] getNumberRows(ReadableLongMatrix<Long> mx)
toString
public String toString()
- Specified by:
toString in interface MatrixBase<Long>- Overrides:
toString in class Object
writeTo
public void writeTo(Writer writer)
- Specified by:
writeTo in interface MatrixBase<Long>
writeTo
public void writeTo(OutputStream out)
- Specified by:
writeTo in interface MatrixBase<Long>
toString
public static String toString(ReadableLongMatrix mx)
writeTo
public static void writeTo(Writer writer,
ReadableLongMatrix mx)
writeTo
public static void writeTo(OutputStream out,
ReadableLongMatrix mx)
toMultilineString
public String toMultilineString()
- Specified by:
toMultilineString in interface MatrixBase<Long>
writeToMultiline
public void writeToMultiline(Writer writer)
- Specified by:
writeToMultiline in interface MatrixBase<Long>
writeToMultiline
public void writeToMultiline(OutputStream out)
- Specified by:
writeToMultiline in interface MatrixBase<Long>
toMultilineString
public static String toMultilineString(ReadableLongMatrix mx)
writeToMultiline
public static void writeToMultiline(Writer writer,
ReadableLongMatrix mx)
writeToMultiline
public static void writeToMultiline(OutputStream out,
ReadableLongMatrix mx)
toString
protected static String toString(ReadableLongMatrix mx,
String prefix,
String postfix,
String rowPrefix,
String rowPostfix,
String rowSeparator,
String colPrefix,
String colPostfix,
String colSeparator)
writeTo
protected static void writeTo(PrintWriter writer,
ReadableLongMatrix mx,
String prefix,
String postfix,
String rowPrefix,
String rowPostfix,
String rowSeparator,
String colPrefix,
String colPostfix,
String colSeparator)
clone
public DefaultLongMatrix clone()
- Specified by:
clone in interface LongMatrix- Specified by:
clone in interface MatrixBase<Long>- Specified by:
clone in interface ReadableMatrix<Long>- Specified by:
clone in interface WritableMatrix<Long>- Overrides:
clone in class Object
newInstance
public DefaultLongMatrix newInstance(int rows,
int cols)
- Specified by:
newInstance in interface LongMatrix- Specified by:
newInstance in interface MatrixBase<Long>- Specified by:
newInstance in interface ReadableMatrix<Long>- Specified by:
newInstance in interface WritableMatrix<Long>
newInstance
public DefaultLongMatrix newInstance(Long[][] data,
boolean rowsInDim1)
- Specified by:
newInstance in interface LongMatrix- Specified by:
newInstance in interface MatrixBase<Long>- Specified by:
newInstance in interface ReadableMatrix<Long>- Specified by:
newInstance in interface WritableMatrix<Long>
toLongMatrix
public LongMatrix toLongMatrix(boolean enforceNewInstance)
- Specified by:
toLongMatrix in interface ReadableLongMatrix<Long>
toWritableMatrix
public LongMatrix toWritableMatrix(boolean enforceNewInstance)
- Specified by:
toWritableMatrix in interface ReadableMatrix<Long>
toReadableMatrix
public LongMatrix toReadableMatrix(boolean enforceNewInstance)
- Specified by:
toReadableMatrix in interface WritableMatrix<Long>
toLongRationalMatrix
public LongRationalMatrix toLongRationalMatrix(boolean enforceNewInstance)
- Specified by:
toLongRationalMatrix in interface ReadableLongRationalMatrix<Long>
toBigIntegerRationalMatrix
public BigIntegerRationalMatrix toBigIntegerRationalMatrix(boolean enforceNewInstance)
- Specified by:
toBigIntegerRationalMatrix in interface ReadableBigIntegerRationalMatrix<Long>
toDoubleMatrix
public DoubleMatrix toDoubleMatrix(boolean enforceNewInstance)
- Specified by:
toDoubleMatrix in interface ReadableDoubleMatrix<Long>
addRowToOtherRow
public void addRowToOtherRow(int srcRow,
int srcFactor,
int dstRow,
int dstFactor)
- Specified by:
addRowToOtherRow in interface WritableIntMatrix<Long>
addRowToOtherRow
public void addRowToOtherRow(int srcRow,
long srcFactor,
int dstRow,
long dstFactor)
- Specified by:
addRowToOtherRow in interface WritableLongMatrix<Long>
add
public void add(int row,
int col,
int value)
- Specified by:
add in interface WritableIntMatrix<Long>
add
public void add(int row,
int col,
long value)
- Specified by:
add in interface WritableLongMatrix<Long>
multiply
public void multiply(int row,
int col,
int factor)
- Specified by:
multiply in interface WritableIntMatrix<Long>
multiply
public void multiply(int row,
int col,
long factor)
- Specified by:
multiply in interface WritableLongMatrix<Long>
multiplyRow
public void multiplyRow(int row,
int factor)
- Specified by:
multiplyRow in interface WritableIntMatrix<Long>
multiplyRow
public void multiplyRow(int row,
long factor)
- Specified by:
multiplyRow in interface WritableLongMatrix<Long>
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
subLongMatrix
public LongMatrix subLongMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
- Specified by:
subLongMatrix in interface ReadableLongMatrix<Long>
subLongRationalMatrix
public LongRationalMatrix subLongRationalMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
- Specified by:
subLongRationalMatrix in interface ReadableLongRationalMatrix<Long>
subBigIntegerRationalMatrix
public BigIntegerRationalMatrix subBigIntegerRationalMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
- Specified by:
subBigIntegerRationalMatrix in interface ReadableBigIntegerRationalMatrix<Long>
subDoubleMatrix
public DoubleMatrix subDoubleMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
- Specified by:
subDoubleMatrix in interface ReadableDoubleMatrix<Long>
subBigIntegerMatrix
public ReadableBigIntegerMatrix subBigIntegerMatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
- Specified by:
subBigIntegerMatrix in interface ReadableBigIntegerMatrix<Long>
transpose
public DefaultLongMatrix transpose()
- Specified by:
transpose in interface LongMatrix- Specified by:
transpose in interface MatrixBase<Long>- Specified by:
transpose in interface ReadableMatrix<Long>- Specified by:
transpose in interface WritableMatrix<Long>
getBigIntegerValueAt
public BigInteger getBigIntegerValueAt(int row,
int col)
- Specified by:
getBigIntegerValueAt in interface ReadableBigIntegerMatrix<Long>
toArray
public void toArray(BigInteger[] array)
- Specified by:
toArray in interface ReadableBigIntegerMatrix<Long>
toBigIntegerArray
public BigInteger[] toBigIntegerArray()
- Specified by:
toBigIntegerArray in interface ReadableBigIntegerMatrix<Long>
toBigIntegerMatrix
public BigIntegerMatrix toBigIntegerMatrix(boolean enforceNewInstance)
- Specified by:
toBigIntegerMatrix in interface ReadableBigIntegerMatrix<Long>
getBigIntegerColumn
public BigInteger[] getBigIntegerColumn(int col)
- Specified by:
getBigIntegerColumn in interface ReadableBigIntegerMatrix<Long>
getBigIntegerColumns
public BigInteger[][] getBigIntegerColumns()
- Specified by:
getBigIntegerColumns in interface ReadableBigIntegerMatrix<Long>
getBigIntegerRow
public BigInteger[] getBigIntegerRow(int row)
- Specified by:
getBigIntegerRow in interface ReadableBigIntegerMatrix<Long>
getBigIntegerRows
public BigInteger[][] getBigIntegerRows()
- Specified by:
getBigIntegerRows in interface ReadableBigIntegerMatrix<Long>
negate
public void negate(int row,
int col)
- Specified by:
negate in interface WritableMatrix<Long>