search for: spmatrix

Displaying 19 results from an estimated 19 matches for "spmatrix".

Did you mean: pmatrix
2007 May 03
1
Issue with the Matrix package
Hi all, I am wondering if this is a bug in the Matrix package or if it something that I am just getting wrong...here is an example: > m = matrix(0,4,4) > dimnames(m) = list(letters[1:4], letters[5:8]) > r = c("a","b","a","d") > m[r,2] = 1 > m e f g h a 0 1 0 0 b 0 1 0 0 c 0 0 0 0 d 0 1 0 0 > M = Matrix(0,4,4) > dimnames(M) =
2009 May 15
1
Matrix package,solve() errors and crashes Please help
.../r-recipes#toc6 *bonpow.sparse <- function(graph, nodes=V(graph), loops=FALSE, exponent=1, rescale=TRUE, tol=1e-07) {* * ## remove loops if requested * * ## sparse adjacency matrix d <- get.adjacency(graph, sparse=TRUE)* * ## sparse identity matrix id <- spMatrix(vcount(graph), vcount(graph), i=1:vcount(graph), j=1:vcount(graph), x=rep(1, vcount(graph))) id <- as(id, "dgCMatrix")* * ## solve it ev <- solve(id - exponent * d, tol=tol) %*% degree(graph, mode="all")* * if (rescale) { ev <...
2012 Oct 09
4
Convert COLON separated format
I have a bunch of data sets that were created for the libsvm tool. They are in "colon separated sparse format". i.e. 1 5:1 27:3 345:10 Is a row with the label of "1" and only has values in columns 5, 27, and 345. I want to read these into a data.frame in R. Is there a simple way to do this? -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences
2010 Apr 28
1
function which saves an image of a dgtMatrix as png
Hi, I'm getting crazy: This does work: library(Matrix) a1<-b1<-c(1,2) c1<-rnorm(2) aDgt<-spMatrix(ncol=3,nrow=3,i=a1,j=b1,x=c1) png("myImage.png") image(aDgt) dev.off() But this doesn't !!! f<-function(x){ png("myImage.png") image(x) dev.off() } f(aDgt) My image is saved as a text file and contains nothing at all !!! Thanks in advance, Gildas Mazo
2011 Dec 20
1
column permutation of sparse matrix
Hi, I'm very new to working with sparse matrices and would like to know how I can column permute a sparse matrix. Here is a small example: > M1 <- > spMatrix(nrow=5,ncol=6,i=sample(5,15,replace=TRUE),j=sample(6,15,replace=TRUE),x=round_any(rnorm(15,2),0.001)) > M1 5 x 6 sparse Matrix of class "dgTMatrix" [1,] 2.983 . 1.656 5.003 . . [2,] . . 2.990 . . . [3,] . 0.592 5.3...
2017 Nov 20
2
package check fail on Windows-release only?
...'as.vector.Matrix', 'as.vector.sparseVector' were declared in NAMESPACE but not found Error in namespaceExport(ns, exports) : undefined exports: %&%, Cholesky, .SuiteSparse_version, Diagonal, .symDiagonal, .sparseDiagonal, .trDiagonal, Hilbert, KhatriRao, Matrix, MatrixClass, spMatrix, sparseMatrix, rsparsematrix, Schur, abIseq, abIseq1, rep2abI, band, bandSparse, bdiag, .bdiag, c.sparseVector, condest, onenormest, .asmatrix, .dsy2mat, .dsy2dsp, .dxC2mat, .T2Cmat, ..2dge, .dense2sy, .C2nC, .nC2d, .nC2l, .diag.dsC, .solve.dgC.chol, .solve.dgC.qr, .solve.dgC.lu, diagN2U, diagU2N,...
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 tried to redu...
2010 Feb 24
1
Sparse KMeans/KDE/Nearest Neighbors?
hi, I have a dataset (the netflix dataset) which is basically ~18k columns and well variable number of rows but let's assume 25 thousand for now. The dataset is very sparse. I was wondering how to do kmeans/nearest neighbors or kernel density estimation on it. I tired using the spMatrix function in "Matrix" package. I think I'm able to create the matrix but as soon as I pass it to kmeans functions in package "stats" it says cannot allocate 3.3Gb. Which is basically 18k * 25K * 8. There is a sparse kmeans solver by tibshirani but that epxects a regular dens...
2009 Oct 24
1
operations on sparse matrices, and dense intermediary steps
...Does it have to do with features of the language, such as pass-by-value bu default? Or am I doing something inneficent without knowing? (Note: example below would only work with 64bit R and lots of memory; reduce size of matrix 2-3 orders of magnitude for 32-bit R) ## libraries library(Matrix) rSpMatrix <- function(nrow, ncol, nnz, rand.x = function(n) round(rnorm(nnz), 2)) { ## Purpose: random sparse matrix ## ---------------------------------------------------------------------- ## Arguments: (nrow,ncol): dimension ## nnz : number of non-zero entries ## rand.x: r...
2009 Feb 19
4
Matrix package: band matrix
I want to construct a symmetric band matrix in the Matrix package from a matrix where the first column contains data for the main diagonal, the second column has data for the first subdiagonal/superdiagonal and so on. Since the Matrix will be 10^5 x 10^5 or so, with perhaps 10-20 non-zero elements above the diagonal per row, I can't do it by constructing a full matrix and then using the
2009 Apr 20
1
Matrix package,solve() errors and crashes
...exponent=1, rescale=FALSE, tol=1e-07) { ## remove loops if requested if (!loops) { graph <- simplify(graph, remove.multiple=FALSE, remove.loops=TRUE) } ## sparse adjacency matrix d <- get.adjacency(graph, sparse=TRUE) ## sparse identity matrix id <- spMatrix(vcount(graph), vcount(graph), i=1:vcount(graph), j=1:vcount(graph), x=rep(1, vcount(graph))) id <- as(id, "dgCMatrix") ## solve it ev <- solve(id - exponent * d, tol=tol) %*% degree(graph, mode="out") if (rescale) { ev <-...
2007 Jul 14
0
Extending Matrix class
...; Matrix, e.g., we do not know if it is a dgCMatrix or a IF> lgCMatrix or ...). Is there a (simple) solution? Well, yes, but probably not the one you had wanted: setClass("TD_Matrix", representation(data = "Matrix", Weighting = "character")) A <- spMatrix(10,20, i = c(1,3:8), j = c(2,9,6:10), x = 7 * (1:7)) tdr <- new("TD_Matrix", data = A, Weighting = "foobar") tdr ---------------- Now I understand that and why you had wanted to do this the original way you did - which cannot work AFAICS. OTOH, I...
2009 Apr 17
0
Matrix package,solve() errors and crashes"
...exponent=1, rescale=FALSE, tol=1e-07) { ## remove loops if requested if (!loops) { graph <- simplify(graph, remove.multiple=FALSE, remove.loops=TRUE) } ## sparse adjacency matrix d <- get.adjacency(graph, sparse=TRUE) ## sparse identity matrix id <- spMatrix(vcount(graph), vcount(graph), i=1:vcount(graph), j=1:vcount(graph), x=rep(1, vcount(graph))) id <- as(id, "dgCMatrix") ## solve it ev <- solve(id - exponent * d, tol=tol) %*% degree(graph, mode="out") if (rescale) { ev <-...
2011 Apr 20
1
Matrix package transpose
Hi, Since I installed R 2.13 I cannot use the transpose method "t" on sparse matrices inside my package. Outside the package works. Is there something new that I have to import methods? Can I then import everything from the Matrix package? The problem is that R tries to use t.default which of course doesn't work. Happy easter, Tobias -- Tobias Abenius Ph.D. Student, M.Sc. in
2017 Nov 21
0
package check fail on Windows-release only?
....sparseVector' were declared in > NAMESPACE but not found > Error in namespaceExport(ns, exports) : > undefined exports: %&%, Cholesky, .SuiteSparse_version, Diagonal, > .symDiagonal, .sparseDiagonal, .trDiagonal, Hilbert, KhatriRao, > Matrix, MatrixClass, spMatrix, sparseMatrix, rsparsematrix, Schur, > abIseq, abIseq1, rep2abI, band, bandSparse, bdiag, .bdiag, > c.sparseVector, condest, onenormest, .asmatrix, .dsy2mat, .dsy2dsp, > .dxC2mat, .T2Cmat, ..2dge, .dense2sy, .C2nC, .nC2d, .nC2l, .diag.dsC, > .solve.dgC.chol, .solve.dgC.q...
2008 Mar 28
0
"The Matrix" is approaching version 1.0-0
...rse, two-way contingency tables and coercion of one *factor* (possibly crossed with one <numeric>) to the corresponding (potentially huge) sparse model matrix for sparse least squares and related computations. Further to the above, "Matrix" objects are also constructed by Matrix(), spMatrix(), bdiag() {block-diagonal}, Diagonal() and many as(., "....Matrix") possibilities. The Matrix package also provides a C level API (header files of exported C functions providing low-level functionality) to many of its internal algorithms that other packages can link to. Currently, the...
2008 Mar 28
0
"The Matrix" is approaching version 1.0-0
...rse, two-way contingency tables and coercion of one *factor* (possibly crossed with one <numeric>) to the corresponding (potentially huge) sparse model matrix for sparse least squares and related computations. Further to the above, "Matrix" objects are also constructed by Matrix(), spMatrix(), bdiag() {block-diagonal}, Diagonal() and many as(., "....Matrix") possibilities. The Matrix package also provides a C level API (header files of exported C functions providing low-level functionality) to many of its internal algorithms that other packages can link to. Currently, the...
2012 Jul 24
1
igraph build problems
...ularity.o other.o pottsmodel_2.o progress.o qsort.o qsort_r.o random.o revolver_cit.o revolver_grow.o revolver_ml_cit.o rinterface.o scg.o scg_approximate_methods.o scg_exact_scg.o scg_kmeans.o scg_optimal_method.o scg_utils.o second.o separators.o spanning_trees.o sparsemat.o spectral_properties.o spmatrix.o st-cuts.o statusbar.o structural_properties.o structure_generators.o sugiyama.o topology.o type_indexededgelist.o types.o vector.o vector_ptr.o version.o visitors.o walktrap.o walktrap_communities.o walktrap_graph.o walktrap_heap.o zeroin.o -lxml2 -lgmp -lgfortran -lm -llapack -lblas -lgfortran -...
2007 May 16
3
Reshape a sparse matrix
Hi, I'd like to reshape a sparse matrix generated from the Matrix package. I can't seem to do it with the command dim(A) <- c(6,9) which works perfectly with the base package matrices, but with the sparse matrices it errors with Error in dim(A) = c(6, 9) : dim<- : invalid first argument Manipulating the Dim attribute of the sparse Matrix does not produce the desired effect. A