Questions tagged [reduction]
481 questions
71
votes
9 answers
General rules for simplifying SQL statements
I'm looking for some "inference rules" (similar to set operation rules or logic rules) which I can use to reduce a SQL query in complexity or size.
Does there exist something like that? Any papers, any tools? Any equivalencies that you found on…

MicSim
- 26,265
- 16
- 90
- 133
46
votes
1 answer
Class Scheduling to Boolean satisfiability [Polynomial-time reduction]
I have some theoretical/practical problem and I don't have clue for now on how to manage, Here it is:
I create a SAT solver able to find a model when one is existing and to prove the contradiction when it's not the case on CNF problems in C using…

Valentin Montmirail
- 2,594
- 1
- 25
- 53
41
votes
5 answers
Reducing on array in OpenMP
I am trying to parallelize the following program, but don't know how to reduce on an array. I know it is not possible to do so, but is there an alternative? Thanks. (I added reduction on m which is wrong but would like to have an advice on how to do…

user2891902
- 447
- 1
- 5
- 9
22
votes
5 answers
Is it possible to do a reduction on an array with openmp?
Does OpenMP natively support reduction of a variable that represents an array?
This would work something like the following...
float* a = (float*) calloc(4*sizeof(float));
omp_set_num_threads(13);
#pragma omp parallel…

Andrew Wagner
- 22,677
- 21
- 86
- 100
21
votes
6 answers
Lambda calculus predecessor function reduction steps
I am getting stuck with the Wikipedia description of the predecessor function in lambda calculus.
What Wikipedia says is the following:
PRED := λn.λf.λx. n (λg.λh. h (g f)) (λu.x) (λu.u)
Can someone explain reduction processes step-by-step?
Thanks.

user1004246
- 211
- 1
- 2
- 3
17
votes
3 answers
Block reduction in CUDA
I am trying to do reduction in CUDA and I am really a newbie. I am currently studying a sample code from NVIDIA.
I guess I am really not sure how to set up the block size and grid size, especially when my input array is larger (512 X 512) than a…

Ono
- 1,357
- 3
- 16
- 38
16
votes
3 answers
Lambda Calculus reduction
All,
Below is the lambda expression which I am finding difficult to reduce i.e. I am not able to understand how to go about this problem.
(λm λn λa λb . m (n a b) b) (λ f x. x) (λ f x. f x)
This is what I tried, but I am stuck:
Considering the…

name_masked
- 9,544
- 41
- 118
- 172
15
votes
4 answers
View Reduction Steps in Haskell
Is there any way to view the reduction steps in haskell, i.e trace the recursive function calls made? For example, chez scheme provides us with trace-lambda. Is there an equivalent form in Haskell?

Shiv
- 8,362
- 5
- 29
- 32
14
votes
2 answers
Call by value in the lambda calculus
I'm working my way through Types and Programming Languages, and Pierce, for the call by value reduction strategy, gives the example of the term id (id (λz. id z)). The inner redex id (λz. id z) is reduced to λz. id z first, giving id (λz. id z) as…

topynate
- 377
- 4
- 10
14
votes
5 answers
How to create a coupon on specific product in Magento?
Let's say I have 10% off coupon code.
This coupon is applicable only to Product B
A customer have in its cart :
Product P1
Product B
Product P2
I don't want my 10% off coupon apply to other product but only to Product B.
Do you know how I can do…

ÉricP
- 843
- 4
- 12
- 17
14
votes
2 answers
Why is a built-in function applied to too few arguments considered to be in weak head normal form?
The Haskell definition says:
An expression is in weak head normal form (WHNF), if it is either:
a constructor (eventually applied to arguments) like True, Just (square 42) or (:) 1
a built-in function applied to too few arguments (perhaps none)…

Robert Zaremba
- 8,081
- 7
- 47
- 78
13
votes
1 answer
Raku (née Perl 6) reduce function and reduction metaoperator give different results
my @s=<1 2 3 2 3 4>;
say reduce {$^a < $^b}, @s;
say [<] @s;
# --------
# True
# False
My question is two fold:
Firstly, why does the reduction metaoperator processes the < operator differently? It looks like the reduction metaop is estimatedly…

Terry
- 1,206
- 1
- 10
- 26
10
votes
3 answers
OpenMP: nowait and reduction clauses on the same pragma
I am studying OpenMP, and came across the following example:
#pragma omp parallel shared(n,a,b,c,d,sum) private(i)
{
#pragma omp for nowait
for (i=0; i

aperez
- 451
- 2
- 8
- 20
10
votes
2 answers
CUDA - why is warp based parallel reduction slower?
I had the idea about a warp based parallel reduction since all threads of a warp are in sync by definition.
So the idea was that the input data can be reduced by factor 64 (each thread reduces two elements) without any synchronization need.
Same…

djmj
- 5,579
- 5
- 54
- 92
9
votes
2 answers
CUDA: how to sum all elements of an array into one number within the GPU?
First of all, let me state that I am fully aware that my question has been already asked: Block reduction in CUDA However, as I hope to make clear, my question is a follow-up to that and I have particular needs that make the solution found by that…

user123443563
- 171
- 1
- 2
- 8