R: Convert sparse matrix to 'Matrix' object

sp2Matrix {asreml} | R Documentation

## Convert sparse matrix to `Matrix` object

### Description

Function that converts a sparse matrix in three-column coordinate form to a `Matrix` object.

### Usage

    sp2Matrix(x, dense = FALSE, triplet = FALSE)

### Arguments

`x` | A three-column matrix containing the row and column indices and the matrix element, respectively, of the sparse matrix.
`dense` | If `TRUE`, the result is stored as a dense symmetric `dspMatrix` object, otherwise a sparse symmetric matrix (`dsCMatrix` or `dsTMatrix`, depending on the choice of the `triple` argument) is returned (default = `FALSE`).
`triplet` | If `TRUE`, the result is a `dsTMatrix` object (triplet form), otherwise a `dsCMatrix` object is returned (default = `FALSE`).

### Details

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

[Package asreml version 4.2.0.480 Index]