00001 /* Copyright Inria/Enpc */ 00002 #include "stack-c.h" 00003 00004 /****************************************** 00005 * Example 5 00006 * reading a vector in scilab internal stack using ReadMatrix 00007 * (see SCIDIR/system2/readmat.f) 00008 * -->link('ext5c.o','ext5c','C') 00009 * -->Amatrix=[1,2,3];b=[2,3,4]; 00010 * -->c=call('ext5c',b,1,'d','out',[1,3],2,'d') 00011 * -->c=Amatrix+2*b 00012 ******************************************/ 00013 00014 int ext5c(double *b, double *c) 00015 { 00016 static double a[3]; 00017 static int k, m, n; 00018 ReadMatrix("Amatrix",&m, &n, a); 00019 /*******************************/ 00020 /* [m,n]=size(Amatrix) here m=1 n=3, a=Amatrix which must exist in Scilab*/ 00021 for (k = 0; k < n; ++k) 00022 c[k] = a[k] + b[k] * 2.; 00023 return(0); 00024 }
1.5.1