public class Matrix
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DENSE |
(package private) int |
m |
(package private) int |
n |
(package private) int |
options |
(package private) static java.util.Random |
rand |
(package private) Vec[] |
rows |
static int |
SPARSE |
Constructor and Description |
---|
Matrix(double v) |
Matrix(double[][] A) |
Matrix(int m,
int n) |
Matrix(int m,
int n,
int options) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Matrix |
coerceOption(int options) |
static Matrix |
columnMatrix(double[] v) |
static Matrix |
columnPackedMatrix(double[] v,
int m,
int n)
Create a matrix from the column-packed vector.
|
Matrix |
copy() |
Matrix |
copy(int row0,
int row1,
int col0,
int col1) |
double[][] |
copyArray() |
double[][] |
copyArray(int i0,
int j0,
int tm,
int tn)
Copy the submatrix beginning at (i0,j0) with m rows and n columns
|
void |
copyArray(int i0,
int j0,
int tm,
int tn,
double[][] A)
Copy the submatrix beginning at (i0,j0) with m rows and n columns
|
double[] |
copyAsVector() |
Matrix |
copyPermuteColumns(int[] perm) |
Matrix |
copyPermuteRowsAndColumns(int[] perm) |
void |
copyToArray(double[][] A) |
double |
det() |
static Matrix |
diag(double[] v) |
boolean |
equals(Matrix M) |
boolean |
equals(Matrix M,
double eps) |
double |
get(int pos) |
double |
get(int row,
int col) |
Vec |
getColumn(int col)
Create a new Vec containing a copy of the column.
|
int |
getColumnDimension() |
double[] |
getColumnPackedCopy() |
int |
getNz() |
double |
getNzFrac() |
int |
getOptions() |
Vec |
getRow(int row)
The Vec returned is a LIVE view of the matrix.
|
int |
getRowDimension() |
static Matrix |
identity(int m,
int n) |
Matrix |
inverse() |
void |
inversePermuteRows(int[] pivot) |
boolean |
isSparse() |
double |
logDet() |
(package private) Vec |
makeVec(int length) |
Matrix |
minus(Matrix B) |
void |
minusEquals(int i0,
int j0,
double[][] v) |
void |
minusEquals(int i0,
int j0,
Matrix M) |
void |
minusEquals(Matrix M) |
double |
normF() |
static Matrix |
outerProduct(double[] x,
double[] y) |
void |
permuteRows(int[] perm) |
Matrix |
plus(Matrix B) |
void |
plusEquals(double[][] v) |
void |
plusEquals(int i,
int j,
double v) |
void |
plusEquals(int i0,
int j0,
double[][] v) |
void |
plusEquals(int i0,
int j0,
Matrix M) |
void |
plusEquals(Matrix M) |
void |
plusEqualsColumnVector(double[] v) |
void |
plusEqualsColumnVector(int i0,
int j0,
double[] v) |
void |
print() |
static Matrix |
random(int m,
int n) |
static Matrix |
read(java.io.BufferedReader ins)
Create a new matrix whose dimensions are given on the first
two lines (rows on the first line, cols on the second line),
followed by each element of the matrix on a line by itself (row
major ordering).
|
void |
resize(int newrows,
int newcols)
Truncate or add zeros as appropriate.
|
static Matrix |
rowMatrix(double[] v) |
void |
set(int pos,
double v) |
void |
set(int row,
int col,
double v) |
void |
set(int row,
int col,
double[][] v) |
void |
setRow(int row,
Vec v)
Use with extreme caution.
|
Matrix |
solve(Matrix B) |
void |
swapRows(int a,
int b) |
Matrix |
times(double v) |
double[] |
times(double[] B) |
Matrix |
times(Matrix B) |
void |
timesEquals(double v) |
void |
timesEquals(int i,
int j,
double v) |
Matrix |
timesTranspose(Matrix BT) |
java.lang.String |
toString() |
double |
trace() |
Matrix |
transpose() |
double[] |
transposeTimes(double[] B) |
Matrix |
upperRight() |
Matrix |
upperRightTranspose() |
void |
write(java.io.BufferedWriter outs)
Writes matrix data in a format compatible with the read() method.
|
void |
writeMatlab(java.io.BufferedWriter outs,
java.lang.String matname)
Writes the matrix in a form that can be easily executed by
matlab in a way that is efficient for sparse matrices.
|
public static final int DENSE
public static final int SPARSE
int m
int n
int options
Vec[] rows
static java.util.Random rand
public Matrix(double v)
public Matrix(int m, int n)
public Matrix(int m, int n, int options)
public Matrix(double[][] A)
final Vec makeVec(int length)
public static Matrix diag(double[] v)
public static Matrix rowMatrix(double[] v)
public static Matrix columnMatrix(double[] v)
public static Matrix outerProduct(double[] x, double[] y)
public Matrix coerceOption(int options)
public Matrix copy()
public double[][] copyArray()
public void copyToArray(double[][] A)
public double[][] copyArray(int i0, int j0, int tm, int tn)
public void copyArray(int i0, int j0, int tm, int tn, double[][] A)
public double[] copyAsVector()
public Matrix copy(int row0, int row1, int col0, int col1)
public static Matrix identity(int m, int n)
public static Matrix random(int m, int n)
public int getRowDimension()
public int getColumnDimension()
public int getOptions()
public double get(int pos)
public void set(int pos, double v)
public double get(int row, int col)
public void set(int row, int col, double v)
public void set(int row, int col, double[][] v)
public Vec getColumn(int col)
public Vec getRow(int row)
public void setRow(int row, Vec v)
public boolean isSparse()
public int getNz()
public double getNzFrac()
public void clear()
public boolean equals(Matrix M)
public boolean equals(Matrix M, double eps)
public void print()
public java.lang.String toString()
toString
in class java.lang.Object
public Matrix times(double v)
public double[] transposeTimes(double[] B)
public double[] times(double[] B)
public double det()
public double logDet()
public double[] getColumnPackedCopy()
public static Matrix columnPackedMatrix(double[] v, int m, int n)
public void timesEquals(double v)
public void timesEquals(int i, int j, double v)
public void plusEquals(int i, int j, double v)
public void plusEquals(double[][] v)
public void plusEquals(int i0, int j0, double[][] v)
public void plusEqualsColumnVector(double[] v)
public void plusEqualsColumnVector(int i0, int j0, double[] v)
public void plusEquals(Matrix M)
public void minusEquals(int i0, int j0, double[][] v)
public void minusEquals(int i0, int j0, Matrix M)
public void minusEquals(Matrix M)
public void plusEquals(int i0, int j0, Matrix M)
public double trace()
public double normF()
public void swapRows(int a, int b)
public void permuteRows(int[] perm)
public Matrix copyPermuteColumns(int[] perm)
public Matrix copyPermuteRowsAndColumns(int[] perm)
public void inversePermuteRows(int[] pivot)
public Matrix transpose()
public Matrix upperRightTranspose()
public Matrix upperRight()
public Matrix inverse()
public void resize(int newrows, int newcols)
public void write(java.io.BufferedWriter outs) throws java.io.IOException
java.io.IOException
public static Matrix read(java.io.BufferedReader ins) throws java.io.IOException
java.io.IOException
public void writeMatlab(java.io.BufferedWriter outs, java.lang.String matname) throws java.io.IOException
java.io.IOException