The sparse-array tag has no wiki summary.
3
votes
5answers
649 views
Best way to store SparseBooleanArray in Bundle?
When a config change happens, my ListView Checkbox states get lost, which I understand why.
I try to implement
public void onSaveInstanceState(final Bundle outState)
in one of my Fragments. So I'm ...
0
votes
1answer
44 views
Automated sparse matricies in Fortran
I know that Intel Fortran has libraries with functions and subroutines for working with sparse matricies, but I'm wondering if there is also some sort of data type or automated method for creating the ...
0
votes
1answer
51 views
How to initialize a static SparseArray
How can I initialize a static, unmodifiable instance of android.util.SparseArray?
0
votes
2answers
74 views
Why isn't SparseArray in Android JFC compatible?
So, I'm supposed to use SparseArray instead of HashMap for the sake of performance:
However, SparseArray isn't a part of JCF and does not implement Collection nor List nor Map. HashMap, on the other ...
3
votes
3answers
1k views
Memory-efficient sparse array in Java
(There are some questions about time-efficient sparse arrays but I am looking for memory efficiency.)
I need the equivalent of a List<T> or Map<Integer,T> which
Can grow on demand just ...
2
votes
2answers
1k views
SparseArray, check if key exists
I was implementing a Bitmap cache using a HashMap<Integer, Bitmap> and received the following warning in Eclipse:
Use new SparseArray(...) instead for better performance.
I've never heard ...
1
vote
2answers
91 views
Android SparseArray<SparseArray<Object>> initialization
I have to implement the classification of somehting like Hashmap with two keys and a value, let's say Hashmap<K1, K2, V>, where the two keys are integers and the value is a generic MyObject ...
0
votes
2answers
64 views
How to make (and save in RAM) sparsearray at app launch? (android)
I am making an android app. There is an activity in the app, which when triggered, makes a sparsearray and fills it with data. Now this process takes upto 1 minute on the emulator, which is very long. ...
14
votes
3answers
22k views
javascript sort sparse array keep indexes
What is the best method to sort a sparse array and keep the elements on the same indexes?
For example:
a[0] = 3,
a[1] = 2,
a[2] = 6,
a[7] = 4,
a[8] = 5,
I would like after the sort to have
...
33
votes
10answers
18k views
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 ...
7
votes
6answers
2k views
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?)
0
votes
1answer
162 views
How to store sparsearray in bundle
I have a SparseArray<myObject> and want to store it in bundle in onSaveInstanceState method in my activity and restore it in oncreate. I found putSparseParcelableArray method for put SparseArray ...
10
votes
4answers
487 views
Does null occupy memory in javascript?
I've got the following situation:
var large = [a,b,c,d,e,f,g,h,i];
var small = [a2, b2, c2, null, null, null, null, null, null, i2];
where every element of both arrays is an object.
The small ...
0
votes
1answer
197 views
How to quickly compact a sparse array with CUDA C?
Summary
Array [A - B - - - C] in device memory but want [A B C] - what's the quickest way with CUDA C?
Context
I have an array A of integers on device (GPU) memory. At each iteration, I randomly ...
2
votes
3answers
156 views
What does “SparseArray - there can be gaps in the indices” mean?
Developing a program which uses hash map with integer as keys and objects as values. I keep on getting Lint warning informing SparseArray is more efficient and when I read about the same it was given ...
1
vote
3answers
409 views
Norm of sparse python vectors
Is it possible to effectively obtain the norm of a sparse vector in python?
I tried the following:
from scipy import sparse
from numpy.linalg import norm
vector1 = sparse.csr_matrix([ 0 for i in ...
0
votes
0answers
75 views
What is the fastest way to slice a scipy.sparse matrix?
I normally use
matrix[:, i:]
It seems not work as fast as I expected.
13
votes
3answers
23k views
Decode sparse json object 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:
...
2
votes
2answers
127 views
Optimal data structure for a table
Our team work on implementation of the table widged for mobile platform (one of the application is mobile office like MS Excel).
We need to optimize the data structure for storing table data (the ...
0
votes
2answers
161 views
Creating each method for custom two dimensional array
I followed these instructions to create a custom class for two dimensional arrays.
class SparseArray
attr_reader :hash
def initialize
@hash = {}
end
def [](key)
hash[key] ||= {}
...
0
votes
3answers
96 views
How can I get the number of elements in a sparse array in Actionscript?
Actionscript uses sparse arrays, so I can have an array like this:
var myArray:Array = new Array();
myArray[0] = "foo";
myArray[22] = "bar";
Now myArray.length will give me 23. Is there a way to ...
0
votes
3answers
541 views
SparseArray clone in Android
I am trying to iterate through a SparseArray and delete a few items.
private SparseArray record;
int size = record.size();
for (int index = 0; index < size; index++) {
...
3
votes
3answers
2k views
Android: Is there an idiom for Iterating through a SparseArray
I'm using a list of unique int ids against a list of user names as a fast lookup table and decided to use the sparseArray but I would like to be able print to log the entire list from time to time for ...
0
votes
4answers
176 views
Condensing a sparse array in Javascript?
I have an array of elements where the entries are sparse. How can I easily condense the sparse array into a dense array so that I don't have to keep checking for null and undefined values every time ...
0
votes
1answer
77 views
Storing functions in a sparse array with Python
I have a relatively large enum wherein each member represents a message type. A client will receive a message containing the integer value associated with the msg type in the enum. For each msg type ...
3
votes
2answers
315 views
Suggestions for Sparse Vector implementation without usign outside libraries
I have to use a sparse vector for some things in my current project. But, since I am not in charge of the project, I can not use whatever outside libraries I want. I only have STL and OpenCV ...
0
votes
1answer
413 views
thread-safe cache for sparse, lazy, immutable arrays
I have an application that involves a collection of arrays which can be very large (indices up to the maximum value of an int), but which are lazy - their contents are calculated on the fly and are ...
4
votes
2answers
177 views
Are JavaScript/ECMAScript arrays “sparse” in Node.js?
My question is the same as Are Javascript arrays sparse? with one difference...
Are JavaScript arrays sparse, as implemented in Node.js (and/or V8)? I had assumed the were, but then I did the ...
1
vote
2answers
138 views
Assignments in Wolfram Mathematica
Question about assignments and variables
(* For example *) SP = SparseArray[{},5] or SP = Range[5]
now we want to work with this array in some another function :
(* example *) Fun[array_]:= ...
0
votes
0answers
158 views
Sparse Vector library in C
Hi I am implementing a multicore clustering algorithm in C. I need a good sparse vector implementation in C(since my multicore libraries are in C). I might need to change the allocation methods in ...