sparse-matrix

Sparse matrices / arrays in Java

I'm working on a project, written in Java, which requires that I build a very large 2-D sparse array. Very sparse, if that makes a difference. Anyway: the most crucial aspect for this application is efficency in terms of time (assume loads of memory, though not nearly so unlimited as to allow me to use a standard 2-D array -- the key r...

Pointer class assistance

I'm writing a sparse matrix class in C++ in which every row and column are arrays of linked lists from a class I created (aptly named: LinkedList). I want to write a class that is a "smart" pointer to one cell in this matrix. In that class, let say LIPointer, I will implement a ++ operator function for moving in the linked lists of the...

Sparse data: efficient storage and retrieval in an RDBMS

I have a table representing values of source file metrics across project revisions, like the following: Revision FileA FileB FileC FileD FileE ... 1 45 3 12 123 124 2 45 3 12 123 124 3 45 3 12 123 124 4 48 3 12 123 124 5 48 3 12 123 ...

Matrix Market into CRS conversion (sparse matrices)

When dealing with sparse matrices, how do I convert Matrix Market format into CRS (Compressed Row Storage)? ...

How expensive is it to compute the eigenvalues of a matrix?

How expensive is it to compute the eigenvalues of a matrix? What is the complexity of the best algorithms? How long might it take in practice if I have a 1000x1000 matrix? I assume it helps if the matrix is sparse? Are there any cases where the eigenvalue computation would not terminate? In R, I can compute the eigenvalues as in t...

Best way to store a sparse matrix in .NET

We have an application that stores a sparse matrix. This matrix has entries that mostly exist around the main diagonal of the matrix. I was wondering if there were any efficient algorithms (or existing libraries) that can efficiently handle sparse matrices of this kind? Preferably, this would be a generic implementation where each mat...

Matrix Library for .NET

I'm looking for a good (well-tested, fully-featured, and ideally with a nice interface) matrix library for .NET/C#. My main requirements here are only that it should be free (I don't particularly care whether it's open-source in this case) and preferably support sparse matrix operations. The obligatory requirements are all the basic oper...

Data Structure for Storing Sparse Matrices

I need to do some mathematics operations on sparse matrices. I noticed that using arrays may not be the most efficient way to utilize my memory, especially since the matrices may have over 200 rows. I have considered using a linked list too, but I'm not sure if that'll be better. Is there any suitable data structure [approach] to this si...

Sparse Multidimensional Array or Matrix Libraries in .NET

Hi, I have a need for a sparse matrix in up to 4 dimensions in a .NET application. The size of the matrix (if represented as a .NET Array) would potentially top 400MB. The array is likely to be very sparse, and I need to be able to instantiate and dispose it very quickly (although that's not a no go). I'm therefore after a sparse array...

Most mature sparse matrix package for R?

There are at least two sparse matrix packages for R. I'm looking into these because I'm working with datasets that are too big and sparse to fit in memory with a dense representation. I want basic linear algebra routines, plus the ability to easily write C code to operate on them. Which library is the most mature and best to use? So ...

Find the "largest" dense sub matrix in a large sparse matrix

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 ratio constraints. Are there any known...

Sparse Multi-Dimensional Data Representation

I'm working on a cardiac simulation tool that uses 4-dimensional data, i.e. several (3-30) variables at locations in 3D space. I'm now adding some tissue geometry which will leave over 2/3 of the points in the containing 3D box outside of the tissue to be simulated, so I need a way to efficiently store the active points and not the othe...

Creating (and Accessing) a Sparse Matrix in R

After learning about the options for working with sparse matrices in R, I want to use the Matrix package to create a sparse matrix from the following data frame and have all other elements be NA. s r d 1 1089 3772 1 2 1109 190 1 3 1109 2460 1 4 1109 3071 2 5 1109 3618 1 6 1109 38 7 I know I can create a sparse matrix with t...

accessing element of boost sparse_matrix seems to stall program

I've got a strange bug that I'm hoping a more experience programmer might have some insight into. I'm using the boost ublas sparse matrices, specifically mapped_matrix, and there is an intermittent bug that occurs eventually, but not in the initial phases of the program. This is a large program, so I cannot post all the code but the core...

Capturing Non-Zero Elements, Counts and Indexes of Sparse Matrix

I have the following sparse matrix A. 2 3 0 0 0 3 0 4 0 6 0 -1 -3 2 0 0 0 1 0 0 0 4 2 0 1 Then I would like to capture the following information from there: cumulative count of entries, as matrix is scanned columnwise. Yielding: Ap = [ 0, 2, 5, 9, 10, 12 ]; row indices of entries...

iterating through TWO sparse matrices

I'm using boost sparse matrices holding bool's and trying to write a comparison function for storing them in a map. It is a very simple comparison function. Basically, the idea is to look at the matrix as a binary number (after being flattened into a vector) and sorting based on the value of that number. This can be accomplished in this ...

Sparse linear algebra solvers for C#

I'm working on an experimental implementation of Goldenthal et.al's inextensible cloth algorithm in C#. First I used Math.NET Iridium to assemble and solve the matrices, but quickly replaced this with dnAnalytics since the latter allows me to reuse matrices, almost eliminating further memory allocation, which is important for real-time...

Encoding patterns in a 2D space (matrix)

I have a 2D MxN grid (or matrix). The cells in the matrix may hold an integer. A cell with a non-zero integer is said to be populated. The set of populated cells in the matrix is known as a "configuration". I want to come up with an encoding or hashing algorithm that wil allow me to uniquely identify a configuration in the matrix, by co...

Algorithm to minimize the space complexity of a sparse matrix?

When storing and manipulating sparse matrices on a computer (zeros and ones), it is beneficial and often necessary to use specialized algorithms and data structures that take advantage of the sparse structure of the matrix. Operations using standard matrix structures and algorithms are slow and consume large amounts of memory when applie...

I am having a problem with pointers in java. How do I fix a java.lang.NullPointerException ?

This is a method that gets a element from a Sparse Matrix in java. I keep getting a java.lang.NullPointerException error. I have looked over the code and can't find the error. public int getElement(int row,int col){ int result = 0; MatrixEntry matrixentry = null; if ((row >= 0) && (row < getNumRows()) && (col >= 0) ...