
上QQ阅读APP看书,第一时间看更新
How it works...
- The signatures for this method constructor are (Column-major dense matrix):
DenseMatrix(int numRows, int numCols, double[] values)
DenseMatrix(int numRows, int numCols, double[] values, boolean isTransposed)
- The method inherits from the following which makes their concrete methods available to all routines:
interface class java.lang.Object
java.io.Serializable
Matrix
- There are several method calls that are of interest:
Generate the diagonal matrix from the supplied values in the vector:
static DenseMatrix(Vector vector)
-
- Create an identity matrix. An identity matrix is a matrix that has diagonals as 1 and any other element as 0:
static eye(int n)
-
- Keep track of whether the matrix is transposed:
boolean isTransposed()
-
- Create a matrix with a set of random numbers - drawn from uniform distribution:
static DenseMatrix rand(int numRows, int numCols, java.util.Random rng)
-
- Create a matrix with a set of random numbers - drawn from gaussian distribution:
static DenseMatrix randn(int numRows, int numCols, java.util.Random rng)
-
- Transpose the matrix:
DenseMatrix transpose()
-
- Make a deep copy of the vector:
DenseVector Copy()
-
- Convert to a SparseVector. You will do this if your vector is long and the density decreases after a number of operations (for example, zero out non-contributing members):
SparseVector toSparse()
-
- Find the number of non-zero elements. This is useful so you can convert on-the-fly to a SparseVector if the density ID is low:
Int numNonzeros()
-
- Get all the values stored in Matrix:
Double[] Values()