-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have two sparse matrices, m1 and m2:
> m1 <- Matrix(data=0,nrow=2, ncol=1, sparse=TRUE, dimnames=list(c("b","d"),NULL))
> m2 <- Matrix(data=0,nrow=2, ncol=1, sparse=TRUE, dimnames=list(c("a","b"),NULL))
> m1["b",1]<- 4
> m2["a",1]<- 5
> m1
2 x 1 sparse Matrix of class…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Given a large sparse matrix (say 10k+ by 1M+) I need to find a subset, not necessarily continuous, of the rows and columns that form a dense matrix (all non-zero elements). I want this sub matrix to be as large as possible (not the largest sum, but the largest number of elements) within some aspect…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm looking for an a command or trick to convert two arrays to a sparse matrix. The two arrays contain x-values and y-values, which gives a coordinate in the cartesian coordinate system. I want to group the coordinates, which if the value is between some value on the x-axes and the y-axes.
% MATLAB
x_i…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi,
I have a m x n matrix where each row consists of zeros and same values for each row.
an example would be:
M = -0.6 1.8 -2.3 0 0 0; 0 0 0 3.4 -3.8 -4.3; -0.6 0 0 3.4 0 0
In this example the first column consists of 0s and -0.6, second 0 and 1.8, third -2.3 and so on.
In such case I would like…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The following code runs too slowly even though everything seems to be vectorized.
from numpy import *
from scipy.sparse import *
n = 100000;
i = xrange(n); j = xrange(n);
data = ones(n);
A=csr_matrix((data,(i,j)));
x = A[i,j]
The problem seems to be that the indexing operation is implemented…
>>> More