Description Usage Arguments Details
There are 3 examples, each using OpenMP, across 4 implementations: C, C++, F77, and F2003.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | c_hello()
c_sum(x)
c_sweep(x, vec)
c_primesbelow(n)
f77_hello()
f77_sum(x)
f77_sweep(x, vec)
f77_primesbelow(n)
f90_hello()
f90_sum(x)
f90_sweep(x, vec)
f90_primesbelow(n)
rcpp_hello()
rcpp_sum(x)
rcpp_sweep(x, vec)
rcpp_primesbelow(n)
|
x |
A numeric vector for the sum example, and a numeric matrix for the sweep example. |
vec |
A numeric vector the same length as the number of rows as x. |
n |
The number from the "primes below" example, where the function
returns the total number of primes below |
The _hello()
functions are simple hello worlds. Note that
the order of printing by the threads is not guaranteed.
The _sum()
functions sum up a numeric vector.
The _sweep()
functions sweep a numeric vector from a
numeric matrix, provided the vector is exactly the length of
the number of columns of the matrix. This is equivalent to a
special case of sweep(x, STATS=vec, MARGIN=1, FUN="-")
.
The _primesbelow()
functions compute the number of prime
integers below a given (positive) integer.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.