13
13
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="bsparse_writing_API" xml:lang="en">
15
<refname>Boolean sparse writing (Scilab gateway)</refname>
17
How to add boolean sparse matrix in a gateway.
21
<title>Calling Sequence</title>
22
<para>Input argument profile:</para>
23
<synopsis>SciErr createBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis>
24
<para>Named variable profile:</para>
25
<synopsis>SciErr createNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis>
28
<title>Arguments</title>
34
Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
42
Position in the Scilab memory where you want to put the variable.
50
Name of the variable for "named" functions.
58
Number of rows of the new variable.
66
Number of columns of the new variable.
74
Number of non zero itmes in the sparse.
79
<term>_piNbItemRow</term>
82
Number of item in each rows (size: _iRows).
87
<term>_piColPos</term>
90
Column position for each item (size: _iNbItem).
98
Error structure where is stored errors messages history and first error number.
106
Write directly in Scilab memory.
108
<title>Calling Sequence</title>
109
<para>Input argument profile:</para>
110
<synopsis>SciErr allocBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos)</synopsis>
113
<title>Arguments</title>
119
Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
127
Position in the Scilab memory where you want to put the variable.
135
Number of rows of the new variable.
143
Number of columns of the new variable.
148
<term>_iNbItem</term>
151
Number of non zero itmes in the sparse.
156
<term>_piNbItemRow</term>
159
Number of item in each rows (size: _iRows).
164
<term>_piColPos</term>
167
Column position for each item (size: _iNbItem).
175
Error structure where is stored errors messages history and first error number.
182
<title>Description</title>
183
<para>This help describes how to add boolean sparse matrix in a list.</para>
186
<!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c-->
187
<!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst-->
188
<!--Lib_name: read_write_bsparse-->
189
<!--Func_list: read_write_bsparse-->
190
<title>Gateway Source</title>
191
<programlisting role="code_gateway"><![CDATA[
15
<refname>Boolean sparse writing (Scilab gateway)</refname>
17
How to add boolean sparse matrix in a gateway.
21
<title>Calling Sequence</title>
22
<para>Input argument profile:</para>
23
<synopsis>SciErr createBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis>
24
<para>Named variable profile:</para>
25
<synopsis>SciErr createNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis>
28
<title>Arguments</title>
34
Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
42
Position in the Scilab memory where you want to put the variable.
50
Name of the variable for "named" functions.
58
Number of rows of the new variable.
66
Number of columns of the new variable.
74
Number of non zero itmes in the sparse.
79
<term>_piNbItemRow</term>
82
Number of item in each rows (size: _iRows).
87
<term>_piColPos</term>
90
Column position for each item (size: _iNbItem).
98
Error structure where is stored errors messages history and first error number.
106
Write directly in Scilab memory.
108
<title>Calling Sequence</title>
109
<para>Input argument profile:</para>
110
<synopsis>SciErr allocBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos)</synopsis>
113
<title>Arguments</title>
119
Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
127
Position in the Scilab memory where you want to put the variable.
135
Number of rows of the new variable.
143
Number of columns of the new variable.
148
<term>_iNbItem</term>
151
Number of non zero itmes in the sparse.
156
<term>_piNbItemRow</term>
159
Number of item in each rows (size: _iRows).
164
<term>_piColPos</term>
167
Column position for each item (size: _iNbItem).
175
Error structure where is stored errors messages history and first error number.
182
<title>Description</title>
183
<para>This help describes how to add boolean sparse matrix in a list.</para>
186
<!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c-->
187
<!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst-->
188
<!--Lib_name: read_write_bsparse-->
189
<!--Func_list: read_write_bsparse-->
190
<title>Gateway Source</title>
191
<programlisting role="code_gateway"><![CDATA[
192
192
#include "api_scilab.h"
193
193
int read_write_bsparse(char *fname,unsigned long fname_len)
259
259
iCol += piNbItemRow[i];
262
sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument + 1, iRows, iCols, iNewItem, piNewRow, piNewCol);
262
sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol);
265
265
printError(&sciErr, 0);
269
AssignOutputVariable(1) = nbInputArgument + 1;
269
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
272
272
]]></programlisting>
275
<title>Scilab test script</title>
276
<programlisting role="code_scilab"><![CDATA[
275
<title>Scilab test script</title>
276
<programlisting role="code_scilab"><![CDATA[
277
277
a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]);
278
278
a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]);
280
280
b = read_write_bsparse(a);
281
281
if or(b <> a_ref) then error("failed");end
282
282
]]></programlisting>