search for: sparsematrix

Displaying 20 results from an estimated 65 matches for "sparsematrix".

2012 Mar 04
0
Matrix Package, sparseMatrix, more NaN's than zeros
Hello, I have a lot of data and it has a lot of NaN values. I want to compress the data so I don't have memory issues later. Using the Matrix package, sparseMatrix function, and some fiddling around, I have successfully reduced the 'size' of my data (as measured by object.size()). However, NaN values are found all over in my data and zeros are important, but zeros are found very infrequently in my data. So I turn NaN's into zeros and zeros into ve...
2017 Feb 22
0
Crash in the latest release
...scal) ~ Asym|Tree, + Orange, start = startvec)) ==31901== Invalid write of size 4 ==31901== at 0xA13DA20: cholmod_start (cholmod_common.c:184) ==31901== by 0xD8B3065: cholmod_start (in /home/therneau/Rlib/lme4/libs/lme4.so) ==31901== by 0xD8B728D: Eigen::CholmodBase<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::CholmodDecomposition<Eigen::SparseMatrix<double, 0, int>, 1> >::CholmodBase() (in /home/therneau/Rlib/lme4/libs/lme4.so) ==31901== by 0xD8B413D: Eigen::CholmodDecomposition<Eigen::SparseMatrix<double, 0, int>, 1>::CholmodDecompositio...
2017 Feb 22
0
[Lme4-authors] Crash in the latest release
...Orange, start = startvec)) > ==31901== Invalid write of size 4 > ==31901== at 0xA13DA20: cholmod_start (cholmod_common.c:184) > ==31901== by 0xD8B3065: cholmod_start (in > /home/therneau/Rlib/lme4/libs/lme4.so) > ==31901== by 0xD8B728D: Eigen::CholmodBase<Eigen::SparseMatrix<double, 0, > int>, 1, Eigen::CholmodDecomposition<Eigen::SparseMatrix<double, 0, int>, 1> >>::CholmodBase() (in /home/therneau/Rlib/lme4/libs/lme4.so) > ==31901== by 0xD8B413D: > Eigen::CholmodDecomposition<Eigen::SparseMatrix<double, 0, int>, > 1>...
2016 Apr 20
0
Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
...: The above use of Matrix() is seen in many places, and is fine for small matrices and the case where you only use the `[<-` method very few times (as above). Also using Matrix() is nice when being introduced to using the Matrix package. However, for efficience in non-small cases, do use sparseMatrix() directly to construct sparse matrices. >> Cc > 5 x 5 sparse Matrix of class "dgCMatrix" > [1,] 1 . . . . > [2,] 1 . . . . > [3,] 1 . . . . > [4,] . . . . . > [5,] . . . . . >> str(Cc) > Formal class 'dgCMatrix&...
2016 Apr 19
2
Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
Using the Matrix package, how can I create a row-oriented sparse Matrix from scratch populated with some data? By default a column-oriented one is created and I'm aware of the note that the package is optimized for column-oriented ones, but I'm only interested in using it for holding my sparse row-oriented data and doing basic subsetting by rows (even using drop=FALSE). Here is what I
2009 Aug 26
1
Problem with standard generic methods in Matrix package
I have posted this message on r-lang, but it is perhaps more appropriate on r-devel: --- Hello, I'm puzzled by a problem with call to diag(), rowSums(), rownames() on objects of class "dgtMatrix", created by sparseMatrix() or spMatrix(). I use Matrix 0.999375-30. The weird thing is that I don't encounter any problem when I use this functions on the R prompt, or source()-ing a script file; I encounter problems when the code is in a package, installed with R CMD INSTALL, and loaded with library(). I have...
2011 Oct 06
0
linear classifiers with sparse matrices
...ernlab, it seems I have to coerce my data into a dense matrix in order to train a model. I've done a number of searches, read through the manuals and vignettes, but I can't seem to see how to use either of these packages with sparse matrices. I've tried using both csr from SparseM and sparseMatrix from the Matrix library. You can see a simple example recreating my results below. Does anybody know if there's a trick to get this to work without coercing the data into a dense matrix? I'm currently playing with the KDDCUP 2010 datasets. I've written a simple script to create hash...
2011 Nov 22
3
On-demand importing of a package
...x. Matrix is so included in the 'Suggests' line. I load Matrix via require(), from the functions that really need it. This mostly works fine, but I have an issue now that I cannot sort out. If I define a function like this in my package: f <- function() { require(Matrix) res <- sparseMatrix(dims=c(5, 5), i=1:5, j=1:5, x=1:5) y <- rowSums(res) res / y } then calling it from the R prompt I get Error in rowSums(res) : 'x' must be an array of at least two dimensions which basically means that the rowSums() in the base package is called, not the S4 generic in the Matrix pa...
2007 May 27
2
[Bioc-devel] promptClass
promptClass fails to identify methods associated with the class. Here is a fix: Index: promptClass.R =================================================================== --- promptClass.R (revision 41719) +++ promptClass.R (working copy) @@ -165,7 +165,7 @@ if (nmeths > 0) { .meths.body <- " \\describe{" for (i in 1:nmeths) { - .sigmat
2006 Dec 19
1
preserving sparse matrices (Matrix)
Hi, I have sparse (tridiagonal) matrices, and I use the Matrix package for handling them. For certain computations, I need to either set the first row to zero, or double the last row. I find that neither operation preserves sparsity, eg > m <- Diagonal(5) > m 5 x 5 diagonal matrix of class "ddiMatrix" [,1] [,2] [,3] [,4] [,5] [1,] 1 . . . . [2,] . 1
2010 Dec 08
2
problem accessing complex list data frames
Hi all. I am currently attempting to build a list of sparse matrixes. That I have already achieved, by > vmat <- list() > for (i in 1:n) { > vmat <- c(vmat, sparseMatrix(i,j,x=data) > } How I am trying to select those elements from the list where the column e.g. 999 is not null. I can do this for one of the sparse matrices with > which(vmat[[1]][,999] != 0) which returns the rows where such column is non-zero. However, my purpose is to obtain the list ind...
2016 Apr 20
6
Solving sparse, singular systems of equations
...or and one of which succeeds on the simplified problem, but fails on my data set(attached). Is there a solver in R that I can use in order to get x without any errors given the structure of A? Thanks for your time. #CODE STARTS HEREA = as(matrix(c(1.5,-1.5,0,-1.5,2.5,-1,0,-1,1),nrow=3,ncol=3),"sparseMatrix")b = matrix(c(-30,40,-10),nrow=3,ncol=1) #solve for x, Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)solve(A,b,sparse=TRUE,tol=.Machine$double.eps) #one x that happens to solve Ax = bx = matrix(c(-10,10,0),nrow=3,ncol=1)A %*% x #Error in lsfit(A, b) : only 3 cases, bu...
2017 Oct 21
0
What exactly is an dgCMatrix-class. There are so many attributes.
...e_ 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 formally defined classes and have therefore help pages. Here ?dgCMatrix-class which then points to ?CsparseMatrix-class (and I forget if Rstudio really helps you find these ..; in emacs ESS they are foun...
2009 May 13
2
Optimization algorithm to be applied to S4 classes - specifically sparse matrices
...: SUM ((A%*%X - B)^2) where A is a matrix and X and B are vectors, with X as parameter vector. This has worked well so far. Recently, I was given a data set A of size 360440 x 1173, which could not be handled as a normal matrix. I brought it into 'R' as a sparse matrix (dgCMatrix - using sparseMatrix from the Matrix package), and the formul? and gradient work, but /optim/ returns an error of the form "no method for coercing this S4 class to a vector". After briefly looking into methods and classes, I realize I am in way over my head. Is there any way I could use /optim/ or another op...
2012 Apr 12
3
writing spdiags function for R
...(mainly because I am a big of fan of R, and folks will not have to pay to use it :). In the translation of this function I got stack because they use spdiags, which, as far as I can tell it is not available in R. I have explored the Matrix package, from which I borrowed some of the functions (e.g., sparseMatrix), but I could not actually find an equivalent to spdiags (please, let me know if it is there somewhere). So, I have written my own spdiags function (below); following also a suggestion in an old, and perhaps unique post, about this issue. It works only for square matrices (that's my need), ho...
2017 Oct 21
1
What exactly is an dgCMatrix-class. There are so many attributes.
...ty" 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 formally defined classes and have > therefore help pages. Here ?dgCMatrix-class which then points > to ?CsparseMatrix-class (and I forget if Rstudio really helps > you find these ..;...
2009 Jan 20
1
Creating a Sparse Matrix from a Sparse Vector
Hello, I am working with a sparse matrix that is approx. 13,900 by 14,100. My goal is to select a row out of the matrix and create a new matrix with that row repeated 13,900 times without having to do any looping. Example: Starting Matrix: exampleMatrix 3 x 4 sparse Matrix of class "dgCMatrix" [1,] 1 . . . [2,] . 1 . 0.5 [3,] . . 1 .. New Matrix:.. newExampleMatrix 3 x 4 sparse
2010 Dec 09
1
problem on Matrix package~~
...tered a problem "not-yet-implemented method for <list> %*% <dgCMatrix>" when I tried "diagr %*% design_mat", where "diagr<-diag(vr,100)", vr is a vector with 100 elements, and design_mat is a sparse matrix with dimension 100*677000 constructed by calling sparseMatrix(). I am new to the Matrix package, so I am confused with this, and I need your help~~ Thanks! best regards! June ---------------- Zhu Man, (TEL)13851764837 School of Computer Science & Engineering Southeast University, Nanjing [[alternative HTML version deleted]]
2009 Oct 23
1
inspect s4 methods
..."summary.lm". But what if I want to see what summarizing a model fit with lmer() (lme4 package) does? showMethods(summary) Function: summary (package base) object="ANY" object="character" (inherited from: object="ANY") object="mer" object="sparseMatrix" object="summary.mer" tells me there is a "mer" method, but "summary.mer" gives me no joy. How can I see what summary.mer does? Do I have to inspect the source code? -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psycho...
2010 Aug 19
1
Converting sparse matrix to data.frame in Matrix package
I am able to create a coordinate list sparse matrix this way: r = c(1,2,2,3,3) c = c(4,1,2,3,5) v = c(1,2,1,3,1) a = sparseMatrix(i=r,j=c,x=v) However, this results in an object that looks like this: a 3 x 5 sparse Matrix of class "dgCMatrix" [1,] . . . 1 . [2,] 2 1 . . . [3,] . . 3 . 1 How do I convert this object into a data.frame that would look like this: data.frame(a=c(0,2,0),b=c(0,1,0),c=c(...