Skip to main content
Filter by
Sorted by
Tagged with
-4 votes
1 answer
75 views

Rewriting nested loop with reduce [closed]

I wrote the below code to solve a prep test, found online. The goal is to find the min absolute difference between numbers in an array. function minimumAbsoluteDifference(arr: number[]): number { /...
Igor Shmukler's user avatar
1 vote
0 answers
32 views

NVIDIA webinar on parallel reduction gridsize

In the last example of Mark Harris' webinar I don't understand the indexing before the parallel reduction part. In "Reduction #6" the gridSize/number of dispatches was ceil[N (the size of ...
Michael Bay's user avatar
0 votes
0 answers
13 views

Flatten Date Sequence with an attached Value in Google Sheets (Without the use of Macros)

This is a similar question that was posted before but with a little expansion to the problem. The original post was this link: Create flatten dates sequence in Google Sheets in one column (without ...
Raven A's user avatar
3 votes
1 answer
76 views

OpenMP reduce on large heap array cause segment fault

When I try to reduce a large heap array with OpenMP reduction, it segment fault: #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { ...
LXYan's user avatar
  • 61
0 votes
1 answer
89 views

Inject behavior when last element is used before referencing accumulator

I am a a bit confused by some of the behavior of the of the inject (alias reduce) command in Ruby Background For any array, the second element (referenced after the accumulator) reflects the last ...
Ricman R's user avatar
-1 votes
2 answers
74 views

2d array - group by first item and calculate average of corresponding number

I have a 2d array which contains a list of series with title, rating, and time spent watching. For example: let seriesList = [["Squid Game", 3.5, "4 days"], ["Squid Game",...
amy's user avatar
  • 83
1 vote
2 answers
76 views

Label the row according to the source

I want to importrange from Spreadsheet OLD with several tabs/sheets into Spreadsheet NEW. What i want to do is to import values from SheetA and Sheet B. First column: vstack(importrange(SheetA!A5:A),...
cywh's user avatar
  • 9
4 votes
3 answers
99 views

Why has my array element been changed by this declaration?

Javascript code: const bigArray2 = [ [1, 2, 3], [2, 4, 6], [3, 6, 9], ]; //creates single-layer array containing all elements of every array within bigArray2 const combinedArray = ...
Jake's user avatar
  • 49
2 votes
2 answers
62 views

React transform data using reduce

I need to transform the following structure using React. export const bodyRows = [ { row: [{ cell: "Name" }, { cell: "Allan, Trent" }, { cell: "Smith, Nathan" }, { ...
RyRyWilli's user avatar
0 votes
1 answer
29 views

App producing 2 messages for only 1 input

I'm trying to debug a problem in our production Kafka Streams app. The (simplified) topology looks something like this builder.stream("input").groupByKey().reduce( (agg, val) -> "...
Egor's user avatar
  • 1,660
3 votes
1 answer
165 views

CUB reduce_by_key

Thrust has the thrust::reduce_by_key algorithm which works well for a problem of mine. I wanted to try to use CUB for finer control of memory and streams as well as interaction with my own kernels, ...
Treeman's user avatar
  • 116
2 votes
3 answers
130 views

Correct way to return first element of a JS array that meets condition and mapped

Let's say we have a function that makes expensive calculation and an array of source values for which we do the calculation. We want to get a first return value of the function that is not falsy and ...
quadracik's user avatar
-2 votes
1 answer
139 views

FlatMap vs Reduce for extracting data from a nested object

I have a dataset as such, where there may be multiple testResults array elements, along with there being 1 or many response array elements; and I an wanting to extract all of the potential ...
physicsboy's user avatar
  • 6,398
0 votes
1 answer
92 views

JQ Cannot iterate over null

I am trying to create a jq that is dynamic in returning data. User Story: I have data with many fields and not named like I want. I want to be able to based on the data and schema transform the data. ...
tmcc's user avatar
  • 1,020
0 votes
0 answers
69 views

Is there a way in Google Earth Engine to compute zonal stats for pixels falling to a certain extent (e.g at least 70%) into the desired area?

I have a shapefile containing fifteen circular polygons of 80 m radius. The polygons are spread all cross Europe, from Italy to France, Germany, Belgium, and Sweden. My task is to compute the average, ...
Aleseb's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
241