| 1 | /* integration/workspace.c |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/ |
| 21 | #include <stdlib.h> |
| 22 | #include "gsl_integration.h"cxx . . $ `<file>/external/gsl/gsl_integration.h`/ |
| 23 | #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/ |
| 24 | |
| 25 | gsl_integration_workspacecxx . . $ gsl_integration_workspace# * |
| 26 | gsl_integration_workspace_alloccxx . . $ gsl_integration_workspace_alloc(6d79e7d0c5e2f0fb). (const size_t n) |
| 27 | { |
| 28 | gsl_integration_workspacecxx . . $ gsl_integration_workspace# * w ; |
| 29 | |
| 30 | if (n == 0) |
| 31 | { |
| 32 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("workspace length n must be positive integer", |
| 33 | GSL_EDOM, 0); |
| 34 | } |
| 35 | |
| 36 | w = (gsl_integration_workspacecxx . . $ gsl_integration_workspace# *) |
| 37 | malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (sizeof (gsl_integration_workspacecxx . . $ gsl_integration_workspace#)); |
| 38 | |
| 39 | if (w == 0) |
| 40 | { |
| 41 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for workspace struct", |
| 42 | GSL_ENOMEM, 0); |
| 43 | } |
| 44 | |
| 45 | w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist. = (double *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (n * sizeof (double)); |
| 46 | |
| 47 | if (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist. == 0) |
| 48 | { |
| 49 | freecxx . . $ free(5d22bdacc48458e8). (w); /* exception in constructor, avoid memory leak */ |
| 50 | |
| 51 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for alist ranges", |
| 52 | GSL_ENOMEM, 0); |
| 53 | } |
| 54 | |
| 55 | w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist. = (double *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (n * sizeof (double)); |
| 56 | |
| 57 | if (w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist. == 0) |
| 58 | { |
| 59 | freecxx . . $ free(5d22bdacc48458e8). (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist.); |
| 60 | freecxx . . $ free(5d22bdacc48458e8). (w); /* exception in constructor, avoid memory leak */ |
| 61 | |
| 62 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for blist ranges", |
| 63 | GSL_ENOMEM, 0); |
| 64 | } |
| 65 | |
| 66 | w->rlistcxx . . $ $anonymous_type_447f2d6dcbace69_0#rlist. = (double *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (n * sizeof (double)); |
| 67 | |
| 68 | if (w->rlistcxx . . $ $anonymous_type_447f2d6dcbace69_0#rlist. == 0) |
| 69 | { |
| 70 | freecxx . . $ free(5d22bdacc48458e8). (w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist.); |
| 71 | freecxx . . $ free(5d22bdacc48458e8). (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist.); |
| 72 | freecxx . . $ free(5d22bdacc48458e8). (w); /* exception in constructor, avoid memory leak */ |
| 73 | |
| 74 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for rlist ranges", |
| 75 | GSL_ENOMEM, 0); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | w->elistcxx . . $ $anonymous_type_447f2d6dcbace69_0#elist. = (double *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (n * sizeof (double)); |
| 80 | |
| 81 | if (w->elistcxx . . $ $anonymous_type_447f2d6dcbace69_0#elist. == 0) |
| 82 | { |
| 83 | freecxx . . $ free(5d22bdacc48458e8). (w->rlistcxx . . $ $anonymous_type_447f2d6dcbace69_0#rlist.); |
| 84 | freecxx . . $ free(5d22bdacc48458e8). (w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist.); |
| 85 | freecxx . . $ free(5d22bdacc48458e8). (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist.); |
| 86 | freecxx . . $ free(5d22bdacc48458e8). (w); /* exception in constructor, avoid memory leak */ |
| 87 | |
| 88 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for elist ranges", |
| 89 | GSL_ENOMEM, 0); |
| 90 | } |
| 91 | |
| 92 | w->ordercxx . . $ $anonymous_type_447f2d6dcbace69_0#order. = (size_t *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (n * sizeof (size_t)); |
| 93 | |
| 94 | if (w->ordercxx . . $ $anonymous_type_447f2d6dcbace69_0#order. == 0) |
| 95 | { |
| 96 | freecxx . . $ free(5d22bdacc48458e8). (w->elistcxx . . $ $anonymous_type_447f2d6dcbace69_0#elist.); |
| 97 | freecxx . . $ free(5d22bdacc48458e8). (w->rlistcxx . . $ $anonymous_type_447f2d6dcbace69_0#rlist.); |
| 98 | freecxx . . $ free(5d22bdacc48458e8). (w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist.); |
| 99 | freecxx . . $ free(5d22bdacc48458e8). (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist.); |
| 100 | freecxx . . $ free(5d22bdacc48458e8). (w); /* exception in constructor, avoid memory leak */ |
| 101 | |
| 102 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for order ranges", |
| 103 | GSL_ENOMEM, 0); |
| 104 | } |
| 105 | |
| 106 | w->levelcxx . . $ $anonymous_type_447f2d6dcbace69_0#level. = (size_t *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (n * sizeof (size_t)); |
| 107 | |
| 108 | if (w->levelcxx . . $ $anonymous_type_447f2d6dcbace69_0#level. == 0) |
| 109 | { |
| 110 | freecxx . . $ free(5d22bdacc48458e8). (w->ordercxx . . $ $anonymous_type_447f2d6dcbace69_0#order.); |
| 111 | freecxx . . $ free(5d22bdacc48458e8). (w->elistcxx . . $ $anonymous_type_447f2d6dcbace69_0#elist.); |
| 112 | freecxx . . $ free(5d22bdacc48458e8). (w->rlistcxx . . $ $anonymous_type_447f2d6dcbace69_0#rlist.); |
| 113 | freecxx . . $ free(5d22bdacc48458e8). (w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist.); |
| 114 | freecxx . . $ free(5d22bdacc48458e8). (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist.); |
| 115 | freecxx . . $ free(5d22bdacc48458e8). (w); /* exception in constructor, avoid memory leak */ |
| 116 | |
| 117 | GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for order ranges", |
| 118 | GSL_ENOMEM, 0); |
| 119 | } |
| 120 | |
| 121 | w->sizecxx . . $ $anonymous_type_447f2d6dcbace69_0#size. = 0 ; |
| 122 | w->limitcxx . . $ $anonymous_type_447f2d6dcbace69_0#limit. = n ; |
| 123 | w->maximum_levelcxx . . $ $anonymous_type_447f2d6dcbace69_0#maximum_level. = 0 ; |
| 124 | |
| 125 | return w ; |
| 126 | } |
| 127 | |
| 128 | void |
| 129 | gsl_integration_workspace_freecxx . . $ gsl_integration_workspace_free(5766a645b266e4d2). (gsl_integration_workspacecxx . . $ gsl_integration_workspace# * w) |
| 130 | { |
| 131 | freecxx . . $ free(5d22bdacc48458e8). (w->levelcxx . . $ $anonymous_type_447f2d6dcbace69_0#level.) ; |
| 132 | freecxx . . $ free(5d22bdacc48458e8). (w->ordercxx . . $ $anonymous_type_447f2d6dcbace69_0#order.) ; |
| 133 | freecxx . . $ free(5d22bdacc48458e8). (w->elistcxx . . $ $anonymous_type_447f2d6dcbace69_0#elist.) ; |
| 134 | freecxx . . $ free(5d22bdacc48458e8). (w->rlistcxx . . $ $anonymous_type_447f2d6dcbace69_0#rlist.) ; |
| 135 | freecxx . . $ free(5d22bdacc48458e8). (w->blistcxx . . $ $anonymous_type_447f2d6dcbace69_0#blist.) ; |
| 136 | freecxx . . $ free(5d22bdacc48458e8). (w->alistcxx . . $ $anonymous_type_447f2d6dcbace69_0#alist.) ; |
| 137 | freecxx . . $ free(5d22bdacc48458e8). (w) ; |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | size_t |
| 142 | gsl_integration_workspace_limit (gsl_integration_workspace * w) |
| 143 | { |
| 144 | return w->limit ; |
| 145 | } |
| 146 | |
| 147 | |
| 148 | size_t |
| 149 | gsl_integration_workspace_size (gsl_integration_workspace * w) |
| 150 | { |
| 151 | return w->size ; |
| 152 | } |
| 153 | */ |