6#ifndef THEORETICA_PARALLEL_H
7#define THEORETICA_PARALLEL_H
10#include "../core/dataset.h"
11#include "../core/real_analysis.h"
12#include "../complex/complex_analysis.h"
13#include "../autodiff/dual_functions.h"
14#include "../autodiff/dual2_functions.h"
15#include "../autodiff/multidual_functions.h"
34 template<
typename Function,
typename Vector>
40 #pragma omp parallel for
41 for (
unsigned int i = 0; i < v.size(); i++)
52 template<
typename Vector>
53 inline Vector
square(
const Vector& v) {
58 #pragma omp parallel for
59 for (
unsigned int i = 0; i < v.size(); i++)
70 template<
typename Vector>
71 inline Vector
cube(
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
abs(
const Vector& v) {
94 #pragma omp parallel for
95 for (
unsigned int i = 0; i < v.size(); i++)
107 template<
typename Vector>
108 inline Vector
pow(
const Vector& v,
int n) {
111 res.resize(v.size());
113 #pragma omp parallel for
114 for (
unsigned int i = 0; i < v.size(); i++)
126 template<
typename Vector>
130 res.resize(v.size());
132 #pragma omp parallel for
133 for (
unsigned int i = 0; i < v.size(); i++)
144 template<
typename Vector>
145 inline Vector
sqrt(
const Vector& v) {
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
cbrt(
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
exp(
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
ln(
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
log2(
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
log10(
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
sin(
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
cos(
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
tan(
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
cot(
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
asin(
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
acos(
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
atan(
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
sinh(
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
cosh(
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
tanh(
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
coth(
const Vector& v) {
436 res.resize(v.size());
438 #pragma omp parallel for
439 for (
unsigned int i = 0; i < v.size(); i++)
Vector exp(const Vector &v)
Parallel element-wise evaluation of the exp function.
Definition parallel.h:181
Vector cbrt(const Vector &v)
Parallel element-wise evaluation of the cbrt function.
Definition parallel.h:163
Vector tan(const Vector &v)
Vectorized (element-wise evaluation) of the tan function.
Definition parallel.h:289
Vector cos(const Vector &v)
Parallel element-wise evaluation of the cos function.
Definition parallel.h:271
Vector cot(const Vector &v)
Vectorized (element-wise evaluation) of the cot function.
Definition parallel.h:307
Vector atan(const Vector &v)
Vectorized (element-wise evaluation) of the atan function.
Definition parallel.h:361
Vector log10(const Vector &v)
Parallel element-wise evaluation of the log10 function.
Definition parallel.h:235
Vector square(const Vector &v)
Parallel element-wise evaluation of the square function.
Definition parallel.h:53
Vector tanh(const Vector &v)
Vectorized (element-wise evaluation) of the tanh function.
Definition parallel.h:415
Vector cube(const Vector &v)
Parallel element-wise evaluation of the cube function.
Definition parallel.h:71
Vector sinh(const Vector &v)
Vectorized (element-wise evaluation) of the sinh function.
Definition parallel.h:379
Vector apply_function(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 coth(const Vector &v)
Vectorized (element-wise evaluation) of the coth function.
Definition parallel.h:433
Vector ln(const Vector &v)
Parallel element-wise evaluation of the ln function.
Definition parallel.h:199
Vector abs(const Vector &v)
Parallel element-wise evaluation of the abs function.
Definition parallel.h:89
Vector sqrt(const Vector &v)
Parallel element-wise evaluation of the sqrt function.
Definition parallel.h:145
Vector pow(const Vector &v, int n)
Parallel element-wise evaluation of the pow function.
Definition parallel.h:108
Vector sin(const Vector &v)
Parallel element-wise evaluation of the sin function.
Definition parallel.h:253
Vector powf(const Vector &v, real x)
Parallel element-wise evaluation of the powf function.
Definition parallel.h:127
Vector log2(const Vector &v)
Parallel element-wise evaluation of the log2 function.
Definition parallel.h:217
Vector cosh(const Vector &v)
Vectorized (element-wise evaluation) of the cosh function.
Definition parallel.h:397
Vector asin(const Vector &v)
Vectorized (element-wise evaluation) of the asin function.
Definition parallel.h:325
Vector acos(const Vector &v)
Vectorized (element-wise evaluation) of the acos function.
Definition parallel.h:343
Main namespace of the library which contains all functions and objects.
Definition algebra.h:27
double real
A real number, defined as a floating point type.
Definition constants.h:198
dual2 sqrt(dual2 x)
Compute the square root of a second order dual number.
Definition dual2_functions.h:54
dual cosh(dual x)
Compute the hyperbolic cosine of a dual number.
Definition dual_functions.h:205
dual2 ln(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:151
dual sinh(dual x)
Compute the hyperbolic sine of a dual number.
Definition dual_functions.h:194
dual2 abs(dual2 x)
Compute the absolute value of a second order dual number.
Definition dual2_functions.h:198
dual2 log2(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:166
dual2 asin(dual2 x)
Compute the arcsine of a second order dual number.
Definition dual2_functions.h:204
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:182
real cbrt(real x)
Compute the cubic root of x.
Definition real_analysis.h:199
real coth(real x)
Compute the hyperbolic cotangent.
Definition real_analysis.h:1181
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 acos(dual2 x)
Compute the arcosine of a second order dual number.
Definition dual2_functions.h:223
complex< T > powf(complex< T > z, real p)
Compute a complex number raised to a real power.
Definition complex_analysis.h:67
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:242
dual tanh(dual x)
Compute the hyperbolic tangent of a dual number.
Definition dual_functions.h:216
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.