11 questions
0
votes
0
answers
176
views
How to create an efficient implementation for multiarraylist-like type for unions in zig?
I know MultiArrayList supports tagged union, but it does it by converting it into struct containing untagged union and a tag field, effectively creating 2 ArrayList fields, one for union and the other ...
6
votes
1
answer
150
views
How to copy values from array to array of structures?
In the code below I could use convenient syntax of std::ranges::transform to copy values from array of structures (AoS) to structure of arrays (SoA) (in this example, just one vector). Is there a way ...
2
votes
2
answers
143
views
Can we sort a structure of arrays using qsort() in C?
My current project requires a turbulence code that will use the velocity components of a fluid to advect a distribution of passive tracers.
I have written a code below that uses a structure of arrays (...
0
votes
0
answers
140
views
filter multiple vectors in a Struct of Arrays with rayon
I have a Struct of Vectors that I'm trying to filter based off precomputed indices of out-of-scope particles for a particle-in-cell program.
each index will be filtered as a group, so each resulting ...
4
votes
0
answers
463
views
vectorisation, AoSoA and gather?
I've been trying to get up to speed on where we are taking advantage of vectorisation.
Of course the answer to optimisation is always to profile, make a change and profile again but you don't ...
0
votes
2
answers
92
views
Why does this array of structures overwrite char * but not int? [duplicate]
I have written a program which makes use of array of structures in order to maintain a sort of "database" program with different options that can be used to manipulate the "database&...
2
votes
1
answer
232
views
Generalizing your operation for a specific declared type in Fortran
I have a Structure of arrays using the declared type in Fortran
e.g.
type t_data
integer :: N
real, allocatable :: x(:)
real, allocatable :: z(:)
real, allocatable :: y(:)
...
4
votes
2
answers
918
views
How to create a tuple of vectors of type deduced from a variadic template in C++17?
I have implemented a collection class that converts a vector of tuples to a tuple of vectors (it is essentially an AOS to SOA conversion). This code works for this example of two template classes. I ...
-2
votes
1
answer
479
views
To read from a text file and input into structure of array then displaying the data read C++
I have some trouble displaying the file I've read into an array of structure.
This is my struct:
struct Employee {
char staffId[5];
char fullName[30];
char phoneNum[15];
char ...
-1
votes
3
answers
1k
views
Reading from text file into a structure of array
I'm trying to read a text file into an array of structure. I haven't figured out a way to input it into an array of structure yet but the problem with my code is that the output keeps looping. I'm new ...
1
vote
0
answers
148
views
Elegence and terseness with structure-of-arrays as opposed to array-of-structs
Suppos I need to hold some data consisting of n Foo's, n Bars and n Bazs. The elements of corresponding indices are related, so you can also think of this data as n triplets of Foo, Bar andBaz`. The ...