Questions tagged [vectorization]

Use this tag if your code contains vectorized operations - where functions operate on whole arrays in one go. If it doesn't, but you want it to, then you should make those changes (perhaps with help from elsewhere) before presenting code for review.

12 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers

C# Generic high performance vectorized math operations

I'm writing a library which simplifies the usage of intrinsics in C#. It's a generic library which supports all numeric types. The goal of this library is to perform these operations at the highest ...
Gilad Freidkin's user avatar
3 votes
0 answers

Implement vectorization instead of nested loops on dataframe

I have a dataset ('sample_data.csv') of the form below: ...
rfguy's user avatar
  • 31
3 votes
0 answers

Optimising multiplication of matrix rows with matrix slice/page

I've recently vectorized most of the code for an optimization problem but this one still eludes me. As the procedure and not the actual values are important here, I have replaced the original matrices ...
deemel's user avatar
  • 131
3 votes
0 answers

Merging bin-data via a bin count threshold

When performing a chi-squared test, one takes the square of the differences of the expected counts per bin and observed counts per bin, and divides these per-bin differences by the expected counts per ...
user avatar
3 votes
1 answer

Snake from the viewpoint of the snake

I wrote a little game of snake that where you can see the field in which the snake moves fixed and you can also see the "viewpoint" of the snake, which is basically calculating the positions ...
Javier Camacho's user avatar
2 votes
0 answers

Vectorizing a working custom similarity function further using numpy

I am new to python, and even more new to vectorization. I have attempted to vectorize a custom similarity function that should return a matrix of pairwise similarities between each row in an input ...
dddxxx's user avatar
  • 121
2 votes
0 answers

Vectorize a function that, once per row, updates multiple rows in data.table

Requirements I have a table of the different diagnoses a patient has received, with the date the diagnosis was first recorded. It so happens that in medicine, diagnoses are recorded as codes from a ...
Rumi P.'s user avatar
  • 201
1 vote
0 answers

Computing the angle between two vectors (vectorized) for small angles and with few copies

I am implementing a function that computes the angle between two vectors when given two n-dimensional arrays and an axis along which to operate. I want to do this with as few copies as possible, and ...
FirefoxMetzger's user avatar
1 vote
0 answers

Faster Tridiagonal Matrix Multiplication

I have a function that I've been trying to make faster that computes \$XA + B\$, where \$A \in \mathbb{R}^{n \times n}\$ is a tridiagonal matrix, and \$X, B \in \mathbb{R}^{m \times n}\$. In the code, ...
vlovero's user avatar
  • 101
1 vote
0 answers

Custom Model intended to be used for Curve Fitting. Vectorization vs For Loop and jit numba capabilities

I am new to community and please pardon me if I didn't provide information as intended. This code is supposed to be creating a custom model which will be used with ...
Shankar_Dutt's user avatar
1 vote
0 answers

condensed nearest centroid classifier in numpy

This is my attempt to write a numpy-optimized version of a nearest centroid classifier to classify some images from the MNIST data set of handwritten digits. I am ...
Grayscale's user avatar
  • 127
0 votes
0 answers

Three-dimensional DCT implementation for GPU computation in Matlab

This is a follow-up question for Three-dimensional DCT spatial frequency components illustration and Parallel 3D Discrete Cosine Transformation Implementation in Matlab. I am trying to perform three-...
JimmyHu's user avatar
  • 3,984