|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umbc.cs.maple.utils.ColtUtils
public class ColtUtils
Various utility functions for the COLT matrix library.
Copyright (c) 2008 Eric Eaton
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Nested Class Summary | |
---|---|
static class |
ColtUtils.MaxMin
|
Constructor Summary | |
---|---|
ColtUtils()
|
Method Summary | |
---|---|
static cern.colt.matrix.DoubleMatrix1D |
colsum(cern.colt.matrix.DoubleMatrix2D m)
Computes the sum of each column of a matrix. |
static double |
colsum(cern.colt.matrix.DoubleMatrix2D m,
int col)
Gets the sum of the specified column of the matrix. |
static cern.colt.matrix.DoubleMatrix2D |
columnAppend(cern.colt.matrix.DoubleMatrix2D m,
cern.colt.matrix.DoubleMatrix2D n)
Appends additional columns to the first matrix. |
static cern.colt.matrix.DoubleMatrix2D |
deleteCol(cern.colt.matrix.DoubleMatrix2D m,
int col)
Deletes a column from a matrix. |
static cern.colt.matrix.DoubleMatrix2D |
deleteRow(cern.colt.matrix.DoubleMatrix2D m,
int row)
Deletes a row from a matrix. |
static cern.colt.matrix.DoubleMatrix2D |
diagonalPow(cern.colt.matrix.DoubleMatrix2D m,
double exponent)
|
static double |
dotproduct(cern.colt.matrix.DoubleMatrix1D m1,
cern.colt.matrix.DoubleMatrix1D m2)
Computes the dot product of two vectors. |
static double |
dotproduct(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
Computes the dot product of two vectors. |
static cern.colt.matrix.DoubleMatrix2D |
elementMult(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
elementMultEquals(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
protected static double |
gcv(cern.colt.matrix.DoubleMatrix2D A,
cern.colt.matrix.DoubleMatrix2D b)
|
static cern.colt.matrix.DoubleMatrix1D |
getcol(cern.colt.matrix.DoubleMatrix2D m,
int col)
Gets the specified column of a matrix. |
static cern.colt.matrix.DoubleMatrix2D |
getcolumns(cern.colt.matrix.DoubleMatrix2D m,
int[] columns)
Gets the specified columns of a matrix. |
static double |
getMax(cern.colt.matrix.DoubleMatrix2D m)
|
static double |
getMin(cern.colt.matrix.DoubleMatrix2D m)
|
static double[] |
getNonZeros(cern.colt.matrix.DoubleMatrix1D m)
|
static double[] |
getNonZeros(cern.colt.matrix.DoubleMatrix2D m)
|
static cern.colt.matrix.DoubleMatrix1D |
getrow(cern.colt.matrix.DoubleMatrix2D m,
int row)
Gets the specified row of a matrix. |
static cern.colt.matrix.DoubleMatrix2D |
getrows(cern.colt.matrix.DoubleMatrix2D m,
int[] rows)
Gets the specified rows of a matrix. |
static cern.colt.matrix.DoubleMatrix2D |
identity(int m)
|
static cern.colt.matrix.DoubleMatrix2D |
inverse(cern.colt.matrix.DoubleMatrix2D m)
|
static boolean |
isColumnVector(cern.colt.matrix.DoubleMatrix2D m)
Determines if a given matrix is a column vector, that is, it has only one column. |
static boolean |
isRowVector(cern.colt.matrix.DoubleMatrix2D m)
Determines if a given matrix is a row vector, that is, it has only one row. |
static boolean |
isSymmetric(cern.colt.matrix.DoubleMatrix2D m)
Determines whether a matrix is symmetric. |
static cern.colt.matrix.DoubleMatrix2D |
loadDoubleMatrix2D(java.io.File file)
|
static void |
main(java.lang.String[] args)
|
static cern.colt.matrix.DoubleMatrix2D |
makeColumnVector(cern.colt.matrix.DoubleMatrix2D m)
Transforms the given matrix into a column vector, that is, a matrix with one column. |
static void |
makeMatrixSymmetric(cern.colt.matrix.DoubleMatrix2D m,
ColtUtils.MaxMin maxmin)
|
static cern.colt.matrix.DoubleMatrix2D |
makeRowVector(cern.colt.matrix.DoubleMatrix2D m)
Transforms the given matrix into a row vector, that is, a matrix with one row. |
static cern.colt.matrix.DoubleMatrix1D |
minus(cern.colt.matrix.DoubleMatrix1D m1,
cern.colt.matrix.DoubleMatrix1D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
minus(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
static cern.colt.matrix.DoubleMatrix1D |
minusEquals(cern.colt.matrix.DoubleMatrix1D m1,
cern.colt.matrix.DoubleMatrix1D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
minusEquals(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
mult(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
normalize(cern.colt.matrix.DoubleMatrix2D m)
Normalizes a matrix to make the elements sum to 1. |
static double |
normF(cern.colt.matrix.DoubleMatrix2D m)
|
static cern.colt.matrix.DoubleMatrix2D |
ones(int numRows,
int numCols)
Make a matrix of ones. |
static cern.colt.matrix.DoubleMatrix1D |
plus(cern.colt.matrix.DoubleMatrix1D m1,
cern.colt.matrix.DoubleMatrix1D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
plus(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
static cern.colt.matrix.DoubleMatrix1D |
plusEquals(cern.colt.matrix.DoubleMatrix1D m1,
cern.colt.matrix.DoubleMatrix1D m2)
|
static cern.colt.matrix.DoubleMatrix2D |
plusEquals(cern.colt.matrix.DoubleMatrix2D m1,
cern.colt.matrix.DoubleMatrix2D m2)
|
static void |
printSparseMatrix(java.io.PrintStream outStream,
cern.colt.matrix.DoubleMatrix2D m)
|
static cern.colt.matrix.DoubleMatrix2D |
regLeastSquares(cern.colt.matrix.DoubleMatrix2D A,
cern.colt.matrix.DoubleMatrix2D b)
|
static cern.colt.matrix.DoubleMatrix2D |
regLeastSquares(cern.colt.matrix.DoubleMatrix2D A,
cern.colt.matrix.DoubleMatrix2D b,
double lambda)
|
static cern.colt.matrix.DoubleMatrix2D |
regLeastSquares(cern.colt.matrix.DoubleMatrix2D A,
cern.colt.matrix.DoubleMatrix2D b,
cern.colt.matrix.DoubleMatrix2D regop)
|
static double |
rmse(cern.colt.matrix.DoubleMatrix2D a,
cern.colt.matrix.DoubleMatrix2D b)
|
static cern.colt.matrix.DoubleMatrix2D |
rowAppend(cern.colt.matrix.DoubleMatrix2D m,
cern.colt.matrix.DoubleMatrix2D n)
Appends additional rows to the first matrix. |
static cern.colt.matrix.DoubleMatrix1D |
rowsum(cern.colt.matrix.DoubleMatrix2D m)
Computes the sum of each row of a matrix. |
static double |
rowsum(cern.colt.matrix.DoubleMatrix2D m,
int row)
Gets the sum of the specified row of the matrix. |
static cern.colt.matrix.DoubleMatrix1D |
scale(cern.colt.matrix.DoubleMatrix1D m,
double d)
|
static cern.colt.matrix.DoubleMatrix2D |
scale(cern.colt.matrix.DoubleMatrix2D m,
double d)
|
static void |
setcol(cern.colt.matrix.DoubleMatrix2D m,
int col,
double[] values)
Sets the specified column of a matrix. |
static void |
setcol(cern.colt.matrix.DoubleMatrix2D m,
int col,
cern.colt.matrix.DoubleMatrix1D values)
Sets the specified column of a matrix. |
static void |
setrow(cern.colt.matrix.DoubleMatrix2D m,
int row,
cern.colt.matrix.DoubleMatrix1D values)
Sets the specified row of a matrix. |
static double |
sum(cern.colt.matrix.DoubleMatrix1D m)
|
static double |
sum(cern.colt.matrix.DoubleMatrix2D m)
|
static cern.colt.matrix.DoubleMatrix1D |
to1D(cern.colt.matrix.DoubleMatrix2D m)
|
static cern.colt.matrix.DoubleMatrix2D |
to2D(cern.colt.matrix.DoubleMatrix1D m)
|
static cern.colt.matrix.DoubleMatrix2D |
transpose(cern.colt.matrix.DoubleMatrix2D m)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColtUtils()
Method Detail |
---|
public static cern.colt.matrix.DoubleMatrix1D getcol(cern.colt.matrix.DoubleMatrix2D m, int col)
m
- the matrix.col
- the column to get.
public static cern.colt.matrix.DoubleMatrix2D getcolumns(cern.colt.matrix.DoubleMatrix2D m, int[] columns)
m
- the matrixcolumns
- the columns to get
public static cern.colt.matrix.DoubleMatrix1D getrow(cern.colt.matrix.DoubleMatrix2D m, int row)
m
- the matrix.row
- the row to get.
public static cern.colt.matrix.DoubleMatrix2D getrows(cern.colt.matrix.DoubleMatrix2D m, int[] rows)
m
- the matrixrows
- the rows to get
public static void setrow(cern.colt.matrix.DoubleMatrix2D m, int row, cern.colt.matrix.DoubleMatrix1D values)
m
- the matrix.row
- the row to modify.values
- the new values of the row.public static void setcol(cern.colt.matrix.DoubleMatrix2D m, int col, cern.colt.matrix.DoubleMatrix1D values)
m
- the matrix.col
- the column to modify.values
- the new values of the column.public static void setcol(cern.colt.matrix.DoubleMatrix2D m, int col, double[] values)
m
- the matrix.col
- the column to modify.values
- the new values of the column.public static cern.colt.matrix.DoubleMatrix2D rowAppend(cern.colt.matrix.DoubleMatrix2D m, cern.colt.matrix.DoubleMatrix2D n)
m
- the first matrix.n
- the matrix to append containing additional rows.
public static cern.colt.matrix.DoubleMatrix2D columnAppend(cern.colt.matrix.DoubleMatrix2D m, cern.colt.matrix.DoubleMatrix2D n)
m
- the first matrix.n
- the matrix to append containing additional columns.
public static cern.colt.matrix.DoubleMatrix2D deleteRow(cern.colt.matrix.DoubleMatrix2D m, int row)
m
- the matrix.row
- the row to delete.
public static cern.colt.matrix.DoubleMatrix2D deleteCol(cern.colt.matrix.DoubleMatrix2D m, int col)
m
- the matrix.col
- the column to delete.
public static double rowsum(cern.colt.matrix.DoubleMatrix2D m, int row)
m
- the matrix.row
- the row.
public static double colsum(cern.colt.matrix.DoubleMatrix2D m, int col)
m
- the matrix.col
- the column.
public static cern.colt.matrix.DoubleMatrix1D rowsum(cern.colt.matrix.DoubleMatrix2D m)
m
- the matrix.
public static cern.colt.matrix.DoubleMatrix1D colsum(cern.colt.matrix.DoubleMatrix2D m)
m
- the matrix.
public static boolean isRowVector(cern.colt.matrix.DoubleMatrix2D m)
m
- the matrix.
public static boolean isColumnVector(cern.colt.matrix.DoubleMatrix2D m)
m
- the matrix.
public static cern.colt.matrix.DoubleMatrix2D makeColumnVector(cern.colt.matrix.DoubleMatrix2D m)
m
-
m.transpose()
if m is a row vector,
m
if m is a column vector.
java.lang.IllegalArgumentException
- if m is not a row vector or a column vector.public static cern.colt.matrix.DoubleMatrix2D makeRowVector(cern.colt.matrix.DoubleMatrix2D m)
m
-
m.transpose()
if m is a column vector,
m
if m is a row vector.
java.lang.IllegalArgumentException
- if m is not a row vector or a column vector.public static double dotproduct(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
m1
- m2
-
public static double dotproduct(cern.colt.matrix.DoubleMatrix1D m1, cern.colt.matrix.DoubleMatrix1D m2)
m1
- m2
-
public static boolean isSymmetric(cern.colt.matrix.DoubleMatrix2D m)
m
- the matrix.
true
if a is symmetric, false
otherwisepublic static void makeMatrixSymmetric(cern.colt.matrix.DoubleMatrix2D m, ColtUtils.MaxMin maxmin)
public static cern.colt.matrix.DoubleMatrix2D normalize(cern.colt.matrix.DoubleMatrix2D m)
m
- the matrix
public static double getMax(cern.colt.matrix.DoubleMatrix2D m)
public static double getMin(cern.colt.matrix.DoubleMatrix2D m)
public static cern.colt.matrix.DoubleMatrix2D ones(int numRows, int numCols)
numRows
- the number of rows.numCols
- the number of columns.
public static cern.colt.matrix.DoubleMatrix2D regLeastSquares(cern.colt.matrix.DoubleMatrix2D A, cern.colt.matrix.DoubleMatrix2D b)
public static cern.colt.matrix.DoubleMatrix2D scale(cern.colt.matrix.DoubleMatrix2D m, double d)
public static cern.colt.matrix.DoubleMatrix1D scale(cern.colt.matrix.DoubleMatrix1D m, double d)
public static cern.colt.matrix.DoubleMatrix2D identity(int m)
public static cern.colt.matrix.DoubleMatrix2D plus(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix2D plusEquals(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix1D plus(cern.colt.matrix.DoubleMatrix1D m1, cern.colt.matrix.DoubleMatrix1D m2)
public static cern.colt.matrix.DoubleMatrix1D plusEquals(cern.colt.matrix.DoubleMatrix1D m1, cern.colt.matrix.DoubleMatrix1D m2)
public static cern.colt.matrix.DoubleMatrix2D minus(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix2D minusEquals(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix1D minus(cern.colt.matrix.DoubleMatrix1D m1, cern.colt.matrix.DoubleMatrix1D m2)
public static cern.colt.matrix.DoubleMatrix1D minusEquals(cern.colt.matrix.DoubleMatrix1D m1, cern.colt.matrix.DoubleMatrix1D m2)
public static cern.colt.matrix.DoubleMatrix2D mult(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix2D transpose(cern.colt.matrix.DoubleMatrix2D m)
public static cern.colt.matrix.DoubleMatrix2D inverse(cern.colt.matrix.DoubleMatrix2D m)
public static double normF(cern.colt.matrix.DoubleMatrix2D m)
public static cern.colt.matrix.DoubleMatrix2D elementMultEquals(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix2D elementMult(cern.colt.matrix.DoubleMatrix2D m1, cern.colt.matrix.DoubleMatrix2D m2)
public static cern.colt.matrix.DoubleMatrix2D diagonalPow(cern.colt.matrix.DoubleMatrix2D m, double exponent)
public static cern.colt.matrix.DoubleMatrix1D to1D(cern.colt.matrix.DoubleMatrix2D m)
public static cern.colt.matrix.DoubleMatrix2D to2D(cern.colt.matrix.DoubleMatrix1D m)
public static cern.colt.matrix.DoubleMatrix2D regLeastSquares(cern.colt.matrix.DoubleMatrix2D A, cern.colt.matrix.DoubleMatrix2D b, double lambda)
public static cern.colt.matrix.DoubleMatrix2D regLeastSquares(cern.colt.matrix.DoubleMatrix2D A, cern.colt.matrix.DoubleMatrix2D b, cern.colt.matrix.DoubleMatrix2D regop)
protected static double gcv(cern.colt.matrix.DoubleMatrix2D A, cern.colt.matrix.DoubleMatrix2D b)
public static double rmse(cern.colt.matrix.DoubleMatrix2D a, cern.colt.matrix.DoubleMatrix2D b)
public static double[] getNonZeros(cern.colt.matrix.DoubleMatrix2D m)
public static double[] getNonZeros(cern.colt.matrix.DoubleMatrix1D m)
public static double sum(cern.colt.matrix.DoubleMatrix2D m)
public static double sum(cern.colt.matrix.DoubleMatrix1D m)
public static cern.colt.matrix.DoubleMatrix2D loadDoubleMatrix2D(java.io.File file)
public static void printSparseMatrix(java.io.PrintStream outStream, cern.colt.matrix.DoubleMatrix2D m)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |