Questions tagged [reduction]
481 questions
0
votes
2 answers
Efficient reduction of an R vector to a summary vector
I'm trying to do simulation of a sequence, which is of length N (varies between 10k and 3M) represented by a vector which has n 1's and s 0's where N = n+s.
I'd like to reduce this to a vector on the form c( 137, 278, 21271, 124162, ... ) where the…

Norling
- 1,153
- 2
- 10
- 24
0
votes
1 answer
PCA for Face Recognition
Let x1 be a vector(gray) of image1, x2 be a vector(gray) of image2, etc xn be a vector(gray) of imagen. Say, all the image size is represented by r rows and c columns (r*c)
so, X = [x1, x2, x3, .... xn].
As many literature suggest that, to reduce…
user1245222
0
votes
2 answers
Parallel reduction example
I found this parallel reduction code from Stanford which uses shared memory.
The code is an example of 1<<18 number of elements which is equal to 262144 and produces correct results.
Why do I get the correct results for certain numbers of elements…

user1280671
- 69
- 2
- 15
0
votes
1 answer
OpenMP to CUDA: Reduction
I'm trying to figure out how I can use OpenMP's for reduction() equivalent in CUDA. I've done some research online, and none of what I've tried worked. The code:
#pragma omp parallel for reduction(+:sum)
for (i = 0; i < N; i++)
{
…

pauliwago
- 6,373
- 11
- 42
- 52
0
votes
1 answer
L = {T | T is a turing machine that recognizes {00, 01}} Prove L is undecidable
L = { | T is a turing machine that recognizes {00, 01}}
Prove L is undecidable.
I am really having difficulties even understanding the reduction to use here.
I'm not asking for free lunch, just a push in the right direction.

user1405177
- 477
- 1
- 4
- 15
0
votes
1 answer
Lambda calculus in practice
How to choose a language, a lambda term (λx.y)((λx.xxx)(λx.xxx)) actually calculated? In other words, need a language to the normal order reduction and the weak type system.

ramntry
- 83
- 4
0
votes
1 answer
Unrecognized pragma: Reduction clause | openMP
For the code below I get an error: unrecognized #pragma: #pragma omp reduction (+: sum). Note that the for-loop inside the function is not a parallel-for-loop because the function itself is parallelized already. Could you say where is the…

Shibli
- 5,879
- 13
- 62
- 126
0
votes
1 answer
CUDA reduction using thrust inside kernel
I want to do parallel reduction, but inside my kernel with data in shared memory. Is this possible with thrust library ?
Something like
int sum = thrust::reduce(myIntArray, myIntArray+numberOfItems, (int) 0, thrust::max_element());
But this…

Hlavson
- 309
- 1
- 7
- 14
-1
votes
1 answer
Openmp reproducible reduction
I have the following example code:
!$omp threadpriavate(var)
!$omp parallel do reduction(+:var)
do
var = var + compilated_floating_point_computation()
end do
!$omp end parallel do
print *,var
And I get slightly different results for var per…

nadavhalahmi
- 101
- 6
-1
votes
1 answer
Is there a simple way to reduce this set of tuples in Python
In a set of tuples (pairs), like this one:
s = {(1, 2), (3, 4), (1, 3), ('v', 'n'), ('v', 'k')}
I would like to remove all pairs (a, b) and (a, c), so that the resulting set is:
{(3, 4)}
Is there a simple way to accomplish that?

Paul Jurczak
- 7,008
- 3
- 47
- 72
-1
votes
1 answer
Grid size in phase #4 of Harris' reduction optimization
I am learning about unrolling loops to optimize kernel computation.
This is a code snippet from the book Professional CUDA C Programming:
if (idx + 4 * blockDim.x <= n)
{
int a1 = g_idata[idx];
int a2 = g_idata[idx + blockDim.x];
int a3…

kingwales
- 129
- 8
-1
votes
1 answer
How to understand the stride size for parallel reduction when doing multiple add?
I am learning Mark Harris's implementation of Optimizing Parallel Reduction.
I am confused by these several lines on page 32:
unsigned int tid = threadIdx.x;
unsigned int i = blockIdx.x*(blockSize*2) + threadIdx.x;
unsigned int gridSize =…

kingwales
- 129
- 8
-1
votes
1 answer
CUDA reduce non-contiguous sub-arrays
I am writing a function for a library which accepts a large array (in GPU memory) of a power-of-2 number of elements. This function must sum non-contiguous sub-arrays (of equal length, also a power-of-2), to produce a smaller (or rarely, equally…

Anti Earth
- 4,671
- 13
- 52
- 83
-1
votes
1 answer
Is ((f f) (g g)) reduced differently in AOR and NOR?
How is ((f f) (g g)) reduced in both applicative order reduction and normal order reduction? do both reduce the statement in the same way?

Ahmed
- 120
- 6
-1
votes
1 answer
Classifying NP Completeness and Hardness
Choose the correct statement(s):
(A) If X is an NP-complete problem, then X is an NP problem
(B) If X is an NP-complete problem, then X is an NP-hard
(C) Let X be an NP-complete problem. If X can polynomial reduce to a problem Y, then Y is an…

ILiketoaskQuestion
- 11
- 3