35,362 questions
0
votes
1
answer
44
views
Errors when trying to optimize a vector using RTMB and optim
I first put this question to AI Assist but the initial answer did not work and each time I followed-up having made the corrections I got new changes on its original, which also didn't work.
I am ...
3
votes
2
answers
232
views
Error while removing duplicates from a std::vector containing std::variant
I'm trying to create a template function to remove duplicate values from a vector. My current implementation works fine when the vector contains only one type (like int):
template <typename T> ...
-3
votes
3
answers
113
views
How to create a member function for map?
I have created a map like this:
map<string, map<string, map<int, vector<int>>>> example;
I can insert a value to this map like this:
example["Stack"]["OverFlow&...
8
votes
5
answers
776
views
How to generate a matrix with every offset of vector without using a for loop
For a given vector like v <- c(1,3,7,2,5), I want to create a matrix that repeats that vector with every possible offset, like this:
NA NA NA NA 1
NA NA NA 1 3
NA NA 1 3 7
NA 1 3 7 2
1 ...
0
votes
0
answers
39
views
How do I create labels for protomaps pmtiles data in Leaflet.js?
I created some pmtiles files. I used tippecanoe and ogr2ogr, with various settings. My goal is: show the files with protomaps-leaflet.js. I already have some leaflet projects with basemaps, geojson ...
2
votes
5
answers
205
views
How do I index in R so that my data isn't deleted when there are no indices? [duplicate]
I would like to be able to use indices in R so that if there are no indices that meet the criteria, the data is not deleted. For example, the following code doesn't recognize that I want to keep the ...
3
votes
1
answer
150
views
Why does my 2D Vector of C strings not output the element at the given index? [duplicate]
Technically its a vector<vector<vector<const char *>>> but I'm using it as a vector<vector<cstrings>>
I have been stuck at this issue for weeks and I do not understand it....
0
votes
1
answer
86
views
Should SQL filters be applied before or after vector similarity search in PostgreSQL
PostgreSQL tables sometimes store embeddings alongside relational columns and run vector similarity search with additional filters.
Example schema
documents
id bigserial primary key
tenant_id int
...
Advice
0
votes
2
replies
87
views
How do I make directional movement in my 3D Raylib game
I am currently making a 3D game with C# in Raylib a game library and when coding the movement of my player which is just a hitbox and a camera, I ran into a problem on how the player movement controls ...
6
votes
4
answers
265
views
Size mismatch of more than 2 arrays
Let's say I have n arrays (right now I have 4 but that might go up) and they're supposed to be of the same size, but since I'm fetching them from outside the code I want to be sure
std::vector<int&...
0
votes
1
answer
86
views
Performing product operation on consecutive true segments in a vector
I have two vectors of equal length, one integer vector and one boolean vector. I want to calculate the product of elements in the integer vector where the corresponding boolean vector has consecutive ...
5
votes
0
answers
240
views
Why is my user-defined contiguous 2D array not dramatically faster than std::vector<std::vector<>>?
I implemented a simple 2D array wrapper using a single contiguous std::vector and, benchmarked it against std::vector<std::vector<>>.
Surprisingly, array2d is just slightly faster!
#...
0
votes
1
answer
120
views
How to remove duplicate rows based on array column subset relationship?
I have a DolphinDB table with an array vector column. I need to remove duplicate rows based on subset relationships within that column.
Sample Input:
sym
prices
a
[3,4,5,6]
a
[3,4,5]
a
[2,4,5,6]
a
[5,...
0
votes
1
answer
121
views
Integer or Double vector? [duplicate]
print(krit)
names weight
1 may 36
2 mayer 49
3 mayo 35
4 mali 50
> mean(krit$weight)
[1] 42.5
> typeof(weight)
[1] "double"
> typeof(names)
[1] "character&...
0
votes
1
answer
51
views
Multiple CDFS on the same plot with specified ranges
I was trying to do something for a project where I create two random 3D vectors, project them onto a 2D plane by removing their x-component, taking the dot product between the two to find their ...