35,386 questions
0
votes
0
answers
31
views
PolarDB vector database data import
I tried to import some MD files into PolarDB vector database. Some files hit errors like follow:
Failed file: monthly_2021_07_05.md
Log file: import_with_errors.log
Error context:
2025-10-28 17:23:07,...
0
votes
1
answer
76
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
208
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
106
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,...
-1
votes
1
answer
113
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
45
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 ...
Advice
0
votes
3
replies
114
views
How to adjust vector length in quiver plot?
This is the program I am using:
fig, ax = plt.subplots(figsize=(4, 4))
t, dt = np.linspace(-4, 4, 10, retstep=True)
x = t
y = t**3 - 9*t
xy = np.stack((x, y), axis=1)
n = len(xy)
d1ydx1 = np....
Best practices
0
votes
3
replies
90
views
How to plot unit tangent and unit normal vectors on a parameterized curve?
I am working to practice on some simple parameterized curve given by:
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6, 3))
t = np.linspace(-4, 4, 100)
x = t
y = ...
0
votes
1
answer
47
views
Why does the use of "enlist" in the cross-sectional engine sometimes result in errors and sometimes work normally?
I am using the cross-sectional engine and need to store multiple rows of fields as a single array vector. However, I have encountered several issues during the process:
The scenarios I attempted are ...
-8
votes
2
answers
234
views
My code fails to compile with "no match for 'operator=='" error [closed]
I tried using the std::getline() function with a vector, and I want to make something that turns the following user input:
3
AA AA
BB BB
CC CC
into the following output:
AA AA, BB BB, and CC CC [...
0
votes
1
answer
128
views
Trouble cycling through values in a for loop and filling a list in R
I'm trying to estimate the population growth of a population with different growths rates, shown below
r <-c(0.5, 1.0, 1.5, 2, 2.5, 2.6, 2.7, 2.8, 2.9)
I'm trying to fill N_List with the ...
0
votes
1
answer
43
views
How to reshape vector by duplicating each element twice?
I'm working with DolphinDB V3.00.3 and need to transform a vector by duplicating each element consecutively, while keeping the original order and final vector length the same as the input.
Example
...
0
votes
0
answers
30
views
ECU Extract Import in Comasso BSWDT Tool
I have to import ecu extract ARXML file into the COMASSO toolchain. I find the option in file->import->BCT->EcuExtract.
when I try to import ecu extract then tool requires .oaw and .ext files ...
1
vote
1
answer
65
views
Any memory safety concerns when using Haskell's vector unsafeFreeze / unsafeThaw on unpinned vector?
Apart from the known safety concerns documented for unsafeFreeze / unsafeThaw, is there any issue using these functions with non-pinned backing data (that is, as I understand everything except Vector....
0
votes
1
answer
48
views
Compute the mean vector of a vector field in avizo
I want to compute the mean vector of a vector field in avizo, but I'm struggling. I extracted the eigenvectors of my tensor with the module 'extract eigenvector', whih resulted in multiple vector ...
0
votes
1
answer
76
views
Positions of vectors wrong in matplotlib.pyplot.quiver
I am trying to demonstrate that $v_1 + t(v_2 - v_1)$ is a parameterized line using vectors $p_k=v_1 + \frac{k}{8}(v_2 - v_1)$ for $k=0\ldots 8$ with tails at the origin, and then the vector $u=v_2-v_1$...
0
votes
1
answer
192
views
Vector of Vectors Insertion Impact
Take this:
std::vector<std::vector<uint8_t>> v_data;
The internal vectors store bytes of around (~256 bytes each). There are about (15-20) of these vectors stored in the containing ...
0
votes
0
answers
129
views
vector<someClass> read from ttree is empty
I am trying to read a TTree from a ROOT file and copy some variables into a flat tree.
And it works just fine for a lot of variables (as for ntracks in the example below), but when it comes to a ...
6
votes
3
answers
196
views
Get last non-zero index in a vector
I have a 1D NumPy array, and I want to find the index of the last non-zero element. The vector consists only of 1s and 0s, not sure if this is relevant information.
For example:
import numpy as np
...
-1
votes
1
answer
173
views
Use of 1D vs. 2D vectors in C++ implementation [closed]
After some extensive search I could not find a clear answer to the following issue. When one is to compare the 1D (vector<type>) vs 2D (<vector<vector<type>>>) vector ...
0
votes
1
answer
98
views
Spring Boot 4 + Postgres EXTENSION vector not working correct
I'm trying to implement the use of vectors in my application.
I raised the version of Spring boot to 4.0.0-M1. This also gives me hibernate 7.
Added EXTENSION vector to Postgres
Added dependency:
&...
1
vote
1
answer
142
views
In the Autodesk Viewer SDK, how do I get the Vectors for a selected element from a locally loaded PDF?
I have been developing a POC application to load a PDF into the Autodesk GUIViewer3D, and using a custom extension, draw PolygonPaths and PolylinePaths over the PDF. My extension is simple, it adds a ...
3
votes
0
answers
101
views
CUDA: Load misaligned float4 vector
I want to load 4 floats per thread. I know they are not 16 byte aligned. What is the best way to do this?
Specific conditions:
I cannot align the array without replicating the data because other ...
4
votes
2
answers
220
views
Can the back() iterator of a vector be safely assumed to be the end() iterator after a pop_back()?
My problem is the following :
std::vector<struct pollfd> vec = { ... }; // Actually a member variable on a Server object
for (auto iter = vec.begin(); iter != vec.end(); ) {
if (...
1
vote
2
answers
108
views
Modify a mutable vector in chunks
I am very new at the ST monad, and have reached my wits end in trying to correct the error in the code below.
I have a buildChain function, which we can assume works, takes an Int and returns a list ...
0
votes
0
answers
47
views
Trying to deflect an object when it enters a trigger in Unity
I'm having trouble deflecting a projectile (Fireball) when it enters the trigger of an object (Shield / Deflector). This is a 3d game with a top-down view, it should only deflect in the x and z ...
1
vote
1
answer
84
views
How to downcast any List or any Option in rust
I want to add properties window with auto properties based on struct fields. I'am downcasting every field, but for Vec<> and Option<> I have to duplicate all code, how can I automatically ...
0
votes
0
answers
44
views
Jvectormaps - Combining Javascript SVG maps
I'm using a Jquery library JSVectorMap (https://jvm-docs.vercel.app/docs/available-maps) to generate interactive SVG-based maps and add markers to them based on coordinates. This works great and I ...
0
votes
3
answers
214
views
Confusion about invalidated iterators
If vectors are stored contiguously, as long as they are not made smaller or reallocated, any iterator pointing to an element within it should be valid. The following code would be defined:
#include &...
0
votes
0
answers
26
views
Find out exact layer type from ag-psd parsed psd file
I am working on a system that parses psd file into json so I can create the layers in our data structure. I use ag-psd for the parsing.
ag-psd
In the docs there is this snippet
// complex parsing
...
4
votes
2
answers
189
views
Understanding how Rust elides lifetimes with mutable references
I want to understand lifetimes and the elision rules better.
Suppose we want to extend a Vec<i32> (really Vec<&i32>)
fn extend_vector(
v: &mut Vec<&i32>,
x: &...
1
vote
2
answers
73
views
Vector from Class objects vector as 2D vector function parameter
Solution requirements:
Pre C++11
Statements:
Function someFunction exists, that accepts 2D vector as vector of string vectors: vector2d.
Class someClass exists, that contains 1D vector of strings: ...
1
vote
0
answers
73
views
Xml vector image in Kotlin multiplatform
i have a very simple image
Image(
imageVector = vectorResource(Res.drawable.swords),
contentDescription = null,
modifier = Modifier.width(82.dp)
.clip(shape = ...
2
votes
2
answers
195
views
Is it safe to .pop_back() from an std::vector in order to avoid pointers/memory shifting?
I have this class:
class Socket
{
[...]
pollfd* fdPtr;
};
And I have a Manager class that creates the actual pollfd objects and adds them to a std::vector named pollFdsVec, to then poll on ...
4
votes
2
answers
206
views
Sum the vectors stored in the list using Rcpp
Suppose I have the following list of vector
List <- list(c(1:3), c(4:6), c(7:9))
To get the required result I have the following code in Rcpp
totalCpp <- {"#include <Rcpp.h>
using ...
1
vote
1
answer
63
views
Matrix Multiply with Vector and Tensor in Python
I have a Vector, M, with size N and a Tensor, d, with size NxNxD.
My aim is to perform the matrix multication M*d[i,:,:] for each i to get a new matrix with size nxD.
Now I could just do it like this:
...
1
vote
1
answer
75
views
How to index the overlaps between two vectors in rust
I've been hunting for what I would hope would be a std function, but can't find it. I'm looking for function or method that gives vector overlaps. So, assuming the two vectors:
let my_vector1 = ["...
4
votes
1
answer
98
views
Why aren't all instances of Data.Vector.Fixed.Vector also instances of Functor?
For Vec2, Vec3, and others from Data.Vector.Fixed.Boxed, I see a Functor instance, so something like this type-checks:
fff :: B.Vec2 Int -> B.Vec2 Int
fff = fmap (+1)
and fmap is just Data.Vector....
14
votes
7
answers
1k
views
Subtracting a named vector from another named vector
I have 2 vectors as below
Vec1 = c(1,2,3,4)
names(Vec1) = c('Val1', 'Val2', 'Val3', 'Val4')
Vec2 = c(10, 11)
names(Vec2) = c('Val2', 'Val4')
Is there any easy way to subtract Vec2 from Vec1 based on ...
1
vote
0
answers
119
views
Why can't I do emplace_back(...) instead of push_back({...})? [duplicate]
I thought the point of emplace_back was to forward arguments to the constructor instead of constructing a temporary object, but here it gives me a long nasty compiler error I can't interpret, whereas ...
2
votes
1
answer
102
views
Calling a function that returns a vector by value in place and iterating over elements causes first value to be garbage
I have been trying to integrate boost geometry into a project but run into an issue when I return a polygon geometry from my custom class. The following is a minimal example that reproduces what I am ...
3
votes
3
answers
143
views
Delete only one element from a string if there is at least one match to the element
I have the following strings:
remove_none <- "B,B,C,C,D"
remove_A <- "B,B,C,C,A"
remove_only_one <- "B,A,C,A,C,A"
I want to remove only one A if there is at ...
0
votes
1
answer
74
views
Taking advantage of demand paging instead of using data structures like std::vector
Suppose we want to generate and store a large number of integers. We dont know exactly how many, but we know that we wont have more than some significantly larger number. If we use a std::vector to ...
1
vote
1
answer
151
views
Neo4j vector similarity function
I'm trying to understand the difference between the vector.similarity.cosine Cypher function and the gds.similarity.cosine function in Neo4j. According to the Neo4j documentation, both are used to ...
1
vote
0
answers
279
views
Custom embedder and Custom knowledge source in CrewAI - getting KeyError: 'OPENAI_API_KEY'
I have setup a Custom Embedder to use with knowledge and tools, but keep getting the error:
litellm.AuthenticationError: AuthenticationError: OpenAIException -
The api_key client option must be set ...
0
votes
1
answer
267
views
How to handle negative search queries in a vector similarity search query?
I'm working with a vector database (qdrant) and using semantic search via embeddings (Sentence Transformers).
My use case involves queries like:
"Give animals other than cats"
or
"List ...
1
vote
1
answer
133
views
"Unsupported datatype 'VECTOR(FLOAT, 768)" when assigning embedding to variable
I want to write a Snowflake scripting block where I embed some text, then do some cosine similarity search. Ideally I would like to be able to assign the embedded text to a variable so I can re-use in ...
0
votes
0
answers
53
views
is there an R FUNCTION for finding an index of an element in a vector [duplicate]
I'm working with vectors and need to find the index (or position) of a specific value within a vector. I want to know if there's a built-in function that returns the index of the element I'm looking ...
0
votes
1
answer
104
views
C2664 Compilation Error with Nested std::for_each and Lambda Functions [duplicate]
std::vector<std::vector<bool>> grid(4, std::vector<bool>(4, true));
std::for_each(grid.begin(), grid.end(), [](auto& row) {
std::for_each(row.begin(), row.end(), [](auto& ...
2
votes
4
answers
315
views
std::vector: when is a pointer not a pointer?
I have this existing working code, which I am trying to convert to implementation:
Bitmap *pbitmap = new Bitmap(L"images.png");
nWidth = pbitmap->GetWidth();
nHeight = pbitmap->...