 
// Example ex14
 
//[1] call intersci with Makefile
 
//
 
V=G_make('ex14fi.c','ex14fi.c');
 
//[2] run the builder generated by intersci.
 
//    Since files and libs were nor transmited
 
//    to intersci we give them here
 
files = ['ex14fi.o';'ex14c.o'];
 
libs  = [] ;
 
exec ex14fi_builder.sce
 
// generated with intersci
 
ilib_name = 'libex14fi'		// interface library name
 ilib_name  =
 
 libex14fi   
 
 
table =["spt1","intsspt1";
	"spt3","intsspt3";
	"spt4","intsspt4";
	"spt6","intsspt6";
	"spt7","intsspt7";
	"spt9","intsspt9";
	"spt10","intsspt10"];
 
ilib_build(ilib_name,table,files,libs);
   generate a gateway file
   generate a loader file
   generate a Makefile: Makelib
   running the makefile
   compilation of ex14fi
   compilation of ex14c
   building shared library (be patient)
 
 
 
//[3] run the loader to load the interface
 
//    Note that the file loader.sce
 
//    is changed each time you run a demo
 
//    if several0.desc are present in a directory
 
exec loader.sce;
shared archive loaded
 
 
//[4] test the loaded function
 
 
a=[0,0,1.23;0,2.32,0;3.45,0,0];
 
ai=[0,0,9;0,6,0;7,0,0];
 
spa=sparse(a);
 
spai=sparse(a+%i*ai);
 
// simple sparse argument
 
 
b=spt1(spa);
Row 1, 1 non nul elements
(1,3) -> 1.230000 
Row 2, 1 non nul elements
(2,2) -> 2.320000 
Row 3, 1 non nul elements
(3,1) -> 3.450000 
 
if norm(full(b- spa)) > %eps then bugmes();quit;end
 
 
b=spt1(spai);
Row 1, 1 non nul elements
(1,3) -> 1.230000 +i9.000000
Row 2, 1 non nul elements
(2,2) -> 2.320000 +i6.000000
Row 3, 1 non nul elements
(3,1) -> 3.450000 +i7.000000
 
if norm(full(b- spai)) > %eps then bugmes();quit;end
 
 
// sparse and return a sparse in a list
 
 
b=spt3(spa);
Row 1, 1 non nul elements
(1,3) -> 1.230000 
Row 2, 1 non nul elements
(2,2) -> 2.320000 
Row 3, 1 non nul elements
(3,1) -> 3.450000 
 
if norm(full(b(1)- spa)) > %eps then bugmes();quit;end
 
 
b=spt3(spai);
Row 1, 1 non nul elements
(1,3) -> 1.230000 +i9.000000
Row 2, 1 non nul elements
(2,2) -> 2.320000 +i6.000000
Row 3, 1 non nul elements
(3,1) -> 3.450000 +i7.000000
 
if norm(full(b(1)- spai)) > %eps then bugmes();quit;end
 
 
// new sparse in intersci
 
 
b=spt4(spa);
 
if norm(full(b- 2*spa)) > %eps then bugmes();quit;end
 
 
b=spt4(spai);
 
if norm(full(b- 2*spai)) > %eps then bugmes();quit;end
 
 
 
// new sparse returned in a list
 
 
b=spt6(spa);
 
if norm(full(b(1)- 2*spa)) > %eps then bugmes();quit;end
 
 
b=spt6(spai);
 
if norm(full(b(1)- 2*spai)) > %eps then bugmes();quit;end
 
 
// list argument with a sparse
 
 
b=spt7(list(spa));
Row 1, 1 non nul elements
(1,3) -> 1.230000 
Row 2, 1 non nul elements
(2,2) -> 2.320000 
Row 3, 1 non nul elements
(3,1) -> 3.450000 
 
if norm(full(b- spa)) > %eps then bugmes();quit;end
 
 
b=spt7(list(spai));
Row 1, 1 non nul elements
(1,3) -> 1.230000 +i9.000000
Row 2, 1 non nul elements
(2,2) -> 2.320000 +i6.000000
Row 3, 1 non nul elements
(3,1) -> 3.450000 +i7.000000
 
if norm(full(b- spai)) > %eps then bugmes();quit;end
 
 
// list argument + list output
 
 
b=spt9(list(spa));
Row 1, 1 non nul elements
(1,3) -> 1.230000 
Row 2, 1 non nul elements
(2,2) -> 2.320000 
Row 3, 1 non nul elements
(3,1) -> 3.450000 
 
if norm(full(b(1)- spa)) > %eps then bugmes();quit;end
 
 
b=spt9(list(spai));
Row 1, 1 non nul elements
(1,3) -> 1.230000 +i9.000000
Row 2, 1 non nul elements
(2,2) -> 2.320000 +i6.000000
Row 3, 1 non nul elements
(3,1) -> 3.450000 +i7.000000
 
if norm(full(b(1)- spai)) > %eps then bugmes();quit;end
 
 
b=spt10(spa);
 
if norm(full(b- 2*spa)) > %eps then bugmes();quit;end
 
 
