FAQ Database Discussion Community


Prove NP-completeness of CLIQUE-OR-INDEPENDENT-SET

reduction,np-complete,np,clique-problem,independent-set
First of all, I want to mention that this is my homework. However, to solve my problem I can use any literature I want. Even though I think that problem is clear from its name, I will give it description: "For given undirected graph G and given integer k, does...

Reduction(op:var) has the same effect as shared(var)

c++,openmp,shared-memory,shared,reduction
I've tried this code snippet for reduction(op:var) proof of concept, it worked fine and gave a result = 656700 int i, n, chunk; float a[100], b[100], result; /* Some initializations */ n = 100; chunk = 10; result = 0.0; for (i=0; i < n; i++) { a[i] = i...

Nested loop summation in 2D using OpenCL

c++,opencl,reduction
I have recently started working with OpenCL in C++ and I'm trying to fully understand how to use 2D and 3D NDRange. I'm currently implementing Inverse Distance Weighting in OpenCL, but my problem is general. Below is the serial function to compute the weights and it consists of a nested...

How does Haskell evaluate the Fibonacci function?

haskell,recursion,fibonacci,reduction
I am currently looking at this function in Haskell which returns the Fibonacci number at position n fib :: Integer -> Integer fib 0 = 0 fib 1 = 1 fib n = fib (n-1) + fib (n-2) Now, it compiles, returns the correct result and everything... but I don't...

Class Scheduling to Boolean satisfiability [Polynomial-time reduction]

c,algorithm,scheduling,reduction,sat
I have some theorical/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 genetics...

Max reduce in CUDA Fortran

cuda,fortran,reduction
I am trying to perform reduction in CUDA Fortran; what I did so far is something like that, performing the reduction in two steps (see the CUDA kernels below). In the first kernel I am doing some simple computation and I declare a shared array for a block of threads...

Periodic to incremental (data reduction)

matlab,data,increment,reduction,periodic-processing
it's some time i was thinking about solving this problem. I have a registration of angular data (Angle(~20000,1)) variating between 0 and 355 (a potentiometer attached to a rotary testing machine), and I wanted to convert it in an incremental form, since I want the final total angular displacement. The...

array_walk only partially removes matches

php,lambda,reduction,array-walk
Ran into a weird situation were using array_walk() will only partially remove matches from my method, not certain exactly what is going on. I am currently using PHP v5.6.4. The issue almost seems to be that it is only removing every secondary match. The kerning function private function strip(array $exceptions)...

Reduction or atomic operator on unknown global array indices

c,cuda,atomic,reduction
I have the following algorithm: __global__ void Update(int N, double* x, double* y, int* z, double* out) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < N) { x[i] += y[i]; if (y[i] >= 0.) out[z[i]] += x[i]; else out[z[i]] -= x[i]; } } Important to note...

OpenMP Dot Product and Pointers

c,pointers,for-loop,openmp,reduction
I'm trying to implement dotproduct in OpenMP with large arrays allocated with malloc. However, when I use reduction(+:result) it produces different results for each program run. Why do I get different results? How can I remedy that? And how can this example be optimized? Here's my code: #include <stdlib.h> #include...