memory-efficient Questions
6
Solved
I'm looking for the most memory-efficient way to compute the absolute squared value of a complex numpy ndarray
arr = np.empty((250000, 150), dtype='complex128') # common size
I haven't found a...
Mouthy asked 25/5, 2015 at 12:3
3
Solved
I want to compactly encode a large unsigned or signed integer having an arbitrary number of bits into a base64, base32, or base16 (hexadecimal) representation. The output will ultimately be used as...
Bobker asked 11/1, 2019 at 19:19
3
Solved
I have a problem concerning very fast and efficient comparison between the substrings of two strings in my dataset, which won't run fast enough despite pretty powerful machinery.
I have a data.tabl...
Tyburn asked 10/10, 2023 at 9:51
22
Solved
Given an array of n integers and a number, d, perform left rotations on the array. Then print the updated array as a single line of space-separated integers.
Sample Input:
5 4
1 2 3 4 5
The ...
Fable asked 20/7, 2016 at 13:28
3
Solved
Let's say I have an N-side dice with non-uniform probabilities for each side and I throw it M times. Now instead of observing the individual outcomes, we only observe the sum.
I have to code the li...
Tubercle asked 15/9, 2023 at 23:36
2
Solved
Working with the PriorityQueue<TElement, TPriority> collection, frequently I have the need to preserve the insertion order of elements with the same priority (FIFO order), and AFAIK the only ...
Carousel asked 5/4, 2023 at 14:38
5
Solved
I have a very large JSON file containing an array. Is it possible to use jq to split this array into several smaller arrays of a fixed size? Suppose my input was this: [1,2,3,4,5,6,7,8,9,10], and I...
Evacuation asked 19/7, 2018 at 0:33
4
Solved
I'm just working on the FIFO queue (the simple one, just what's pushed first, pops at first) with the variable data size but I'm not sure with the way I'm designing it. The data types I will store ...
Scampi asked 1/8, 2011 at 9:45
2
Solved
I was looking for the fastest method to calculate the square root(integer) of a number(integer). I came across this solution in wikipedia which finds the square root of a number(if its a perfect sq...
Appellant asked 2/6, 2012 at 21:32
3
Solved
I'm programming a Bomberman in Java following a tutorial (this is my first game).
The tutorial suggests the following code for detecting collisions.
for (int p=0; p<entities.size(); p++) {
fo...
Evaleen asked 25/7, 2011 at 4:13
2
Solved
Say there's a vector x:
x <- c("a", " ", "b")
and I want to quickly turn this into a single string "a b". Is there a way to do this without a loop? I know with a loop I could do this:
y <...
Harriet asked 14/7, 2011 at 19:27
1
Solved
If one uses the standard .flatten().collect::<Box<[T]>>() on an Iterator<Item=&[T]> where T: Copy, does it:
perform a single allocation; and
use memcpy to copy each item t...
Crier asked 26/10, 2019 at 14:21
4
Solved
A is an array of integers.
All the values are between 0 to A.Length-1
it means 0 <= A[i] <= A.Length-1
I am supposed to find repeating elements; and if there are several repeating elements...
Aarhus asked 29/8, 2018 at 13:2
1
Solved
Let's say I'm using get-childitem c:\*.* -recurse and I am piping it. I have to wait for the whole get-childitem command to complete before the pipe handles it. There are exceptions such as select ...
Undeniable asked 15/8, 2018 at 2:35
3
Goal: Use a script to run through 5 million - 10 million XML files and evaluate their date, if older than 90 days delete the file. The script would be run daily.
Problem: Using powershell Get-Chil...
Mundy asked 13/2, 2016 at 23:41
14
Solved
What are the benefits of having a member variable declared as read only? Is it just protecting against someone changing its value during the lifecycle of the class or does using this keyword result...
Amritsar asked 10/11, 2008 at 3:37
1
The problem:
I have a family of objects with a common base, and I need to be able to identify the specific concrete type via an integer value.
There are two obvious approaches to do that, however...
Kus asked 12/2, 2018 at 16:14
2
In a regular object oriented practice it is not that rare objects have multiple unrelated member properties. And when objects are being processed, it is not rare that it is done in different passes...
Roue asked 11/9, 2012 at 8:20
4
Solved
I have a dataframe df:
df = pd.DataFrame({'id1':[1,1,1,1,1,4,4,4,6,6],
'id2':[45,45,33,33,33,1,1,1,34,34],
'vals':[0.1,0.2,0.6,0.1,0.15,0.34,0.12,0.5,0.4,0.45],
'date':pd.to_datetime(['2017-01-...
Chelsiechelsy asked 11/12, 2017 at 14:56
2
Solved
By small byte arrays I mean arrays of bytes with length from 10 up to 30.
By store I mean storing them in the RAM, not serializing and persisting to the filesystem.
System macOS 10.12.6, Oracle...
Yeomanly asked 23/8, 2017 at 2:58
1
Solved
I would like to split a 3D numpy array into 3D blocks in a 'pythonic' way. I am working with image sequences that are somewhat large arrays (1000X1200X1600), so I need to split them into pieces to ...
Centistere asked 10/9, 2016 at 19:36
4
Solved
I'm currently working on a project, in which I need bit sets. I'm using an array of uint64_t's for the bitset.
My current problem is, that whenever I want to set or check a bit I need to do an ope...
Personable asked 28/6, 2016 at 19:37
5
Solved
I had come across the term "Memory-Efficient Doubly Linked List" while reading a book on C Data structures. It just had one line saying that a memory-efficient doubly linked list uses less memory t...
Godhood asked 7/3, 2016 at 10:41
1
Solved
Which one is more efficient to instantiate a list ?
List<Type> list = new ArrayList<Type>(2);
list.add(new Type("one"));
list.add(new Type("two"));
OR
List<Type> list = Arrays...
Lutyens asked 28/1, 2016 at 14:40
1
Apparently integers cost 24 bytes in Python. I can understand that it does so because of the extra bells and whistles of representing unbounded number. However it looks like boolean data types also...
Ardeliaardelis asked 29/12, 2015 at 0:26
1 Next >
© 2022 - 2024 — McMap. All rights reserved.