Questions tagged [contiguous]

145 questions
6
votes
2 answers

Are variables contiguous on the stack?

I'm wondering if the arrays a[] and b[] in the code below are contiguous in memory: int main() { int a[3]; int b[3]; return 0; } a[0],a[1] and a[2] should be contiguous and the same for b, but are there any guarantees on where b will…
Dievser
  • 85
  • 1
  • 6
6
votes
3 answers

Split by a character in JavaScript but not contiguous ones

Here is the case: var stringExample = "hello=goodbye==hello"; var parts = stringExample.split("="); Output: hello,goodbye,,hello I need this Output: hello,goodbye==hello Contiguous / repeated characters must be ignored, just take the single "="…
Martín
  • 3,105
  • 7
  • 25
  • 43
5
votes
1 answer

Python : Rounding errors between C-contiguous and F-contiguous arrays for matrix multiplication

Problem : I stumbled across a problem that has deep (and very impactful) consequences in the industry, and does not seem to be documented anywhere : It seems that in python, Matrix Multiplication (using either @ or np.matmul) gives different…
Jean Lescut
  • 1,387
  • 1
  • 12
  • 17
5
votes
2 answers

shuffling algorithm for two-dimensional array with contiguous data

i have a two dimensional array that has the following values due to an algorithm i created, String [2,12] array = { {"ab","ab","ab","FREE","me","me","me","FREE","mo","mo","FREE","FREE"}, …
user2227986
5
votes
3 answers

How to check whether iterators form a contiguous memory zone?

I currently have the following function to read an array or a vector of raw data (_readStream is a std::ifstream) : template inline bool MyClass::readRawData( const IteratorType& first, const IteratorType& last, …
Vincent
  • 57,703
  • 61
  • 205
  • 388
4
votes
2 answers

Contiguity of arrays in modern Fortran

I am reading "Modern Fortran Explained" (2018 edition). It says on p24: Most implementations actually store arrays in contiguous storage in array element order, but we emphasize that the standard does not require this. I believe that this already…
Twirl
  • 57
  • 2
4
votes
3 answers

Identify at least N contiguous cells that match a certain criteria, in a grid

I have an X by Y grid with cells containing 1 if a certain criteria is met or 0 if it is not. Now I want to identify features in the grid where there are at least N contiguous cells containing a 1. Contiguous cells can be adjacent side by side, or…
ZippyP
  • 53
  • 4
4
votes
4 answers

How and when is the memory of a global or static array allocated?

When defining a global or static array in c++ its memory is not immediately reserved at the start of the programme but only once we write to the array. What I found surprising is, if we only write to a small part of the array it still does not…
tom
  • 333
  • 4
  • 12
4
votes
1 answer

RuntimeWarning: Cannot provide views on a non-contiguous input array without copying

when using skimage I get the following error: win = skimage.util.view_as_windows(x, windowSize, windowShift) C:\Program Files\Anaconda2\lib\site-packages\skimage\util\shape.py:247: RuntimeWarning: Cannot provide views on a non-contiguous input…
gabboshow
  • 5,359
  • 12
  • 48
  • 98
4
votes
1 answer

How to find and name contiguous non-zero entries in a sparse matrix in R?

My problem is conceptually simple. I am looking for a computationally efficient solution of it (my own one I attach at the end). Suppose we have a potentially very large sparse matrix like the one on the left below and want to 'name' every area of…
GiuGe
  • 65
  • 5
4
votes
2 answers

largest sum contiguous sub array using recursion to directly output result

Is is possible to find the largest sum contiguous sub array using recursion such that the function would directly return the output. Below is my solution where I store the max subarray ending at each index and then find the largest among those in…
tubby
  • 2,074
  • 3
  • 33
  • 55
4
votes
1 answer

does python stores similar objects at contiguous memory locations?

Does Python stores similar objects at memory locations nearer to each other? Because id of similar objects, say lists and tuples, are nearer to each other than an object of type str.
dotslash
  • 2,041
  • 2
  • 16
  • 15
4
votes
1 answer

Finding groups of contiguous numbers in a list

This is a duplicate question to this, except for R rather than Python. I'd like to identify groups of contiguous (some people call them continuous) integers in a list, where duplicate entries are treated as existing within the same range.…
canary_in_the_data_mine
  • 2,193
  • 2
  • 24
  • 28
3
votes
0 answers

pandas DataFrame values C/F contiguous reasons

What are the reasons that pandas DataFrame values are implemented as C-contiguous numpy array for numeric data types and as F-contiguous numpy array for string (object) data types? import numpy as np, pandas as pd ai = np.array([[0,1,2],[3,4,5]],…
S.V
  • 2,149
  • 2
  • 18
  • 41
3
votes
1 answer

Passing non-contiguous argument to contiguous dummy array in a Fortran procecdue

Recently I encountered unexpected behavior of Fujitsu Fortran Version 2.0.0 while dealing with a subroutine which has dummy array with the contiguous attribute. I have reduced the problem to a simple example which is here: program test INTEGER,…
1
2
3
9 10