libsc 2.8.5.210-64a7
The SC library provides support for parallel scientific applications.
sc_functions.h
1/*
2 This file is part of the SC Library.
3 The SC Library provides support for parallel scientific applications.
4
5 Copyright (C) 2010 The University of Texas System
6 Additional copyright (C) 2011 individual authors
7
8 The SC Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 The SC Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with the SC Library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA.
22*/
23
24#ifndef SC_FUNCTIONS_H
25#define SC_FUNCTIONS_H
26
27#include <sc.h>
28
29SC_EXTERN_C_BEGIN;
30
41int sc_intpow (int base, int exp);
42
43/* Power routine for 64-bit integers.
44 * \see sc_intpow.
45 * \param [in] base This integer is taken to the power of \exp.
46 * It may be negative as well.
47 * \param [in] exp This non-negative integer is the exponent.
48 * \return We compute \b base ** \b exp.
49 */
50int64_t sc_intpow64 (int64_t base, int exp);
51
52/* Power routine for unsigned 64-bit integers.
53 * \see sc_intpow.
54 * \param [in] base This integer is taken to the power of \exp.
55 * \param [in] exp This non-negative integer is the exponent.
56 * \return We compute \b base ** \b exp.
57 */
58uint64_t sc_intpow64u (uint64_t base, int exp);
59
60/* Power routine for floating point numbers.
61 * \see sc_intpow.
62 * \param [in] base This number is taken to the power of \exp.
63 * \param [in] exp This non-negative integer is the exponent.
64 * \return We compute \b base ** \b exp.
65 */
66double sc_intpowf (double base, int exp);
67
68typedef double (*sc_function1_t) (double x, void *data);
69
70typedef double (*sc_function3_t) (double x, double y, double z,
71 void *data);
72
73/*
74 * this structure is used as data element for the meta functions.
75 * for _sum and _product:
76 * f1 needs to be a valid function.
77 * f2 can be a function, then it is used,
78 * or NULL, in which case parameter2 is used.
79 * for _tensor: f1, f2, f3 need to be valid functions.
80 */
81typedef struct sc_function3_meta
82{
83 sc_function3_t f1;
84 sc_function3_t f2;
85 double parameter2;
86 sc_function3_t f3;
87 void *data;
88}
90
91/* Evaluate the inverse function with regula falsi: x = func^{-1}(y) */
92double sc_function1_invert (sc_function1_t func, void *data,
93 double x_low, double x_high,
94 double y, double rtol);
95
96/* Some basic 3D functions */
97double sc_zero3 (double x, double y, double z, void *data);
98double sc_one3 (double x, double y, double z, void *data);
99double sc_two3 (double x, double y, double z, void *data);
100double sc_ten3 (double x, double y, double z, void *data);
101
105double sc_constant3 (double x, double y, double z, void *data);
106
107double sc_x3 (double x, double y, double z, void *data);
108double sc_y3 (double x, double y, double z, void *data);
109double sc_z3 (double x, double y, double z, void *data);
110
111double sc_sum3 (double x, double y, double z, void *data);
112double sc_product3 (double x, double y, double z, void *data);
113double sc_tensor3 (double x, double y, double z, void *data);
114
115SC_EXTERN_C_END;
116
117#endif /* !SC_FUNCTIONS_H */
Support for process management (memory allocation, logging, etc.)
Definition: sc_functions.h:82