//-------------------------------------------------------------------------
 public virtual void coverage()
 {
     coverImmutableBean(DoubleMatrix.EMPTY);
     coverImmutableBean(DoubleMatrix.of(2, 3, 1d, 2d, 3d, 4d, 5d, 6d));
 }
 public virtual void test_of()
 {
     assertMatrix(DoubleMatrix.of());
 }
 //-------------------------------------------------------------------------
 public virtual void test_identity()
 {
     assertMatrix(DoubleMatrix.identity(0));
     assertMatrix(DoubleMatrix.identity(2), 1d, 0d, 0d, 1d);
 }
 //-------------------------------------------------------------------------
 public virtual void test_diagonal()
 {
     assertMatrix(DoubleMatrix.diagonal(DoubleArray.EMPTY));
     assertMatrix(DoubleMatrix.diagonal(DoubleArray.of(2d, 3d, 4d)), 2d, 0d, 0d, 0d, 3d, 0d, 0d, 0d, 4d);
     assertEquals(DoubleMatrix.diagonal(DoubleArray.of(1d, 1d, 1d)), DoubleMatrix.identity(3));
 }
예제 #5
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Transposes the matrix.
 /// <para>
 /// This converts a matrix of {@code m x n} into a matrix of {@code n x m}.
 /// Each element is moved to the opposite position.
 ///
 /// </para>
 /// </summary>
 /// <returns> the transposed matrix </returns>
 public DoubleMatrix transpose()
 {
     return(DoubleMatrix.of(columns, rows, (i, j) => array[j][i]));
 }