sparse-matrix

space allocated by compressed_matrix in boost

How much space is allocated by boost compressed_matrix? Is it true that it only allocates space for non-zero elements? If this is true, I don't understand why the following code gives bad_alloc error. namespace bubla = boost::numeric::ublas; typedef double value_type; typedef bubla::compressed_matrix<value_type> SparseMatrix; unsign...

boost compressed matrix basics

I am confused on how the boost::compressed_matrix works. Suppose I declare the compressed_matrix like this: boost::numeric::ublas::compressed_matrix<double> T(1000, 1000, 3*1000); This allocates space for 3*1000 elements in a 1000x1000 matrix. Now how do I give it the locations which are the non-zero elements? When and how are the non...

Suggestions for a Data Structure for related features

We have a set of Documents , each has a set of Features. Given feature A, we need to know what is the probability of having feature B in the same document. I thought of building a probability matrix , s.t: M(i,j) = Probability of having feature B in a document , given that feature A is there. However , we have an additional requirem...

Remove row/column from Colt's ObjectMatrix2D

What's the best way to effectively remove a row from an ObjectMatrix2D? Use viewSelection to get all the other rows (is there a simpler way than me building arrays of rows and columns myself?) Transpose all the lower rows up one (docs mention transpose operation but I can't find any code for it) something else? If it matters I'm curr...

Any Sparse Linear Algebra package in Haskell?

Is there any package to perform Sparse Linear Algebra computations, maybe based on fast and efficient C libraries? I searched on Hackage but I didn't find anything at regard: hmatrix, which uses GSL, BLAS and LAPACK, is great, but doesn't seem to include special algorithms to solve linear systems and eigen-values/vectors problems with sp...

How can I fill N x M grid efficiently with Perl?

I have a Perl script, which parses datafile and writes 5 output files filled with 1100 x 1300 grid. The script works, but in my opinion, it's clumsy and probably non-efficient. The script is also inherited code, which I have modified a little to make it more readable. Still, it's a mess. At the moment, the script reads the datafile(~4Mb...

matlab cell2mat( ... ) function with cell array having a bunch of sparse matrices overflows memory unexpectedly

I get strange behavior with respect to memory with Matlab and the cell2mat() function... what I would like to do is: cell_array_outer = cell(1,N) parfor k = 1:N cell_array_inner = cell(1,M); for i = 1:M A = do_some_math_and_return_a_sparse_matrix( ); cell_array_inner{i} = sparse(A); % do sparse() again just to be parano...