1. Home
  2. ASReml-R 4 Commands
  3. sp2Matrix – Convert sparse matrix

sp2Matrix – Convert sparse matrix


sp2Matrix converts a sparse matrix in three column coordinate form to a Matrix object.

sp2Matrix(x, dense = FALSE, triplet = FALSE)
x A three column matrix containing the row and column indices and the matrix element, respectively, of the sparse matrix.
dense If TRUE (the default is FALSE), the result is stored as a dense symmetric dspMatrix object, otherwise a sparse symmetric matrix.
triplet If TRUE (the default is FALSE), the result is a CsparseMatrix, otherwise a TsparseMatrix (triplet form).

If the sparse matrix inherits class ginv, the returned object preserves the A-1 attributes.


Updated on June 22, 2021

Was this article helpful?

Related Articles