Questions tagged [contiguous]

145 questions
0
votes
1 answer

Determining the time complexity of Java code

I am working on a Java practice interview problem for finding the number of Contiguous Subarrays. I have a working solution, and just want to make sure I understand the time complexity of my answer: //solution is called with array of n length like…
0
votes
0 answers

Numpy Concatenate Produces array whose slices are non F-Contiguous?

Background I'm passing large matrices into a Cython function which in turn calls the BLAS routine dgemm. I've been pulling my hair out for 15 hours trying to understand why the BLAS output is not in line with np.dot. I've narrowed it down to the…
ddm-j
  • 403
  • 1
  • 3
  • 18
0
votes
1 answer

Python 3: test for contiguous numbers in one line

I've got an algorithm that works fine, but I was hoping to implement it another way for personal satisfaction. In brief: I have some array obj_level that is a boolean mask indicating a coordinate where an object is present, so something like …
EJSABOLK
  • 57
  • 6
0
votes
0 answers

How do I create a spatial contiguity dummy for my regression in R?

Currently, I am trying to set up a dummy for regions that are contigious (1 if adjacent, 0 if not) in my regression. Sadly, I have just find answers for a spatial weight matrices, but that is not what I am looking for, because I am looking for a new…
0
votes
1 answer

How can I find the area of a geojson polygon that has two parts, such as a county with an island off the coast?

I am trying to find the area of census tracts and counties and there are a handful that are not contiguous. I am using the python area library. Here is my code that works for all contiguous shapes. obj = {'type':'Polygon','coordinates':…
Matchinski
  • 65
  • 1
  • 1
  • 5
0
votes
3 answers

Finding a non-decreasing contiguous subarray

Consider an array A[1..n] of random length and random positive integer values. We define a subarray of A as a contiguous segment of A. We denote the subarray from position k to position l (both included) as A[k..l]. The subarray A[k..l] is an ascent…
0
votes
1 answer

identify longest range of non-blank contiguous cells in a row

I have an Excel spreadsheet of velocity values (see link below) with some blanks interspersed. I am trying to loop through each row and return the range of the longest set of contiguous non-blank cells in each row. I will ultimately use the range…
mariec123
  • 13
  • 4
0
votes
0 answers

Comparing 2 Linear/Contiguous 2D Arrays

Hey i've been bothering with contiguous and linear allocated memory spaces out of good habit purposes. I've been wondering if there is in somehow a capability to simply compare 2 Contiguously allocated 2D Array's. Both are allocated like these, both…
VADE
  • 5
  • 3
0
votes
1 answer

In R, subset data using longest contiguous stretch of non-NA values

I am prepping data for linear regression and want to address missing values (NA) by using the longest contiguous stretch of non-NA values in a given year and site. I have tried na.contiguous() but my code is not applying the function by year or…
DAY
  • 91
  • 6
0
votes
2 answers

Identify consecutive repetition in two-dimensional array [C]

I have a 2-dimensional array that looks like this: 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 1 1 I'm trying to figure out a way to identify the longest contiguous chain of 1's going either across or down. In this case, it starts at column 4,…
0
votes
2 answers

Why I couldn't insert elements into the list with contiguous implementation in C?

I did implement a list in C as follows. The problem is when I try to insert elements using InsertList() function it returns "Try to insert to a position not in list" message. But instead I wanted the list to insert the elements in the said…
user11195802
0
votes
1 answer

Scattering blocks of a contiguous 2D Array using MPI

I am currently learning to use MPI and trying to scatter blocks of my array to the rest of my processors. My root processor is the last one (nproc-1) and I am generating the array in that processor. In my next iteration of my code it will be a…
0
votes
1 answer

Maximum sum of sub-array using Kadane's Algorithm in Java

This is a problem statement from geeks for geeks (link : https://practice.geeksforgeeks.org/problems/kadanes-algorithm/0 ) My code is working fine as per the Compile & test option. But when I try to submit, it throws error about failure for multiple…
Ajay
  • 11
  • 3
0
votes
1 answer

Treating noncontiguous cells as a single range used as argument of a UDF

I'm trying to construct a yield curve by interpolation using two data sets: a range of calendar days until maturity and another range of interest rates. I have a UDF on VBA which interpolates the interest rates. It uses as arguments two ranges of…
SuavestArt
  • 193
  • 1
  • 6
0
votes
2 answers

Are variables that are passed to a function stored in contiguous memory positions?

I have written this little function: int mayor(int n1, int n2, int n3, int n4, int n5) {    int mayor = n1;    for(int *p=&n2; p<=&n5; ++p)            mayor = *p;    return mayor; } Is it guaranteed that the memory block that contains n1 to n5…