Skip to main content
Filter by
Sorted by
Tagged with
Tooling
0 votes
6 replies
52 views

I have a task to convert user PNG image to SVG with maximum possible color number coming from user setting (e.g. 8). It means that i should make initially image created from 8 colors and then convert ...
NickTaylor98's user avatar
3 votes
1 answer
201 views

How do I know if rustc or LLVM is doing the vectorizing? How can I fix this specific example? Here's a simplified piece of extremely performance-sensitive decompression code I would like to use: pub ...
mwlon's user avatar
  • 1,096
3 votes
2 answers
190 views

I have two functions counting the occurrences of a target char in the given input buffer. The functions vary only in how they communicate the result back to the caller; one returns the result and the ...
Devashish's user avatar
  • 193
2 votes
2 answers
135 views

Short version: How do I vectorize two matrices A and B by column so that I can pass the 1st, 2nd, ..., ith column of A and the 1st, 2nd, ..., ith column of B to a function without a loop? I have two ...
pimple's user avatar
  • 358
5 votes
1 answer
289 views

(Edited to incorporate fixed=TRUE as suggested by @r2evans.) For two character vectors, str and pattern, I want to return the indices where pattern is found in str, as in this Q&A: pattern <- c(...
jblood94's user avatar
  • 17.5k
3 votes
1 answer
88 views

In this example, I want to construct expressions to vectorize the labelling of three ellipses in the following fig with expressions for the size of the ellipse, but each expression involves data ...
user101089's user avatar
  • 4,083
1 vote
2 answers
164 views

In the documentation, JAX provides vectorization. However, aren't JAX operations already vectorized? For example, to add two vectors, I thought that the element-wise additions were vectorized ...
Mingruifu Lin's user avatar
5 votes
2 answers
270 views

I'm using Python 3.12.11 with Numba 0.61.2 on Ubuntu 22.04.5 and AMD Ryzen 7 3800X CPU. This benchmark: import numpy as np, timeit as ti, numba as nb @nb.njit(fastmath=True) def f1d(img, w): fl = ...
Paul Jurczak's user avatar
  • 8,628
0 votes
0 answers
154 views

Let's say I have an expensive jitted function f(x) and I've vmapped it over a large array of inputs -- is there any way to monitor the progress of how many of the vmapped inputs are done being ...
Jim Raynor's user avatar
0 votes
0 answers
105 views

We tried profiling a simple MAC operation using both RISC-V Vector (RVV) intrinsics and plain C code. Surprisingly, the C version performs better, even though the intrinsics code processes 16 ...
shreyas's user avatar
0 votes
1 answer
79 views

I'm trying to use MUVERA compression with Jina ColBERT v2 embeddings in Weaviate, following the official documentation. However, MUVERA compression is not being applied: I'm still getting raw multi-...
tat's user avatar
  • 351
3 votes
2 answers
110 views

I have a matrix M with size (37, N) and an additionnal 1D reference vector of size (37,1) I am looking for a way to compute the spearman correlation between each sample of M and my reference to obtain ...
QuanticDisaster's user avatar
4 votes
1 answer
75 views

I'm working with a function in Python that constructs a 4×4 matrix based on inputs (x1, y1, x2, y2), and computes its eigenvalues and eigenvectors using np.linalg.eigh. Here is a simplified version of ...
Rinchen Sherpa's user avatar
1 vote
1 answer
90 views

I am using python to perform the homotopy formula to obtain a vector potential A of a magnetic field B at points x in 3D space: A(x) = integral_L=0,1 (B(Lx)cross(Lx)dL) where cross represents the ...
phryas's user avatar
  • 29
4 votes
2 answers
184 views

Intro Consider a tournament with four players and the following schedule: Rd 1: 1-4, 2-3. Rd 2: 4-3, 1-2. Rd 3: 2-4, ---. The usual way to display tournament results is the cross table, for example: ...
clp's user avatar
  • 1,602
1 vote
1 answer
130 views

I'm working with a Pandas DataFrame where I need to track a boolean flag (in_position) that becomes True after an entry_signal and resets to False only after an exit_signal. This must be done ...
Victor Hanukayev's user avatar
2 votes
2 answers
88 views

I have a dataframe with a column multi-index, df1, with a datetime index and 2 levels: level 0, called Capitals, has columns A, B, C, and level 1, called Smalls, has columns a, b, c, d, e. Capitals A ...
AndysPythonStuff's user avatar
2 votes
1 answer
100 views

I have an arbitrary Matrix M which is (N x A). I have a column vector V (N x 1) which has on each row the amount of entries I would like to keep from the original M <= A (starting from the leftmost)...
rankednullity's user avatar
1 vote
1 answer
107 views

New Post: Processing satellite conjunctions with numpy efficiently Original Post: I have a numpy array of shape n x m x r, where the n axis represents an object, the m axis represents a timestep and ...
SPZHunter's user avatar
1 vote
1 answer
173 views

I have a function that is roughly as follows from flax import nnx from jax import Array from typing import List def predict(models: List[nnx.Module], imgs: Array): for i, agent in enumerate(...
elderly's user avatar
  • 21
0 votes
1 answer
72 views

I'm building a chatbot that uses Weaviate and t2v-transformers for vectorizing my knowledge base. My way of sends batches like this: var batchResponse = await _httpClient.PostAsync($"{...
Vedo's user avatar
  • 633
0 votes
1 answer
89 views

I have a battery simulation script where the battery’s state-of-charge (SOC) is updated iteratively. The charge and discharge values (how much energy is added/taken from the battery) at each timestep ...
Ralph Hage's user avatar
3 votes
1 answer
240 views

New to SIMD please go easy on me if I have made any mistakes. I am using windows vs studio for dev, msvc ISO C++20. My processor is 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz Before using AXV, I ...
somewhat_clueless_developer's user avatar
2 votes
2 answers
281 views

The documentation for both Vector and Vector128 structs are really similar and there is an AsVector/AsVector128 method to switch between them. However, is there a case where I should use one over the ...
Valentin Arthur Thomas's user avatar
0 votes
1 answer
27 views

OpenCL offers built-in/intrinsic "vector types" (see table 3 at the link), such as int4 or float2. It also defines binary and unary elementwise operators which accept these types, e.g. ...
einpoklum's user avatar
  • 137k
4 votes
1 answer
113 views

I have matrices A (m by v) and B (v by n). I also have a logical matrix L (m by n). I am interested in calculating only the values in A * B that correspond to logical values in L (values of 1s). ...
Cal's user avatar
  • 41
2 votes
4 answers
450 views

I have a jax 2d array with some nan-values array_2d = jnp.array([ [jnp.nan, 1, 2, jnp.nan, 3], [10 ,jnp.nan, jnp.nan, 20,jnp.nan] ]) and want to get an ...
black's user avatar
  • 1,263
2 votes
1 answer
118 views

Is there a smart way to vectorize a nested for loop of inner products, where the inner index is lower bound by the outer index? Here's a simple example. Say that arr1 and arr2 are numpy arrays each ...
AJoR's user avatar
  • 49
2 votes
0 answers
67 views

I am working on a Python project that uses swig to connect the main Python code to a C++ module. I recently added a new function to the C++ library, but in functions with the @numpy.vectorize ...
user29650973's user avatar
2 votes
1 answer
98 views

I have the following code: #include <iostream> #include <numeric> int main() { volatile float a0[4] = {1, 2, 3, 4}, a1[4] = {4, 5, 6, 7}; std::cout << std::...
CPlus's user avatar
  • 5,110
-5 votes
1 answer
194 views

I have a little minimal sample algorithm (please ignore if the algorithm itself doesn't make sense and could be changed to be different, its just a contrived sample to demonstrate what I'm seeing). ...
Malcolm MacLeod's user avatar
0 votes
0 answers
29 views

The MWE below shows that vectorize returns zeros instead of the actual values. Compare the printout from within the function to the arrays returned in the second test. It is curious that the first ...
Tom Kuiper's user avatar
0 votes
1 answer
67 views

I have this code that I wrote and it's taking too long to run. I was advised to vectorize this operation but so far I have found only multiplication examples. Here is my code: my_dict = {} for i in ...
regina_adams's user avatar
8 votes
4 answers
177 views

Assuming we have a matrix M of size N^2 x N^2 elements (e.g., 9x9), what's the fastest way to split it into say 3x3 segments (each with 3x3 elements). One way that comes to mind is the following: M = ...
the_wicked's user avatar
0 votes
1 answer
81 views

I'm trying to avoid a for loop with DateTimeIndex. I have a function get_latest that looks up the most recent wage index value. When I step through the dates of pay days, the lookup works fine. When I ...
virtualdynamo's user avatar
0 votes
2 answers
149 views

Is there a way to vectorize the following three-nested loop that calculate the daily mean of hourly data? The function below loops first over the year, then months, and finally over days. It also ...
Kernel's user avatar
  • 725
0 votes
1 answer
65 views

I have a function func(x) where the argument is a vector of length n. I would like to minimize it in respect to i-th component of x while keeping the other components fixed. So to express it as a ...
Roger V.'s user avatar
  • 803
3 votes
1 answer
144 views

I am looking for a way to vectorize the following code, # Let cube have shape (N, M, M) sub_arrays = np.empty(len(cube), 3, 3) row_start = ... # Shape (N,) and are integers in range [0, M-2] row_end ...
Austin's user avatar
  • 33
2 votes
1 answer
94 views

I have this code: __attribute__((target("avx2"))) size_t lower_than_16(const uint64_t values[16], uint64_t x) { __m256i vx = _mm256_set1_epi64x(x); __m256i vvals1 = ...
Kevin Meier's user avatar
  • 2,644
4 votes
5 answers
271 views

I need to draw random samples without replacement from a 1D NumPy array. However, performance is critical since this operation will be repeated many times. Here’s the code I’m currently using: import ...
Mark's user avatar
  • 87
1 vote
1 answer
108 views

I am unsure what is the best way to vectorize objects in Python Jax. In particular, I want to write a code that handles both calling a method from a single instantiation of a class and from multiple (...
Sam's user avatar
  • 324
0 votes
0 answers
53 views

I am trying to be more elegant in my coding and leveraging the apply functions. I wanted to stick one in a loop like so for (ind in (ind2fix )) { ADPPK[,ind] = mapply(categorize_cov,value = ADPPK[,...
TheCodeNovice's user avatar
1 vote
1 answer
65 views

I'm working with a Pandas DataFrame that utilizes a DatetimeIndex with timezone information. My objective is to compute the timezone offset (in hours) for each timestamp and store these offsets in a ...
Hobbit's user avatar
  • 13
0 votes
1 answer
91 views

Please imagine I have a dataframe like this: df = pd.DataFrame(index=pd.Index(['1', '1', '2', '2'], name='from'), columns=['to'], data= ['2', '2', '4', '5']) df: Now, I would like to calculate a ...
Saeed's user avatar
  • 2,151
1 vote
1 answer
245 views

I am trying to upsert a vector in my cloudflare vectorize index For now I am testing from my terminal using cURL Call I am making is this: curl -v --request POST --url https://api.cloudflare.com/...
Shakil Ahmed's user avatar
0 votes
1 answer
45 views

I have a numpy array that holds board game states for all possible moves, and I want to summarize some of those moves. I'm struggling to vectorize that code and avoid a for loop when I choose which ...
Don Kirkby's user avatar
  • 56.7k
0 votes
0 answers
97 views

Assume the function below. There are two extents that have been picked to be 3 and 17. We wish to vectorize SomeWork (it is in the translation unit and simple). The naive approach I take is to flatten ...
Etienne M's user avatar
  • 715
0 votes
0 answers
11 views

I have two vectors, say x <- c("a","b","c","d","e") y <- c("b","e") I want to derive a vector containing the indices of ...
FGWeller's user avatar
1 vote
1 answer
89 views

I am working on a function to process 3D images voxel-by-voxel. For each voxel, I compute the difference between the voxel value and its 3x3x3 neighborhood, apply distance-based scaling, and determine ...
Laurids's user avatar
  • 31
3 votes
2 answers
339 views

I’m working on a Monte Carlo simulation project, and I need help optimizing some aspects of the problem. Here’s the scenario : We model claims R (linked to weather-dependent events) as independent ...
Fractal's user avatar
  • 143

1
2 3 4 5
137