sparse-array

Help with Sparse Array in JScript

I have a sparse array in Jscript, with non-null elements occuring at both negative and positive indices. When I try to use a for in loop, it doesn't traverse the array from the lowest (negative) index to the highest positive index. Instead it returns the array in the order that I added the elements. Enumeration doesn't work either. Is th...

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...

Recommended way to map between JavaScript sparse array and C# (sparse)array?

Hi, I am trying to map a JavaScript sparse array to a C# representation. What is the recommended way of doing this? It am considering using a dictionary containing the list of oridinals that contained a value in the original array. Any other ideas? thanks! ...

Are Javascript arrays sparse?

That is, if I use the current time as an index into the array: array[Date.getTime()] = value; will the interpreter instantiate all the elements from 0 to now? Do different browsers do it differently? I remember there used to be a bug in the AIX kernel, which would create pseudo-ttys on request, but if you did, say, "echo > /dev/pty1...

How to represent a sparse array in JSON?

I've got a sparse array that I want to represent in JSON. For example: -10 => 100 -1 => 102 3 => 44 12 => -87 12345 => 0 How can I do this? Can I do this? ...

Java time-efficient sparse 1D array (double)

Hi, I need an efficient Java structure to manipulate very sparse vectors of doubles: basic read / write operations. I implemented it in a HashMap but the access is too slow. Should I use another data structure? Do you recommend any free library? Looking for some peaceful advice :) Thanks a lot, Marie ...

Which is the best way to implement a sparse vector in Java?

Which is the best way to implement a sparse vector in Java? Of course the good thing would be to have something that can be manipulated quite easily (normalization, scalar product and so on) Thanks in advance ...

Decode sparse json array to php array

I can create a sparse php array (or map) using the command: $myarray = array(10=>'hi','test20'=>'howdy'); I want to serialize/deserialize this as JSON. I can serialize it using the command: $json = json_encode($myarray); which results in the string {"10":"hi","test20":"howdy"}. However, when I deserialize this and cast it to an arr...

JSON implementations that handle sparse arrays

I need to know if any JSON implementations can handle sparse arrays to my satisfaction. I've seen the question: http://stackoverflow.com/questions/1733658/how-to-represent-a-sparse-array-in-json but using an object rather than an array is not an option for me; I need an array. My minimum requirement would be that the implementation f...

how to implement a sparse_vector class

I am implementing a templated sparse_vector class. It's like a vector, but it only stores elements that are different from their default constructed value. So, sparse_vector would store the lazily-sorted index-value pairs for all indices whose value is not T(). I am basing my implementation on existing sparse vectors in numeric librar...

Anyone Know a Great Sparse One Dimensional Array Library in Python?

I am working on an algorithm in Python that uses arrays of int64s heavily. The arrays are typically sparse and are read from and written to constantly. I am currently using relatively large native arrays and the performance is good but the memory usage is high (as expected). I would like to be able to have the array implementation not ...

java: sparse bit vector

Are there any well-known libraries in Java for sparse bit vectors? (And are there guidelines for how sparse is useful to use them vs. java.util.BitSet?) ...

Data structure for representing sparse tensor?

What is an appropriate data structure to represent a sparse tesnor in C++? The first option that comes to mind is a boost::unordered_map since it allows operations like fast setting and retrieval of an an element like below: A(i,j,k,l) = 5 However, I would also like to be able to do contractions over a single index, which would involv...

Sparse array support in HDF5

Hi, I need to store a 512^3 array on disk in some way and I'm currently using HDF5. Since the array is sparse a lot of disk space gets wasted. Does HDF5 provide any support for sparse array ? ...