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
6
votes
2 answers

Openlayers 3 How to render every point in a geometry at a high ( small ) resolution?

How do I force ol3 to render every single point in a geometry? I'm having an issue with openlayers 3, where although I'm plotting a line string with 3000 points over a distance of maybe 100m, only about 1000 are rendering. EDIT: Now - Openlayers 3…
ryansstack
  • 1,396
  • 1
  • 15
  • 33
5
votes
2 answers

Find boolean mask by pattern

I have array: arr = np.array([1,2,3,2,3,4,3,2,1,2,3,1,2,3,2,2,3,4,2,1]) print (arr) [1 2 3 2 3 4 3 2 1 2 3 1 2 3 2 2 3 4 2 1] I would like find this pattern and return booelan mask: pat = [1,2,3] N = len(pat) I use…
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
5
votes
1 answer

Numpy stride tricks complaining "array too big", why?

In numpy (1.8), I want to move this computation out of a Python loop into something more numpy-ish for better performance: (width, height) = base.shape (toolw, toolh) = tool.shape for i in range(0, width-toolw): for j in range(0, height-toolh): …
payne
  • 13,833
  • 5
  • 42
  • 49
4
votes
2 answers

D dynamic array initialization, stride and the index operation

Sorry, this became a 3-fold question regarding arrays I think (dynamic) arrays are truly powerful in D, but the following has been bothering me for a while: In C++ I could easily allocate an array with designated values, but in D I haven't found a…
Taco de Wolff
  • 1,682
  • 3
  • 17
  • 34
4
votes
1 answer

How to convert a numpy array view to opencv matrix?

I'm using opencv v2.2 to do some template matching on ndarrays, and I had great trouble with memory leaks when using their wrapped method cv.fromarray(). Rather than plug the memory leaks I avoided the fromarray() function and used cv.SetData…
wim
  • 338,267
  • 99
  • 616
  • 750
4
votes
2 answers

pytorch cnn stride error

I am now using pytorch 0.4.0 in windows to build a CNN and here is my code: class net(nn.Module): def __init__(self): super(net, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=(1,3),stride=1…
Ddj
  • 41
  • 1
  • 2
4
votes
1 answer

What is the meaning of 2D stride in convolution?

I know what meaning stride has when it is just an integer number (by which step you should apply filter to image). But what about (1, 1) or even more dimensional stride?
4
votes
0 answers

Stride() excludes the "through" value in some cases, when using Double

I ran into a strange problem, which I want to understand background of: func printIntervals(_ colors: Int) { let start = 0.4 - (Double(colors) - 1) / 10 print("start: \(start)") for i in stride(from: start, through: 0.4, by: 0.1) { print…
Esben von Buchwald
  • 2,772
  • 1
  • 29
  • 37
4
votes
1 answer

Swift's stride(from: , to: , by: ) causing "cannot invoke"

I'm using Swift's stride for the first time. However first is on the verge of being the last since I can't get this to work: let boundingBox = createdShape.frame //=SKShapeNode stride(from: Int(boundingBox.minX), to: Int(boundingBox.maxX), by: 10)…
user594883
  • 1,329
  • 2
  • 17
  • 36
4
votes
5 answers

How can I slice an int array by stride in Java?

I am learning Java. In Python, I can: my_list = [1,2,3,4] my_new_list = my_list [::-1] print my_new_list # [4,3,2,1] Is there any method I can use in Java to do that on int array? Edit1: Sorry for the bad example. How about my_list…
Jay Wang
  • 2,650
  • 4
  • 25
  • 51
4
votes
1 answer

Unity Compute Shaders Vertex Index error

I have a compute shader and the C# script which goes with it used to modify an array of vertices on the y axis simple enough to be clear. But despite the fact that it runs fine the shader seems to forget the first vertex of my shape (except when…
Géry Arduino
  • 490
  • 5
  • 16
4
votes
1 answer

How do I make a strided copy from global to local memory?

I want to copy some data from a buffer in the global device memory to the local memory of a processing core - but, with a twist. I know about async_work_group_copy, and it's nice (or rather, it's klunky and annoying, but working). However, my data…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
4
votes
1 answer

MPI - Sending segments of an array

So I have an array of doubles. I would like to send, say every 5th double, to the receiving process. So essentially, I need a way of sending specific doubles with strides between them. Is there a function to do this, apart from storing the doubles…
JessMcintosh
  • 460
  • 2
  • 6
  • 21
3
votes
3 answers

How strided memcpy(3) works in libvpx

I'm trying to understand the following function in libvpx (vp8/common/reconinter.c): void vp8_copy_mem16x16_c(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride) { int r; for (r = 0; r < 16; ++r) { …
Yuuta Liang
  • 118
  • 2
  • 7
3
votes
1 answer

What is stride in c

What is 'stride' in C and how can it be used?
codester_09
  • 5,622
  • 2
  • 5
  • 27
1
2
3
10 11