#include <math.h>#include <string.h>#include "interpolation.h"#include "stack-c.h"Include dependency graph for interpolation.c:

Go to the source code of this file.
Functions | |
| integer C2F() | getfastcode (unsigned char *c, unsigned long c_len) |
| int | good_order (double x[], int n) |
| int | get_rhs_real_hmat (int num, RealHyperMat *H) |
| int | get_rhs_scalar_string (int num, int *length, int **tabchar) |
| int | equal_scistring_and_string (int length, int *scistr, char *str) |
| int | get_type (TableType *Tab, int dim_table, int *scistr, int strlength) |
Definition at line 127 of file interpolation.c.
References C2F, getfastcode(), i, int, L, and res.
Referenced by get_type().
00128 { 00129 /* compare a scistring with a classic C string */ 00130 int i, res; 00131 00132 if ( strlen(str) != length ) 00133 return 0; 00134 00135 res = 1; i = 0; 00136 while (res && i < length) 00137 { 00138 res = (scistr[i] == (int)C2F(getfastcode)(str+i,1L)); 00139 i++; 00140 } 00141 return (res); 00142 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int get_rhs_real_hmat | ( | int | num, | |
| RealHyperMat * | H | |||
| ) |
Definition at line 47 of file interpolation.c.
References C2F, err, H, iadr, il1, istk, Lstk, lw, Max, Nbvars, Rhs, sadr, stk, and Top.
00048 { 00049 int il, il1, il2, il3,/* it, */lw; 00050 00051 lw = num + Top - Rhs; 00052 il = iadr(*Lstk( lw )); 00053 if ( *istk(il) < 0 ) 00054 il = iadr(*istk(il+1)); 00055 00056 if ( *istk(il) != 17 ) 00057 goto err; 00058 else if ( *istk(il+1) != 3 ) /* a hm mlist must have 3 fields */ 00059 goto err; 00060 00061 /* get the pointers for the 3 fields */ 00062 il1 = sadr(il+6); 00063 il2 = il1 + *istk(il+3) - 1; 00064 il3 = il1 + *istk(il+4) - 1; 00065 il1 = iadr(il1); il2 = iadr(il2); il3 = iadr(il3); 00066 00067 /* test if the first field is a matrix string with 3 components 00068 * and that the first is "hm" (ie 17 22 in scilab char code) 00069 */ 00070 if ( (*istk(il1) != 10) | ((*istk(il1+1))*(*istk(il1+2)) != 3) ) 00071 goto err; 00072 else if ( *istk(il1+5)-1 != 2 ) /* 1 str must have 2 chars */ 00073 goto err; 00074 else if ( *istk(il1+8) != 17 || *istk(il1+9) != 22 ) 00075 goto err; 00076 00077 /* get the 2d field */ 00078 if ( (*istk(il2) != 8) | (*istk(il2+3) != 4) ) 00079 goto err; 00080 H->dimsize = (*istk(il2+1))*(*istk(il2+2)); 00081 H->dims = istk(il2+4); 00082 00083 /* get the 3d field */ 00084 if ( !( *istk(il3) == 1 && *istk(il3+3)==0) ) 00085 goto err;; 00086 00087 H->size = (*istk(il3+1))*(*istk(il3+2)); 00088 H->R = stk(sadr(il3+4)); 00089 00090 /* needed for Jpc stuff (putlhsvar) */ 00091 Nbvars = Max(Nbvars,num); 00092 C2F(intersci).ntypes[num-1] = '$'; 00093 C2F(intersci).iwhere[num-1] = *Lstk(lw); 00094 C2F(intersci).lad[num-1] = 0; /* a voir ? */ 00095 return 1; 00096 00097 err: 00098 Scierror(999,"Argument %d is not a real hypermatrix\r\n", num); 00099 return 0; 00100 }
Definition at line 102 of file interpolation.c.
References C2F, iadr, istk, Lstk, lw, Max, Nbvars, Rhs, and Top.
00103 { 00104 int il, lw; 00105 00106 lw = num + Top - Rhs; 00107 il = iadr(*Lstk( lw )); 00108 if ( *istk(il) < 0 ) 00109 il = iadr(*istk(il+1)); 00110 00111 if ( ! ( *istk(il) == 10 && (*istk(il+1))*(*istk(il+2)) == 1 ) ) 00112 { 00113 /* we look for a scalar string */ 00114 Scierror(999,"Argument %d is not a scalar string\r\n", num); 00115 return 0; 00116 } 00117 *length = *istk(il+5)-1; 00118 *tabchar = istk(il+6); 00119 00120 Nbvars = Max(Nbvars,num); 00121 C2F(intersci).ntypes[num-1] = '$'; 00122 C2F(intersci).iwhere[num-1] = *Lstk(lw); 00123 C2F(intersci).lad[num-1] = 0; 00124 return 1; 00125 }
Definition at line 144 of file interpolation.c.
References equal_scistring_and_string(), i, Tab, type, and UNDEFINED.
00145 { 00146 int i = 0, found = 0; 00147 while ( !found && i < dim_table ) 00148 { 00149 found = equal_scistring_and_string(strlength, scistr, Tab[i].str_type); 00150 i++; 00151 } 00152 if ( found ) 00153 return ( Tab[i-1].type ); 00154 else 00155 return ( UNDEFINED ); 00156 }
Here is the call graph for this function:

Definition at line 18 of file interpolation.c.
00019 { 00020 /* test if x[i-1] < x[i] */ 00021 static int first = 1; 00022 int i; 00023 static double inf; 00024 00025 if ( first ) { inf = 1.0 / (double) (first - first) ; first = 0; } 00026 00027 if (fabs(x[0]) == inf || x[n-1] == inf) 00028 return ( 0 ); 00029 00030 for ( i = 1 ; i < n ; i++ ) 00031 if ( ! (x[i-1] < x[i]) ) /* form of this test for detecting nan ... */ 00032 return ( 0 ); 00033 00034 return ( 1 ); 00035 }
1.5.1