SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.matrixtype.dense
Interface Densifiable

All Known Subinterfaces:
SparseMatrix
All Known Implementing Classes:
BidiagonalMatrix, BorderedHessian, CovarianceMatrix, CsrSparseMatrix, DenseMatrix, DiagonalMatrix, DokSparseMatrix, GoldfeldQuandtTrotter, Gradient, Hessian, HilbertMatrix, Inverse, Jacobian, JordanExchange, KroneckerProduct, LilSparseMatrix, LowerTriangularMatrix, MatthewsDavies, Pow, PseudoInverse, SymmetricMatrix, TridiagonalMatrix, UpperTriangularMatrix

public interface Densifiable

This interface indicates whether a matrix implementation can be efficiently converted to a standard dense matrix representation.

See Also:
DenseMatrix

Method Summary
 DenseMatrix toDense()
          Densify a matrix, i.e., convert a matrix implementation to a standard dense matrix, DenseMatrix.
 

Method Detail

toDense

DenseMatrix toDense()
Densify a matrix, i.e., convert a matrix implementation to a standard dense matrix, DenseMatrix.

This is equivalent to

new DenseMatrix(Matrix A)

Individual matrix implementation may optimize the conversion by taking advantage of having access to the class' private members. In other words, toDense() is in general more efficient than explicit copy construction.

As an example, for some long matrix computations, we may not be sure about the return type. We can always cast it to the standard matrix. That is,

DenseMatrix A = B.multiply(C).add(D).minus(E).toDense();

This statement always works regardless of the types of B, C, D, and E.

Returns:
a matrix representation in DenseMatrix

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.