Displaying 7 results from an estimated 7 matches for "nnzero".
Did you mean:
nonzero
2024 Nov 11
0
Matrix - querying dsCMatrix how to save it
...ive general question, I allow myself to answer
in public such that the answer my help others as well.
Let's use an example from package 'nadiv':
require(nadiv)
?makeA # to learn about the function
## create a largish example
Awarcol <- makeA(ggTutorial[1:2000, 1:3])
str(Awarcol)
nnzero(Awarcol)
object.size(Awarcol)
object.size(as.matrix(Awarcol)) # ~ 14 times large
image(Awarcol) # wait a bit .. ... but it's worth it!
-------------
> Awarcol <- makeA(ggTutorial[1:2000, 1:3])
> str(Awarcol)
Formal class 'dsCMatrix' [package "Matrix"] with 7 slots...
2009 Oct 22
0
dgTMatrix --- [, , drop=F] strange behavior, Matrix 0.999375-20
...sparse matrix, with the subset being still in
sparse form. Easily achievable with mm[i,,drop=F] , right? Well, it
doesn't work on the matrix I'm working on.
This is a very large wikipedia Matrix (now I can play with it as I just
got 16Gb of memory):
> mm at Dim
[1] 793251 1027355
> nnzero(mm)
[1] 205746204
> class(mm)
[1] "dgTMatrix"
attr(,"package")
[1] "Matrix"
Imagine I want just the first row:
> a = mm[1,,drop=F]
> length(a)
[1] 1027355
> nnzero(a)
[1] 1291
>class(a)
"numeric"
However, _a_ is just a numeric (dense) vector...
2017 Nov 20
2
package check fail on Windows-release only?
....diag.dsC,
.solve.dgC.chol, .solve.dgC.qr, .solve.dgC.lu, diagN2U, diagU2N,
.diagU2N, .diag2tT, .diag2sT, .diag2mat, drop0, expand, expm, facmul,
fac2sparse, fac2Sparse, forceSymmetric, T2graph, graph2T,
anyDuplicatedT, uniqTsparse, isTriangular, isDiagonal, isLDL,
is.null.DN, invPerm, lu, nearPD, nnzero, formatSpMatrix,
formatSparseM, .formatSparseSimple, printSpMatrix, printSpMatrix2,
qrR, rankMatrix, readHB, readMM, sparse.model.matrix, sparseVector,
symmpart, skewpart, tril, triu, updown, pack, unpack,
.updateCHMfactor, .validateCsparse, writeMM, cBind, rBind
ERROR: lazy loading failed for pack...
2017 Oct 21
0
What exactly is an dgCMatrix-class. There are so many attributes.
...se it is based on
sophisticated sparse matrix linear algebra, notably the
sparse Cholesky decomposition for solve() etc.
Of course the efficency only applies if most of the
matrix entries _are_ 0.
You can measure the "sparsity" or rather the "density", of a
matrix by
nnzero(A) / length(A)
where length(A) == nrow(A) * ncol(A) as for regular matrices
(but it does *not* integer overflow)
and nnzero(.) is a simple utility from Matrix
which -- very efficiently for sparseMatrix objects -- gives the
number of nonzero entries of the matrix.
All of these classes are form...
2017 Oct 21
1
What exactly is an dgCMatrix-class. There are so many attributes.
...rse matrix linear algebra, notably the
> sparse Cholesky decomposition for solve() etc.
>
> Of course the efficency only applies if most of the
> matrix entries _are_ 0.
> You can measure the "sparsity" or rather the "density", of a
> matrix by
>
> nnzero(A) / length(A)
>
> where length(A) == nrow(A) * ncol(A) as for regular matrices
> (but it does *not* integer overflow)
> and nnzero(.) is a simple utility from Matrix
> which -- very efficiently for sparseMatrix objects -- gives the
> number of nonzero entries of the matrix.
>...
2017 Oct 20
4
What exactly is an dgCMatrix-class. There are so many attributes.
Thank you for your responses.
I guess I don't feel alone. I don't find the documentation go into any
detail.
I also find it surprising that,
> object.size(train$data)
1730904 bytes
> object.size(as.matrix(train$data))
6575016 bytes
the dgCMatrix actually takes less memory, though it *looks* like the
opposite.
Cheers!
On Fri, Oct 20, 2017 at 3:22 PM, David Winsemius
2017 Nov 21
0
package check fail on Windows-release only?
...dgC.qr, .solve.dgC.lu, diagN2U, diagU2N,
> .diagU2N, .diag2tT, .diag2sT, .diag2mat, drop0, expand, expm, facmul,
> fac2sparse, fac2Sparse, forceSymmetric, T2graph, graph2T,
> anyDuplicatedT, uniqTsparse, isTriangular, isDiagonal, isLDL,
> is.null.DN, invPerm, lu, nearPD, nnzero, formatSpMatrix,
> formatSparseM, .formatSparseSimple, printSpMatrix, printSpMatrix2,
> qrR, rankMatrix, readHB, readMM, sparse.model.matrix, sparseVector,
> symmpart, skewpart, tril, triu, updown, pack, unpack,
> .updateCHMfactor, .validateCsparse, writeMM, cBind, rBind...