6#ifndef THEORETICA_PARALLEL_H
7#define THEORETICA_PARALLEL_H
34 template<
typename Function,
typename Vector>
35 inline Vector
map(Function f,
const Vector& v) {
40 #pragma omp parallel for
41 for (
unsigned int i = 0; i < v.size(); i++)
55 template<
typename Function,
typename Vector>
58 #pragma omp parallel for
59 for (
unsigned int i = 0; i < v.size(); i++)
70 template<
typename Vector>
71 inline Vector
square(
const Vector& v) {
76 #pragma omp parallel for
77 for (
unsigned int i = 0; i < v.size(); i++)
88 template<
typename Vector>
89 inline Vector
cube(
const Vector& v) {
94 #pragma omp parallel for
95 for (
unsigned int i = 0; i < v.size(); i++)
106 template<
typename Vector>
107 inline Vector
abs(
const Vector& v) {
110 res.resize(v.size());
112 #pragma omp parallel for
113 for (
unsigned int i = 0; i < v.size(); i++)
125 template<
typename Vector>
126 inline Vector
pow(
const Vector& v,
int n) {
129 res.resize(v.size());
131 #pragma omp parallel for
132 for (
unsigned int i = 0; i < v.size(); i++)
144 template<
typename Vector>
148 res.resize(v.size());
150 #pragma omp parallel for
151 for (
unsigned int i = 0; i < v.size(); i++)
162 template<
typename Vector>
163 inline Vector
sqrt(
const Vector& v) {
166 res.resize(v.size());
168 #pragma omp parallel for
169 for (
unsigned int i = 0; i < v.size(); i++)
180 template<
typename Vector>
181 inline Vector
cbrt(
const Vector& v) {
184 res.resize(v.size());
186 #pragma omp parallel for
187 for (
unsigned int i = 0; i < v.size(); i++)
198 template<
typename Vector>
199 inline Vector
exp(
const Vector& v) {
202 res.resize(v.size());
204 #pragma omp parallel for
205 for (
unsigned int i = 0; i < v.size(); i++)
216 template<
typename Vector>
217 inline Vector
ln(
const Vector& v) {
220 res.resize(v.size());
222 #pragma omp parallel for
223 for (
unsigned int i = 0; i < v.size(); i++)
234 template<
typename Vector>
235 inline Vector
log2(
const Vector& v) {
238 res.resize(v.size());
240 #pragma omp parallel for
241 for (
unsigned int i = 0; i < v.size(); i++)
252 template<
typename Vector>
253 inline Vector
log10(
const Vector& v) {
256 res.resize(v.size());
258 #pragma omp parallel for
259 for (
unsigned int i = 0; i < v.size(); i++)
270 template<
typename Vector>
271 inline Vector
sin(
const Vector& v) {
274 res.resize(v.size());
276 #pragma omp parallel for
277 for (
unsigned int i = 0; i < v.size(); i++)
288 template<
typename Vector>
289 inline Vector
cos(
const Vector& v) {
292 res.resize(v.size());
294 #pragma omp parallel for
295 for (
unsigned int i = 0; i < v.size(); i++)
306 template<
typename Vector>
307 inline Vector
tan(
const Vector& v) {
310 res.resize(v.size());
312 #pragma omp parallel for
313 for (
unsigned int i = 0; i < v.size(); i++)
324 template<
typename Vector>
325 inline Vector
cot(
const Vector& v) {
328 res.resize(v.size());
330 #pragma omp parallel for
331 for (
unsigned int i = 0; i < v.size(); i++)
342 template<
typename Vector>
343 inline Vector
asin(
const Vector& v) {
346 res.resize(v.size());
348 #pragma omp parallel for
349 for (
unsigned int i = 0; i < v.size(); i++)
360 template<
typename Vector>
361 inline Vector
acos(
const Vector& v) {
364 res.resize(v.size());
366 #pragma omp parallel for
367 for (
unsigned int i = 0; i < v.size(); i++)
378 template<
typename Vector>
379 inline Vector
atan(
const Vector& v) {
382 res.resize(v.size());
384 #pragma omp parallel for
385 for (
unsigned int i = 0; i < v.size(); i++)
396 template<
typename Vector>
397 inline Vector
sinh(
const Vector& v) {
400 res.resize(v.size());
402 #pragma omp parallel for
403 for (
unsigned int i = 0; i < v.size(); i++)
414 template<
typename Vector>
415 inline Vector
cosh(
const Vector& v) {
418 res.resize(v.size());
420 #pragma omp parallel for
421 for (
unsigned int i = 0; i < v.size(); i++)
432 template<
typename Vector>
433 inline Vector
tanh(
const Vector& v) {
436 res.resize(v.size());
438 #pragma omp parallel for
439 for (
unsigned int i = 0; i < v.size(); i++)
450 template<
typename Vector>
451 inline Vector
coth(
const Vector& v) {
454 res.resize(v.size());
456 #pragma omp parallel for
457 for (
unsigned int i = 0; i < v.size(); i++)
Functions of complex variable.
Operations on datasets and generic ordered sets of numbers.
Functions defined on second order dual numbers for automatic differentiation.
Functions defined on dual numbers for automatic differentiation.
Functions defined on multidual numbers for automatic differentiation of multivariable real functions.
Parallelized element-wise evaluation of functions.
Vector exp(const Vector &v)
Parallel element-wise evaluation of the exp function.
Definition parallel.h:199
Vector cbrt(const Vector &v)
Parallel element-wise evaluation of the cbrt function.
Definition parallel.h:181
Vector tan(const Vector &v)
Vectorized (element-wise evaluation) of the tan function.
Definition parallel.h:307
Vector cos(const Vector &v)
Parallel element-wise evaluation of the cos function.
Definition parallel.h:289
Vector cot(const Vector &v)
Vectorized (element-wise evaluation) of the cot function.
Definition parallel.h:325
Vector & transform(Function f, Vector &v)
Transform a vector by applying a given function to each of its elements, modifying the vector itself ...
Definition parallel.h:56
Vector atan(const Vector &v)
Vectorized (element-wise evaluation) of the atan function.
Definition parallel.h:379
Vector map(Function f, const Vector &v)
Parallel element-wise evaluation of a function, using OpenMP to speed up execution over a vector.
Definition parallel.h:35
Vector log10(const Vector &v)
Parallel element-wise evaluation of the log10 function.
Definition parallel.h:253
Vector square(const Vector &v)
Parallel element-wise evaluation of the square function.
Definition parallel.h:71
Vector tanh(const Vector &v)
Vectorized (element-wise evaluation) of the tanh function.
Definition parallel.h:433
Vector cube(const Vector &v)
Parallel element-wise evaluation of the cube function.
Definition parallel.h:89
Vector sinh(const Vector &v)
Vectorized (element-wise evaluation) of the sinh function.
Definition parallel.h:397
Vector coth(const Vector &v)
Vectorized (element-wise evaluation) of the coth function.
Definition parallel.h:451
Vector ln(const Vector &v)
Parallel element-wise evaluation of the ln function.
Definition parallel.h:217
Vector abs(const Vector &v)
Parallel element-wise evaluation of the abs function.
Definition parallel.h:107
Vector sqrt(const Vector &v)
Parallel element-wise evaluation of the sqrt function.
Definition parallel.h:163
Vector pow(const Vector &v, int n)
Parallel element-wise evaluation of the pow function.
Definition parallel.h:126
Vector sin(const Vector &v)
Parallel element-wise evaluation of the sin function.
Definition parallel.h:271
Vector powf(const Vector &v, real x)
Parallel element-wise evaluation of the powf function.
Definition parallel.h:145
Vector log2(const Vector &v)
Parallel element-wise evaluation of the log2 function.
Definition parallel.h:235
Vector cosh(const Vector &v)
Vectorized (element-wise evaluation) of the cosh function.
Definition parallel.h:415
Vector asin(const Vector &v)
Vectorized (element-wise evaluation) of the asin function.
Definition parallel.h:343
Vector acos(const Vector &v)
Vectorized (element-wise evaluation) of the acos function.
Definition parallel.h:361
Main namespace of the library which contains all functions and objects.
Definition algebra.h:27
dual2 sqrt(dual2 x)
Compute the square root of a second order dual number.
Definition dual2_functions.h:54
dual2 ln(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:195
dual2 abs(dual2 x)
Compute the absolute value of a second order dual number.
Definition dual2_functions.h:242
dual2 log2(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:210
dual2 asin(dual2 x)
Compute the arcsine of a second order dual number.
Definition dual2_functions.h:248
double real
A real number, defined as a floating point type.
Definition constants.h:207
dual2 exp(dual2 x)
Compute the exponential of a second order dual number.
Definition dual2_functions.h:138
dual2 log10(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:226
real cbrt(real x)
Compute the cubic root of x.
Definition real_analysis.h:199
dual2 tanh(dual2 x)
Compute the hyperbolic tangent of a second order dual number.
Definition dual2_functions.h:179
dual2 sinh(dual2 x)
Compute the hyperbolic sine of a second order dual number.
Definition dual2_functions.h:151
real coth(real x)
Compute the hyperbolic cotangent.
Definition real_analysis.h:1192
dual2 cos(dual2 x)
Compute the cosine of a second order dual number.
Definition dual2_functions.h:86
dual2 cot(dual2 x)
Compute the cotangent of a second order dual number.
Definition dual2_functions.h:119
dual2 tan(dual2 x)
Compute the tangent of a second order dual number.
Definition dual2_functions.h:100
dual2 cosh(dual2 x)
Compute the hyperbolic cosine of a second order dual number.
Definition dual2_functions.h:165
dual2 acos(dual2 x)
Compute the arcosine of a second order dual number.
Definition dual2_functions.h:267
complex< T > powf(complex< T > z, real p)
Compute a complex number raised to a real power.
Definition complex_analysis.h:65
dual2 sin(dual2 x)
Compute the sine of a second order dual number.
Definition dual2_functions.h:72
dual2 square(dual2 x)
Return the square of a second order dual number.
Definition dual2_functions.h:23
dual2 atan(dual2 x)
Compute the arctangent of a second order dual number.
Definition dual2_functions.h:286
dual2 pow(dual2 x, int n)
Compute the n-th power of a second order dual number.
Definition dual2_functions.h:41
dual2 cube(dual2 x)
Return the cube of a second order dual number.
Definition dual2_functions.h:29
Vector class and operations.