Displaying 2 results from an estimated 2 matches for "dsrmatrix".
Did you mean:
dscmatrix
2016 Apr 19
2
Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
.....$ : NULL
.. ..$ : NULL
..@ x : num [1:3] 1 1 1
..@ factors : list()
When I try to do the analogue for a row-oriented matrix, I get a
"dgTMatrix", whereas I would expect a "dgRMatrix":
> Cr <- Matrix(0, nrow=5, ncol=5, sparse=TRUE)
> Cr <- as(Cr, "dsRMatrix")
> Cr[1,1:3] <- 1
> Cr
5 x 5 sparse Matrix of class "dgTMatrix"
[1,] 1 1 1 . .
[2,] . . . . .
[3,] . . . . .
[4,] . . . . .
[5,] . . . . .
> str(Cr)
Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
..@ i : int [1:3] 0 0 0
..@ j...
2016 Apr 20
0
Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
...: num [1:3] 1 1 1
> ..@ factors : list()
> When I try to do the analogue for a row-oriented matrix, I get a
> "dgTMatrix", whereas I would expect a "dgRMatrix":
>> Cr <- Matrix(0, nrow=5, ncol=5, sparse=TRUE)
>> Cr <- as(Cr, "dsRMatrix")
>> Cr[1,1:3] <- 1
>> Cr
> 5 x 5 sparse Matrix of class "dgTMatrix"
> [1,] 1 1 1 . .
> [2,] . . . . .
> [3,] . . . . .
> [4,] . . . . .
> [5,] . . . . .
The reason for the above behavior has been
a) efficiency. All...