00001 /* Copyright Inria/Enpc */ 00002 00003 /************************************ 00004 * simple example 2 (using sin and cos) 00005 * -->link('ext2c.o','ext2c','C'); 00006 * -->a=[1,2,3];b=[4,5,6];n=3; 00007 * -->c=call('ext2c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d') 00008 * -->c=sin(a)+cos(b) 00009 ************************************/ 00010 00011 #include <math.h> 00012 00013 int ext2c(int *n, double *a, double *b, double *c) 00014 { 00015 static int k; 00016 for (k = 0; k < *n; ++k) { 00017 c[k] = sin(a[k]) + cos(b[k]); 00018 } 00019 return(0); 00020 }
1.5.1