summaryrefslogtreecommitdiff
path: root/wolfram_link/convexminorant.tm
blob: 48f56504425dcd17968e589b81bd04d8a6a18c37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include <convex.h>
#include <wstp.h>

extern int WSMain(int, char **);

void convexminorant(double *, int);

:Begin:
:Function:      convexminorant
:Pattern:       GetConvexMinorant[ list:{___Real} ]
:Arguments:     { list }
:ArgumentTypes: { Real64List }
:ReturnType:    Manual
:End:

:Evaluate:      GetConvexMinorant[ sequence___Float]:= GetConvexMinorant[ {sequence} ]

void convexminorant(double * Gammas, int len) {
  int i;
  for (i = 0; i < len; i++) {
    if (Gammas[i] <= 0) {
       break;
    }
  }
  double *m = get_convex_minorant(i, Gammas);
  WSPutReal64List(stdlink, m, i);
}

int main(int argc, char **argv) {
  return WSMain(argc, argv);
}