search for: dgtmatrix

Displaying 20 results from an estimated 25 matches for "dgtmatrix".

Did you mean: dgcmatrix
2006 Jul 09
1
package:Matrix handling of data with identical indices
In the Matrix package v. 0.995-11 I see that the dgTMatrix Class for compressed, sparse, triplet-form matrices handles Identically indexed data instances by summing their values, e.g., library(Matrix) (Mt <- new("dgTMatrix", i = as.integer(c(0,0,1,1,4)), j = as.integer(c(0,1,2,2,4)), x = as.double(1:5), Dim = as.integer(c(5,5)))...
2006 Jul 09
1
package:Matrix handling of data with identical indices
In the Matrix package v. 0.995-11 I see that the dgTMatrix Class for compressed, sparse, triplet-form matrices handles Identically indexed data instances by summing their values, e.g., library(Matrix) (Mt <- new("dgTMatrix", i = as.integer(c(0,0,1,1,4)), j = as.integer(c(0,1,2,2,4)), x = as.double(1:5), Dim = as.integer(c(5,5)))...
2009 Oct 22
0
dgTMatrix --- [, , drop=F] strange behavior, Matrix 0.999375-20
...se 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 (!). This takes a long time and a big bite off my me...
2016 Apr 19
2
Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
...;] with 6 slots ..@ i : int [1:3] 0 1 2 ..@ p : int [1:6] 0 3 3 3 3 3 ..@ Dim : int [1:2] 5 5 ..@ Dimnames:List of 2 .. ..$ : 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,...
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
2007 May 16
3
Reshape a sparse matrix
...valid first argument Manipulating the Dim attribute of the sparse Matrix does not produce the desired effect. A at Dim <- c(as.integer(9),as.integer(6)) does not produce a column ordering result, which I am assuming is because the data is stored in a row (i) and column (j) format instead (class dgTMatrix) Does a function for this exist? -Scott
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) =
2011 Dec 20
1
column permutation of sparse matrix
...ew 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.349 1.115 . . [4,] 1.836 . 2.804 . . . [5,] . 6.961 . . . 1.077 I know I c...
2016 Apr 20
0
Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
...: int [1:6] 0 3 3 3 3 3 > ..@ Dim : int [1:2] 5 5 > ..@ Dimnames:List of 2 > .. ..$ : 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 ....
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 l...
2006 Jul 28
1
arules package: using image() deliveres unexpected results
Dear Collegues, it seems like there is a problem with the image()-method in the package arules. Using an ordninary matrix works fine: image(matrix(rnorm(200), 10, 20), axes = FALSE, col=brewer.pal(9, "Blues") ) delivers an image with blue colors and no axes. Using an object of the class "associations" (arules package) does not work: image(items(ta.eclat), axes = FALSE,
2006 Jul 06
1
Warning while subsetting using Matrix package
...ain the following warning while subsetting in the Matrix package? Thanks, John Thaden, PhD U. Arkansas for Med. Sci. Little Rock AR USA > # In the Matrix package... > library("Matrix") > # ...I had previously created a sparse matrix in triplet form: > str(x) Formal class 'dgTMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:923636] 1 2 3 4 5 6 7 8 9 10 ... ..@ j : int [1:923636] 1 1 1 1 1 1 1 1 1 1 ... ..@ Dim : int [1:2] 600 4482 ..@ Dimnames:List of 2 .. ..$ : chr [1:601] "50" "51" "52" "53&quot...
2007 May 15
1
Matrix package: writeMM
Hi, I'm finding that readMM() cannot read a file written with writeMM(). Example: library(Matrix) a = Matrix(c(1,0,3,0,0,5), 10, 10) a = as(a, "CsparseMatrix") writeMM(a, "kk.mm") b = readMM("kk.mm") Error in validObject(.Object) : invalid class "dgTMatrix" object: all row indices must be between 0 and nrow-1 Thoughts? Thanks, -Jose -- Jose Quesada, PhD. http://www.andrew.cmu.edu/~jquesada
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
2012 Jan 18
1
kmeans clustering on large but sparse matrix
Hi, I have a 60k*600k matrix, which exceed the vector length limit of 2^32-1. But it's rather sparse, only 0.02% has value. So I save is as MarketMatrix (mm) file, it's about 300M in size. I use readMM in Matrix package to read it in. If do so, the data type becomes dgTMatrix in 'Matrix' package instead of the common matrix type. The problem is, if I run k-means only on part of the data, to make sure the vector length do not exceed 2^32-1, there's no problem at all. Meaning that the kmeans in R could recognize this type of matrix. If I run the entire matrix...
2009 Feb 11
1
Problem with R using pgi compiler on x86_64
...ix" everything is fine until the last step. make[1]: Leaving directory `/tmp/R.INSTALL.TW3399/Matrix/src/AMD' pgCC -L/usr/lib64 -L/usr/X11R6/lib64 -pgf90libs -o Matrix.so CHMfactor.o Csparse.o TMatrix_as.o Tsparse.o init.o Mutils.o chm_common.o cs.o cs_utils.o dense.o dgCMatrix.o dgTMatrix.o dgeMatrix.o dpoMatrix.o dppMatrix.o dsCMatrix.o dsyMatrix.o dspMatrix.o dtCMatrix.o dtTMatrix.o dtrMatrix.o dtpMatrix.o factorizations.o ldense.o lgCMatrix.o sparseQR.o SPQR.a CHOLMOD.a COLAMD.a AMD.a -L/usr/local/apps/R/R-2.8.1/lib64/R/lib -lRlapack -lRblas -lpgf90 -lpgf90_rpm1 -lpgf902 -lp...
2010 Dec 01
1
Install package 'Matrix' problem
...a recommended package called Matrix. The compilation failed with the following messages, ....... CC -library=stlport4 -G -L/opt/csw/lib/sparcv9 -L/opt/solstudio12.2/prod/lib/v9 -o Matrix.so CHMfactor.o Csparse.o TMatrix_as.o Tsparse.o init.o Mutils.o chm_common.o cs.o cs_utils.o dense.o dgCMatrix.o dgTMatrix.o dgeMatrix.o dpoMatrix.o dppMatrix.o dsCMatrix.o dsyMatrix.o dspMatrix.o dtCMatrix.o dtTMatrix.o dtrMatrix.o dtpMatrix.o factorizations.o ldense.o lgCMatrix.o sparseQR.o abIndex.o CHOLMOD.a COLAMD.a AMD.a -L/apps/sparcv9/R-2.12.0/lib/R/lib -lRlapack -L/apps/sparcv9/R-2.12.0/lib/R/lib -lRblas -lifa...
2009 Feb 21
1
R-devel/Linux x64/Sun Studio 12: Problem with Matrix
...following message. The error occurs during building of the recommended packages and also if Matrix is compiled separately: [...] CC -G -lCstd -L/opt/sun/sunstudio12/lib/amd64 -o Matrix.so CHMfactor.o Csparse.o TMatrix_as.o Tsparse.o init.o Mutils.o chm_common.o cs.o cs_utils.o dense.o dgCMatrix.o dgTMatrix.o dgeMatrix.o dpoMatrix.o dppMatrix.o dsCMatrix.o dsyMatrix.o dspMatrix.o dtCMatrix.o dtTMatrix.o dtrMatrix.o dtpMatrix.o factorizations.o ldense.o lgCMatrix.o sparseQR.o CHOLMOD.a COLAMD.a AMD.a -L/home/user/R/R-devel/lib -lRlapack -L/home/user/R/R-devel/lib -lRblas -R/opt/sun/sunstudio12/lib/amd6...
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
2008 Jun 17
0
Quickly reading data into the Matrix packages sparse formats
...rse, ends up being only about 1/2 as time consuming as sparse solvers when all is told. It also requires that a dense version of X approximately fit in memory. method 2 is significantly slower still, taking more than a factor of 10 longer than the dense solver. For 2 I tried dgCMatrix and dgTMatrix with little difference. I've searched though the documentation on the Matrix package, and there is no mention of this problem or its potential cure. Is there some way that I can format the data that will allow for rapid read in, or is there some other possible cure? Cheers, Paul Bailey