Questions tagged [vectors]

Vectors are sequence containers representing arrays that can change in size. For questions about geometric or algebraic vectors, use [coordinate-system] instead.

21 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
176 views

OCaml safe uninitialized array

One of the annoying things about OCaml arrays is that every cell has to be initialized when the array is first created. I'm trying to implement an array in OCaml that distinguishes ...
4
votes
0answers
267 views

C++ vector implementation errors

I haven't really programmed in C++ for about a year, and realised that I should get back into it, and tried my abilities out by remaking the STD vector class. However, my C++ is a bit rusty at the ...
3
votes
0answers
48 views

std::vector<bool> workaround in C++

I've been trying to make an std::vector of boolean values and I got fed up with the specialization. To get around this, I made a wrapper class around ...
3
votes
0answers
63 views

Program to output Low and High pass filter impulse response coefficients for signal processing

My issue that I was trying to solve was constructing a vector where the values were mirrored around the central element. The problem is here: https://stackoverflow.com/questions/58876916/construct-...
2
votes
0answers
55 views

dumb::vector - a class for students to use when they are expressly forbidden from using std::vector

I have created a small library for use by beginner C++ students who are forbidden from using std::vector in their projects. Because of this, I would like you to ...
2
votes
0answers
38 views

Using python to estimate the range of unstructured data

I have unstructured input-output data, f=f(x). I want to estimate the range of f as a function of x, given limited sampled. So, I tried to discretize the data use small bins in x to estimate the ...
2
votes
0answers
46 views

Leetcode Finding Maximum Area of Island Solution

Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are ...
2
votes
0answers
496 views

VBA array functions: push, pop, shift, unshift

I want to write my snake game procedurally, using as much windows call as I can so as to practice. Looking into GetAsyncKeyState to capture keyboard inputs and play sound functions. Also making a ...
2
votes
0answers
413 views

A multithreaded, growable vector with immutable elements, which has wait-free reads

I wrote a small vector with a few lines of unsafe Rust. The idea is to have a vector, which can be read from simultaneously, but it needs the ability to grow. To realize that, the storage is ...
2
votes
0answers
66 views

Genetic operators in Haskell

I have implemented two genetic operators, which is really just a fancy way of mangling lists. In particular OX-1 (illustration) and displacement mutation. I found it necessary to extract out the ...
2
votes
0answers
33 views

Constant-space n-dimensional loops using dependent vectors

I designed this file after learning from this awesome answer from user2407038 on Stack Overflow. The idea of the module is to replace code like: ...
2
votes
0answers
444 views

Serialize/deserialize a vector using insertion/extraction operators

I've never serialized a structure to a file before in C++, so I'm looking for critique on my first try at it. My main concerns are: It uses the streams space-delimited behavior. If a ...
1
vote
0answers
16 views

JDS - Cuda implementation

I am trying to implement the Jagged Diagonal Storage code in Cuda for Sparse Matrix - Vector multiplication. The code I wrote is as follows but I'm not sure about it: ...
1
vote
0answers
31 views

Average histogram combining multiple files and vector of vectors (in c++)

I run a program of simulation N times (I use each time a different random numbers to initialize it). The results of the program are stored in 2N directories: every run produces two approximations. The ...
1
vote
0answers
174 views

Qsort in C++ using vector

I tried to make a simple qsort() function in a functional way, it takes a vector and a bool pred() Suggestions as to make it more functional, optimize it, and/or ...
1
vote
0answers
3k views

Reading and storing nested data

I'm reading data from a json-structure that describe aquariums and how many fish they contain (among other things). Overall, the structure of the data is like this: "house" "info" "animals" "fish" ...
1
vote
0answers
49 views

Sending info (state, college, teacher) to client based on the request received by the server

I wrote this code to send info as (state, college, teacher) from the server to the client. I am running a script which will dump all the info about (state, college and teacher) into a file with a ...
1
vote
0answers
100 views

Fast HashIndex (HashTable) “template” for indexes and arrays C++

Another in the long line of data structures I'm writing for my 2D isometric game. This is a hashtable that only handles indexes, hence eHashIndex. It does not copy ...
1
vote
0answers
64 views

Optimizing Text Data Import From MatLab

I want to import some data to a 2-D vector. The data type is double like 5.8774718e-39, and the size is ...
1
vote
0answers
455 views

Flattening lists of Vectors and Matrices into arrays

For many optimisation methods the parameters must be given as a single vector, such as Optim.jl. But for many interesting functions the parameters/coeffients to be optimised are matrices, or a mixture ...
1
vote
0answers
116 views

Creating an updating hash table

I'm not sure if this implementation is good enough. The function takes a vector of 1 million chars and creates a table of the sequences that pass before the next occurrence of itself. Some questions ...