Questions tagged [stride]

The stride of an array is the number of locations in memory between beginnings of successive array elements, measured in bytes or in units of the size of the array's elements. Arrays may have a stride larger than their elements' width in bytes, which are called a non-unit stride. One particular use of non-unit stride is for images, when creating subimages without copying the pixel data.

The stride of an array is the number of locations in memory between beginnings of successive array elements, measured in bytes or in units of the size of the array's elements. Arrays may have a stride larger than their elements' width in bytes, which are called a non-unit stride. One particular use of non-unit stride is for images, when creating subimages without copying the pixel data.

157 questions
1
vote
2 answers

Swift: For Loop to iterate through enumerated array by index greater than 1

Is there a way to use a for-in loop through an array of strings by an index greater than 1 using .enumerated() and stride, in order to keep the index and the value? For example, if I had the array var testArray2: [String] = ["a", "b", "c", "d",…
Biggytiny
  • 519
  • 10
  • 29
1
vote
1 answer

GLES2.0 glVertexAttribPointer: Performance penalty for using odd Stride and Offset values?

I have some packed vertex data that runs to 6 bytes per vertex: glVertexAttribPointer Shader.pos3d_loc, 3, GL_UNSIGNED_BYTE, True, 6, 0 glVertexAttribPointer Shader.norm_loc, 3, GL_UNSIGNED_BYTE, True, 6, 3 Are there any performance penalties (eg…
Peeling
  • 356
  • 1
  • 12
1
vote
1 answer

effective memory bandwidth from strided memory access

Suppose I have a kernel which performs strided memory access as follows: __global__ void strideExample (float *outputData, float *inputData, int stride=2) { int index = (blockIdx.x * blockDim.x + threadIdx.x) * stride; …
meta_warrior
  • 389
  • 1
  • 6
  • 18
1
vote
1 answer

Tensorflow output from stride

While trying to use Tensorflow I encountered a little problem regarding the stride. I have an image of size 67*67, and I want to apply a filter of size 7*7 with stride 3. The output layer should have an edge length of 20 calculated from: Where n is…
1
vote
1 answer

Using stride() on UInt in Swift 2.2 will not compile

I am trying to use the stride() function on UInt variables, but the code will not compile: let s = UInt(1) let by = UInt(2) let to = UInt(10) for i: UInt in s.stride(to: to, by: by) { } The compile error is: Cannot invoke 'stride' with an…
Pelle Stenild Coltau
  • 1,268
  • 10
  • 15
1
vote
0 answers

Get data from pointer array and with specific stride/stepsize

I have a C pointer array from which I want to get the data in Swift. However, I need to get the data with a specific stride/stepsize and without a for loop to keep it efficient. To get all the data I would do this: let dataStrided =…
Gerard
  • 349
  • 2
  • 16
1
vote
1 answer

Add Offset to Indices of Numpy Array

Following up to this question (and jorgeca's answer): Fast Way to slice image into overlapping patches and merge patches to image I want to add an offset to the indices of the patchified array, i.e: A = np.arange(W*H).reshape(H,W) P =…
memecs
  • 7,196
  • 7
  • 34
  • 49
1
vote
0 answers

Dividing an image into different sized windows which are centred. Python

I am currently trying to divide an image into smaller windows, which are later used for cross-correlation. The below function works well for the purpose (window_size is the length of the window size in pixels (assumed to be square), overlap is by…
leb
  • 544
  • 1
  • 6
  • 17
1
vote
3 answers

What is the stride for a 256 color (8 bit) bitmap?

There are lots of questions (and answers) here and elsewhere about calculating stride. I've got some bitmaps that I need to read into memory. Everything works fine IFF they are 16.5 million colors (24 bit). However, I only need them to be 256 color…
zetar
  • 1,225
  • 2
  • 20
  • 45
1
vote
0 answers

Vertex buffers and rendering problems

I am trying to approximate a curved surface using quadrilateral patches. I did it using straight forward rendering using GL_QUADS and specifying the four vertices of the quad patch. Now I am trying to get some performance using vertex buffers and…
AdityaG
  • 428
  • 1
  • 3
  • 17
1
vote
1 answer

What is stride in glVertexPointer, glTexCoordPointer in VBO

Hi I have a problem drawing with VBO. So I asked a question a here .I could not find the answer of my problem. But by discussing one answer given there I have now another question about strides in VBO. I am confused about what it is and does. In…
Tahlil
  • 2,680
  • 6
  • 43
  • 84
0
votes
0 answers

How Does Cuda Interpret Stride Loops

I'm having trouble understanding how the stride loop actually works. For just generally iterating through arrays. This is the example stride loop that I found. For a single block stride loop. <<<1, 256>>> __global__ void add(int n, float *x, float…
0
votes
0 answers

Why are sizes and strides of SIMD3 and SCNVector different?

So when I was working with buffers I was having something like UnsafeRawPointer (which consisted of SCNVector3) and I was casting it to UnsafeBufferPointer>. And then I saw that my function that reads information from that produces…
0
votes
2 answers

How to use cupy.lib.stride_tricks.as_strided(x, shape=None, strides=None)

I was using: np.lib.stride_tricks.sliding_window_view with a 1D-array and two parameters (the array and the length of the subset n) to slice it into slices of n elements (n < 1D-array.shape, of course) I think I can go faster with cupy and I…
tibibou
  • 164
  • 10
0
votes
1 answer

Python (32-bit) librosa error: ValueError: array is too big; `arr.size * arr.dtype.itemsize` is larger than the maximum possible size

I am trying to use librosa to extract audio features. I use a Raspberry Pi 4 running 32-bit RaspiOS running Python 3.8.7. When I try to run the code: import librosa import numpy as np soundddata, fs = librosa.load('_a_3MB_sound_wav_file',…
BlackOut
  • 1
  • 1