[Scilab-Dev] Problem using double API
Vincent Lejeune
vincent.lejeune at institutoptique.fr
Thu Nov 5 20:36:05 CET 2009
It doesn't work either...
Just in case, the builder_gateway_c.sce script is the following (taken from
the skeleton toolbox) :
if MSDOS then
// to manage long pathname
includes_src_c = '-I""' + get_absolute_file_path('builder_gateway_c.sce')
+ '../../include/""';
else
includes_src_c = '-I' + get_absolute_file_path('builder_gateway_c.sce') +
'../../include/';
end
// PutLhsVar managed by user in sci_sum and in sci_sub
// if you do not this variable, PutLhsVar is added
// in gateway generated (default mode in scilab 4.x and 5.x)
WITHOUT_AUTO_PUTLHSVAR = %t;
tbx_build_gateway('ocl',..
['ocltest','oclexec';..
'gInit','gInit'],..
['sci_simd.c'], ..
get_absolute_file_path('builder_gateway_c.sce'), ..
['../../simd'],'',includes_src_c);
clear WITHOUT_AUTO_PUTLHSVAR;
clear tbx_build_gateway;
--------------------------------------------------
From: "Serge Steer" <Serge.Steer at scilab.org>
Sent: Thursday, November 05, 2009 4:38 PM
To: <dev at lists.scilab.org>
Subject: Re: [Scilab-Dev] Problem using double API
> In my opinion the code should be (createMatrixOfDouble allocates the
> array and returns a pointer)
>
> #include "stack-c.h"
> #include "api_scilab.h"
> #include "Scierror.h"
>
> int oclexec(char* fname)
> {
> SciErr sciErr;
> int *pB;
> int rowsB,colsB;
> double* mB;
> int k;
>
> sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, rowsB, colsB,mB );
> if(sciErr.iErr)
> {
> printError(&sciErr, 0);
> return 0;
> }
>
> for(k=0;k<rowsB*colsB;++k)
> {
> mB[k]=1.0;
> }
> LhsVar(1)=Rhs+1;
>
> return 0;
> }
>
>
>
> Vincent Lejeune a écrit :
>>
>> Hi,
>>
>> I don't know if it's a bug or if something is missing in my code...
>> The issue is : using the following code, I cannot get scilab to
>> display the
>> mB matrix :
>>
>> #include "stack-c.h"
>> #include "api_scilab.h"
>> #include "Scierror.h"
>>
>> int oclexec(char* fname)
>> {
>> SciErr sciErr;
>> int *pB;
>> int rowsB,colsB;
>> double* mB;
>> int k;
>>
>> mB=(double*)malloc(rowsB*colsB*sizeof(double));
>>
>>
>> for(k=0;k<rowsB*colsB;++k)
>> {
>> mB[k]=1.0;
>> }
>>
>> sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, rowsB, colsB,mB );
>> if(sciErr.iErr)
>> {
>> printError(&sciErr, 0);
>> return 0;
>> }
>>
>> LhsVar(1)=Rhs+1;
>>
>> return 0;
>> }
>>
>> The gateway is compiling fine, but when I type B=ocltest(A); , the B
>> matrix
>> is equal to A, whereas it is expected to be a ones matrix.
>>
>> On the other hand, the unary test double_writing_api.tst works.
>> I'am currently using the windows 1257195239 build (taken from the nightly
>> build of scilab 5.2)
>>
>> Regards,
>> Vincent
>>
>
>
More information about the dev
mailing list