star-wf

First-passage time of brownian motion
git clone git://git.meso-star.fr/star-wf.git
Log | Files | Refs | README | LICENSE

swf_tabulation.h (1508B)


      1 /* Copyright (C) 2024 |Méso|Star> (contact@meso-star.com)
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #ifndef SWF_TABULATION_H
     17 #define SWF_TABULATION_H
     18 
     19 #include <rsys/dynamic_array.h>
     20 #include <rsys/ref_count.h>
     21 
     22 struct item {
     23   double x; /* Function argument */
     24   double fx; /* Value of the function */
     25   double dfx; /* Value of the derivative of the function */
     26   double d2fx; /* Value of the second derivative of the function */
     27 };
     28 #define ITEM_NULL__ {0, 0, 0, 0}
     29 static const struct item ITEM_NULL = ITEM_NULL__;
     30 
     31 /* Declare the dynamic array of items */
     32 #define DARRAY_NAME item
     33 #define DARRAY_DATA struct item
     34 #include <rsys/dynamic_array.h>
     35 
     36 struct swf_tabulation {
     37   struct darray_item items;
     38   struct mem_allocator* allocator;
     39   ref_T ref;
     40 };
     41 
     42 extern LOCAL_SYM res_T
     43 tabulation_create
     44   (struct mem_allocator* allocator,
     45    struct swf_tabulation** out_tab);
     46 
     47 #endif /* SWF_TABULATION_H */