Package org.jblas
Class Geometry
- java.lang.Object
-
- org.jblas.Geometry
-
public class Geometry extends java.lang.Object
General functions which are geometric in nature.
For example, computing all pairwise squared distances between all columns of a matrix.
-
-
Constructor Summary
Constructors Constructor Description Geometry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DoubleMatrix
center(DoubleMatrix x)
Center a vector (subtract mean from all elements (in-place).static FloatMatrix
center(FloatMatrix x)
Center a vector (subtract mean from all elements (in-place).static DoubleMatrix
centerColumns(DoubleMatrix x)
Center the columns of a matrix (in-place).static FloatMatrix
centerColumns(FloatMatrix x)
Center the columns of a matrix (in-place).static DoubleMatrix
centerRows(DoubleMatrix x)
Center the rows of a matrix (in-place).static FloatMatrix
centerRows(FloatMatrix x)
Center the rows of a matrix (in-place).static DoubleMatrix
normalize(DoubleMatrix x)
Normalize a vector (scale such that its Euclidean norm is 1) (in-place).static FloatMatrix
normalize(FloatMatrix x)
Normalize a vector (scale such that its Euclidean norm is 1) (in-place).static DoubleMatrix
normalizeColumns(DoubleMatrix x)
Normalize the columns of a matrix (in-place).static FloatMatrix
normalizeColumns(FloatMatrix x)
Normalize the columns of a matrix (in-place).static DoubleMatrix
normalizeRows(DoubleMatrix x)
Normalize the rows of a matrix (in-place).static FloatMatrix
normalizeRows(FloatMatrix x)
Normalize the rows of a matrix (in-place).static DoubleMatrix
pairwiseSquaredDistances(DoubleMatrix X, DoubleMatrix Y)
Compute the pairwise squared distances between all columns of the two matrices.static FloatMatrix
pairwiseSquaredDistances(FloatMatrix X, FloatMatrix Y)
Compute the pairwise squared distances between all columns of the two matrices.
-
-
-
Method Detail
-
pairwiseSquaredDistances
public static DoubleMatrix pairwiseSquaredDistances(DoubleMatrix X, DoubleMatrix Y)
Compute the pairwise squared distances between all columns of the two matrices.
An efficient way to do this is to observe that (x-y)^2 = x^2 - 2xy - y^2 and to then properly carry out the computation with matrices.
-
center
public static DoubleMatrix center(DoubleMatrix x)
Center a vector (subtract mean from all elements (in-place).
-
centerRows
public static DoubleMatrix centerRows(DoubleMatrix x)
Center the rows of a matrix (in-place).
-
centerColumns
public static DoubleMatrix centerColumns(DoubleMatrix x)
Center the columns of a matrix (in-place).
-
normalize
public static DoubleMatrix normalize(DoubleMatrix x)
Normalize a vector (scale such that its Euclidean norm is 1) (in-place).
-
normalizeRows
public static DoubleMatrix normalizeRows(DoubleMatrix x)
Normalize the rows of a matrix (in-place).
-
normalizeColumns
public static DoubleMatrix normalizeColumns(DoubleMatrix x)
Normalize the columns of a matrix (in-place).
-
pairwiseSquaredDistances
public static FloatMatrix pairwiseSquaredDistances(FloatMatrix X, FloatMatrix Y)
Compute the pairwise squared distances between all columns of the two matrices.
An efficient way to do this is to observe that (x-y)^2 = x^2 - 2xy - y^2 and to then properly carry out the computation with matrices.
-
center
public static FloatMatrix center(FloatMatrix x)
Center a vector (subtract mean from all elements (in-place).
-
centerRows
public static FloatMatrix centerRows(FloatMatrix x)
Center the rows of a matrix (in-place).
-
centerColumns
public static FloatMatrix centerColumns(FloatMatrix x)
Center the columns of a matrix (in-place).
-
normalize
public static FloatMatrix normalize(FloatMatrix x)
Normalize a vector (scale such that its Euclidean norm is 1) (in-place).
-
normalizeRows
public static FloatMatrix normalizeRows(FloatMatrix x)
Normalize the rows of a matrix (in-place).
-
normalizeColumns
public static FloatMatrix normalizeColumns(FloatMatrix x)
Normalize the columns of a matrix (in-place).
-
-