Displaying 20 results from an estimated 1000 matches similar to: "converting dgCMatrix to regular matrix"
2012 Dec 11
1
Dispatching on a dgCMatrix does not work.
I represent a graph as an adjacency matrix of class "dgCMatrix" (from the Matrix package).
> xx
5 x 5 sparse Matrix of class "dgCMatrix"
a b c d e
a . 1 1 . .
b 1 . 1 . .
c 1 1 . 1 1
d . . 1 . 1
e . . 1 1 .
To check if the matrix defines and undirected graph, I have made the following functions/methods:
is.UG <- function (object) {
UseMethod("is.UG")
}
2012 Jul 28
1
Creating sparse matrix of type "dgCMatrix" directly
I want to create a sparse matrix of type "dgCMatrix" using the Matrix package (and the matrix must be of this type even if other more compact representations may exist). I do
> library(Matrix)
> m1<-Matrix(rep(1,4),nrow=2,ncol=2,sparse=T)
> m1
2 x 2 sparse Matrix of class "dsCMatrix"
[1,] 1 1
[2,] 1 1
To convert m1, I do
> as(m1, "dgCMatrix")
2011 Aug 23
0
Matrix:::qr.qy and signature(qr = "sparseQR", y = "dgCMatrix")
> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Matrix_0.999375-50 lattice_0.19-30
loaded via a namespace (and not attached):
[1] grid_2.13.1
2017 Oct 20
0
What exactly is an dgCMatrix-class. There are so many attributes.
Subsetting using [] vs. head(), gives different results.
R code:
> head(train$data, 5)
[1] 0 0 1 0 0
> train$data[1:5, 1:5]
5 x 5 sparse Matrix of class "dgCMatrix"
cap-shape=bell cap-shape=conical cap-shape=convex
[1,] . . 1
[2,] . . 1
[3,] 1 .
2017 Oct 20
0
What exactly is an dgCMatrix-class. There are so many attributes.
> On Oct 20, 2017, at 11:11 AM, C W <tmrsg11 at gmail.com> wrote:
>
> Dear R list,
>
> I came across dgCMatrix. I believe this class is associated with sparse
> matrix.
Yes. See:
help('dgCMatrix-class', pack=Matrix)
If Martin Maechler happens to respond to this you should listen to him rather than anything I write. Much of what the Matrix package does appears
2017 Oct 21
0
What exactly is an dgCMatrix-class. There are so many attributes.
>>>>> C W <tmrsg11 at gmail.com>
>>>>> on Fri, 20 Oct 2017 15:51:16 -0400 writes:
> 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
>>
2017 Oct 21
1
What exactly is an dgCMatrix-class. There are so many attributes.
> On Oct 21, 2017, at 7:50 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
>>>>>> C W <tmrsg11 at gmail.com>
>>>>>> on Fri, 20 Oct 2017 15:51:16 -0400 writes:
>
>> 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
2017 Oct 20
3
What exactly is an dgCMatrix-class. There are so many attributes.
Dear R list,
I came across dgCMatrix. I believe this class is associated with sparse
matrix.
I see there are 8 attributes to train$data, I am confused why are there so
many, some are vectors, what do they do?
Here's the R code:
library(xgboost)
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
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
2008 Oct 18
1
Error: could not find function "readMat"
Hi All,
I installed this R.matlab package and tried using the sample code
>
> path <- system.file("mat-files", package="R.matlab")
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Reading all example files
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> for (version in 4:5) {
+
2012 Aug 14
1
Help needed in reading matlab files
Dear users,
I am stucked with a programming problem: I am trying to download a squared adjacency matrix from matlab with only 0 or 1. Doing it without a loop at first, I get an error message that is, I think, related to the "mat_adj<-readMat(pathnames_adj)" line. Did anybodz encouter already that problem? If so, do I need to change anything in my code in order it not to be
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))))
## 5 x 5 sparse Matrix of class
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))))
## 5 x 5 sparse Matrix of class
2009 Jul 20
1
S4 method dispatch with inheritance
Hi,
I'm trying to create a new S4 class (myMatrix) which for now just
extends dgCMatrix (from package Matrix). Then I want to use "[" which is
defined in Matrix.
Out of the box with "[" (defined in Matrix) I lose the class information
and the result is an object of class dgCMatrix. If I specify a
"["-method for myMatrix, it is not used because a signature
2008 Jan 30
2
[rfc] Package to access the internal zlib library.
To make R.matlab's readMat work for me[1] I needed access to zlib's
uncompress function. R already links with zlib, and sometime last
year I hobbled together a quick package to get at a few functions.
It's my first package, so I would love feedback both on the package
and its purpose.
I've dropped a temporary copy at
http://jriedy.users.sonic.net/internalzlib_0.1.tar.gz
Could
2008 Mar 26
2
Moving data between R and Matlab back and forth?
Hi to the list,
I am trying to find a way to painlessly move structured data back and
forth between R and Matlab (also Octave). For this purpose I found the
R.matlab package great help. I wish to use a Matlab -v6 MAT file as an
intermediary format, because it is well read by both Matlab and
Octave. It is also well read by 'readMat' function in R.matlab
package, but that is where I run
2015 Mar 20
0
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
Hi Martin,
package arules heavily relies on ngCMatrix and uses multiplication and
addition for logical operations. I think it makes sense that in a mixed
operation with one dgCMatrix and one ngCMatrix the ngCMatrix should be
"promoted" to a dgCMatrix.
The current behavior of %*% and friends is in deed confusing:
> m <- matrix(sample(c(0,1), 5*5, replace=TRUE), nrow=5)
>
2011 Oct 17
0
[Reading mat files into R]
Dear R users,
I work with Matlab & R simultaneously. Usually I used to read successfully
mat files (cell, structure, etc.) into R, till Matlab 2011b release.
For reading mat files (or maybe I should say, converting it into R variable
or structure) I’m using *readMat* (from “R.matlab” package).
Even saving mat files in one of the previous formats (which can bet set in
preference panel)
2018 Apr 23
0
R 3.5.0 fails its regression test suite on Linux/x86_64
On 23/04/2018 6:33 AM, Peter Simons wrote:
> Hi,
>
> I just tried to upgrade Nixpkgs to R 3.5.0, but unfortunately the new
> version fails its regression test suite. We configure the build using
> the flags "--without-recommended-packages", in case that's relevant. You
> can see a complete build log with all relevant information at [1].
> Anyway, the test
2013 May 14
0
Matrix multiplication with scattered NA values
Hi,
Not sure if this is what you wanted:
?mat1<- as.matrix(read.table(text="
????? 33??????? 45??? 50
????? NA?????? NA?? 54
",sep="",header=FALSE))
mat2<- as.matrix(read.table(text="
24??????????????? 0.0000000??????? 0.0000000
0.0000000??????? 14??????????????? 0.0000000
0.0000000 0.0000000??????? 10
",sep="",header=FALSE))
?mat1%*%mat2
?# ??? V1?