gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
testMat.C
Go to the documentation of this file.
1 #include <fstream>
2 #include <iostream>
3 using namespace std;
4 
5 #include "f2c.h"
6 
7 extern "C" int pchim_(integer *n, real *x, real *f, real *d__, integer *incfd, integer *ierr);
8 extern "C" int pchfe_(integer *n, real *x, real *f, real *d__, integer *incfd, logical *skip, integer *ne, real *xe, real *fe, integer *ierr);
9 
10 int main(int argc, char *argv[]){
11 
12 ifstream input("cdata.txt");
13 float temp;
14 
15 cout<<"reading input data"<<endl;
16 
17 input>>temp;
18 int N=(int)temp; // the number of reference data points
19 float x[N], y[N], x1[1024];
20 cout<<"x="<<endl;
21 for (int i=0;i<N;i++){
22 input>>x[i];
23 cout<<x[i]<<'\t';
24 }
25 cout<<endl;
26 cout<<"y="<<endl;
27 for (int i=0;i<N;i++){
28 input>>y[i];
29 cout<<y[i]<<'\t';
30 }
31 cout<<endl;
32 int N1=0;
33 cout<<"x1="<<endl;
34 while (input>>x1[N1]){
35 cout<<x1[N1]<<'\t';
36  N1++;
37 }
38 cout<<endl;
39 input.close();
40 
41  cout<<"N="<<N<<endl;
42  cout<<"N1="<<N1<<endl;
43 
44 // find the point derivatives
45 float d1[1024]; // the derivatives
46 int err, step=1;
47 int test=pchim_(&N, x, y, d1, &step, &err);
48 cout<<"returns "<<test<<endl;
49 
50 // call the Hermit interpolation ....
51 logical skip=1;
52 float y1[1024]; // the interpolates
53 test=pchfe_(&N, x, y, d1, &step, &skip, &N1, x1, y1, &err);
54 cout<<"returns "<<test<<endl;
55 
56 ofstream output("cdataOut.txt");
57 for (int i=0;i<N1;i++)
58  output<<y1[i]<<'\t';
59 output.close();
60 return 0;
61 }
int pchfe_(integer *n, real *x, real *f, real *d__, integer *incfd, logical *skip, integer *ne, real *xe, real *fe, integer *ierr)
Definition: pchfe.c:25
float * x
int N
STL namespace.
float * y
int pchim_(integer *n, real *x, real *f, real *d__, integer *incfd, integer *ierr)
Definition: pchim.c:37
int main(int argc, char *argv[])
Definition: testMat.C:10
gtkIOStream: /tmp/gtkiostream/futureInclusions/cubicInterp/testMat.C Source File
GTK+ IOStream  Beta