summaryrefslogtreecommitdiffstats
path: root/scilab/modules/sparse
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre.ledru@scilab.org>2010-02-12 11:10:06 +0100
committerSylvestre Ledru <sylvestre.ledru@scilab.org>2010-02-12 11:10:06 +0100
commit10963c0a56109ddafb6f2f4a8dbdc925b00ac69c (patch)
tree9f8eefbac0a88917328855a3cf4c046f4e7ca719 /scilab/modules/sparse
parentbc7b15143690a57f6ee6d6ec9401227e77b18db4 (diff)
parentc8b337d77b6d3f040afc6a76b9c607a838ae62dd (diff)
downloadscilab-10963c0a56109ddafb6f2f4a8dbdc925b00ac69c.zip
scilab-10963c0a56109ddafb6f2f4a8dbdc925b00ac69c.tar.gz
Merge remote branch 'origin/master' into textrendering
Conflicts: scilab/CHANGES_5.3.X scilab/configure scilab/configure.ac
Diffstat (limited to 'scilab/modules/sparse')
-rw-r--r--scilab/modules/sparse/Makefile.am6
-rw-r--r--scilab/modules/sparse/Makefile.in17
-rw-r--r--scilab/modules/sparse/includes/gw_sparse.h1
-rw-r--r--scilab/modules/sparse/macros/sp2adj.sci2
-rw-r--r--scilab/modules/sparse/sci_gateway/c/gw_sparse.c3
-rw-r--r--scilab/modules/sparse/sci_gateway/fortran/sci_ta2lpd.f88
-rw-r--r--scilab/modules/sparse/sci_gateway/sparse_gateway.xml1
-rw-r--r--scilab/modules/sparse/src/fortran/LibScilab_Import.def4
-rw-r--r--scilab/modules/sparse/src/fortran/sparse_f.vfproj2
-rw-r--r--scilab/modules/sparse/src/fortran/sparse_f2c.vcproj16
-rw-r--r--scilab/modules/sparse/src/fortran/ta2lpd.f63
-rw-r--r--scilab/modules/sparse/tests/nonreg_tests/bug_6412.dia.ref19
-rw-r--r--scilab/modules/sparse/tests/nonreg_tests/bug_6412.tst22
13 files changed, 236 insertions, 8 deletions
diff --git a/scilab/modules/sparse/Makefile.am b/scilab/modules/sparse/Makefile.am
index 3e2016f..e73d788 100644
--- a/scilab/modules/sparse/Makefile.am
+++ b/scilab/modules/sparse/Makefile.am
@@ -103,7 +103,8 @@ src/fortran/dspmat.f \
103src/fortran/wspmsp.f \ 103src/fortran/wspmsp.f \
104src/fortran/lspis.f \ 104src/fortran/lspis.f \
105src/fortran/dspmin.f \ 105src/fortran/dspmin.f \
106src/fortran/writebuf.f 106src/fortran/writebuf.f \
107src/fortran/ta2lpd.f
107 108
108GATEWAY_C_SOURCES = sci_gateway/c/sci_spcompa.c \ 109GATEWAY_C_SOURCES = sci_gateway/c/sci_spcompa.c \
109sci_gateway/c/sci_full.c \ 110sci_gateway/c/sci_full.c \
@@ -153,7 +154,8 @@ sci_gateway/fortran/sci_spchol.f \
153sci_gateway/fortran/sci_spmax.f \ 154sci_gateway/fortran/sci_spmax.f \
154sci_gateway/fortran/sci_lusolve.f \ 155sci_gateway/fortran/sci_lusolve.f \
155sci_gateway/fortran/sci_fadj2sp.f \ 156sci_gateway/fortran/sci_fadj2sp.f \
156sci_gateway/fortran/sci_sfinit.f 157sci_gateway/fortran/sci_sfinit.f \
158sci_gateway/fortran/sci_ta2lpd.f
157 159
158libscisparse_la_CFLAGS= -I$(srcdir)/includes/ \ 160libscisparse_la_CFLAGS= -I$(srcdir)/includes/ \
159 -I$(top_srcdir)/modules/api_scilab/includes \ 161 -I$(top_srcdir)/modules/api_scilab/includes \
diff --git a/scilab/modules/sparse/Makefile.in b/scilab/modules/sparse/Makefile.in
index 90b4b89..a752751 100644
--- a/scilab/modules/sparse/Makefile.in
+++ b/scilab/modules/sparse/Makefile.in
@@ -134,7 +134,7 @@ am__objects_2 = spcompack.lo wsposp.lo dspmax.lo findl.lo spcho1.lo \
134 wspasp.lo wij2sp.lo wspcsp.lo lspops.lo spifp.lo isort1.lo \ 134 wspasp.lo wij2sp.lo wspcsp.lo lspops.lo spifp.lo isort1.lo \
135 dspis.lo wspxs.lo lspe2.lo wspisp.lo dsmsp.lo dspms.lo \ 135 dspis.lo wspxs.lo lspe2.lo wspisp.lo dsmsp.lo dspms.lo \
136 spord.lo dsosp.lo dspmat.lo wspmsp.lo lspis.lo dspmin.lo \ 136 spord.lo dsosp.lo dspmat.lo wspmsp.lo lspis.lo dspmin.lo \
137 writebuf.lo 137 writebuf.lo ta2lpd.lo
138am__objects_3 = libscisparse_la-sci_spcompa.lo \ 138am__objects_3 = libscisparse_la-sci_spcompa.lo \
139 libscisparse_la-sci_full.lo libscisparse_la-sci_blkslvi.lo \ 139 libscisparse_la-sci_full.lo libscisparse_la-sci_blkslvi.lo \
140 libscisparse_la-sci_inpnvi.lo libscisparse_la-sci_nnz.lo \ 140 libscisparse_la-sci_inpnvi.lo libscisparse_la-sci_nnz.lo \
@@ -154,7 +154,7 @@ am__objects_4 = sci_spcompa.lo sci_sparse.lo sci_full.lo \
154 sci_bfinit.lo spops.lo sci_spmatrix.lo sci_blkfc1i.lo \ 154 sci_bfinit.lo spops.lo sci_spmatrix.lo sci_blkfc1i.lo \
155 sci_lufact.lo sci_symfcti.lo sci_luget.lo sci_ordmmd.lo \ 155 sci_lufact.lo sci_symfcti.lo sci_luget.lo sci_ordmmd.lo \
156 sci_spget.lo sci_spclean.lo sci_spchol.lo sci_spmax.lo \ 156 sci_spget.lo sci_spclean.lo sci_spchol.lo sci_spmax.lo \
157 sci_lusolve.lo sci_fadj2sp.lo sci_sfinit.lo 157 sci_lusolve.lo sci_fadj2sp.lo sci_sfinit.lo sci_ta2lpd.lo
158am_libscisparse_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ 158am_libscisparse_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
159 $(am__objects_3) $(am__objects_4) 159 $(am__objects_3) $(am__objects_4)
160libscisparse_la_OBJECTS = $(am_libscisparse_la_OBJECTS) 160libscisparse_la_OBJECTS = $(am_libscisparse_la_OBJECTS)
@@ -281,6 +281,7 @@ LD = @LD@
281LDFLAGS = @LDFLAGS@ 281LDFLAGS = @LDFLAGS@
282LIBICONV = @LIBICONV@ 282LIBICONV = @LIBICONV@
283LIBINTL = @LIBINTL@ 283LIBINTL = @LIBINTL@
284LIBM = @LIBM@
284LIBOBJS = @LIBOBJS@ 285LIBOBJS = @LIBOBJS@
285LIBS = @LIBS@ 286LIBS = @LIBS@
286LIBTOOL = @LIBTOOL@ 287LIBTOOL = @LIBTOOL@
@@ -527,7 +528,8 @@ src/fortran/dspmat.f \
527src/fortran/wspmsp.f \ 528src/fortran/wspmsp.f \
528src/fortran/lspis.f \ 529src/fortran/lspis.f \
529src/fortran/dspmin.f \ 530src/fortran/dspmin.f \
530src/fortran/writebuf.f 531src/fortran/writebuf.f \
532src/fortran/ta2lpd.f
531 533
532GATEWAY_C_SOURCES = sci_gateway/c/sci_spcompa.c \ 534GATEWAY_C_SOURCES = sci_gateway/c/sci_spcompa.c \
533sci_gateway/c/sci_full.c \ 535sci_gateway/c/sci_full.c \
@@ -577,7 +579,8 @@ sci_gateway/fortran/sci_spchol.f \
577sci_gateway/fortran/sci_spmax.f \ 579sci_gateway/fortran/sci_spmax.f \
578sci_gateway/fortran/sci_lusolve.f \ 580sci_gateway/fortran/sci_lusolve.f \
579sci_gateway/fortran/sci_fadj2sp.f \ 581sci_gateway/fortran/sci_fadj2sp.f \
580sci_gateway/fortran/sci_sfinit.f 582sci_gateway/fortran/sci_sfinit.f \
583sci_gateway/fortran/sci_ta2lpd.f
581 584
582libscisparse_la_CFLAGS = -I$(srcdir)/includes/ \ 585libscisparse_la_CFLAGS = -I$(srcdir)/includes/ \
583 -I$(top_srcdir)/modules/api_scilab/includes \ 586 -I$(top_srcdir)/modules/api_scilab/includes \
@@ -1317,6 +1320,9 @@ dspmin.lo: src/fortran/dspmin.f
1317writebuf.lo: src/fortran/writebuf.f 1320writebuf.lo: src/fortran/writebuf.f
1318 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o writebuf.lo `test -f 'src/fortran/writebuf.f' || echo '$(srcdir)/'`src/fortran/writebuf.f 1321 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o writebuf.lo `test -f 'src/fortran/writebuf.f' || echo '$(srcdir)/'`src/fortran/writebuf.f
1319 1322
1323ta2lpd.lo: src/fortran/ta2lpd.f
1324 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o ta2lpd.lo `test -f 'src/fortran/ta2lpd.f' || echo '$(srcdir)/'`src/fortran/ta2lpd.f
1325
1320sci_spcompa.lo: sci_gateway/fortran/sci_spcompa.f 1326sci_spcompa.lo: sci_gateway/fortran/sci_spcompa.f
1321 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_spcompa.lo `test -f 'sci_gateway/fortran/sci_spcompa.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_spcompa.f 1327 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_spcompa.lo `test -f 'sci_gateway/fortran/sci_spcompa.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_spcompa.f
1322 1328
@@ -1383,6 +1389,9 @@ sci_fadj2sp.lo: sci_gateway/fortran/sci_fadj2sp.f
1383sci_sfinit.lo: sci_gateway/fortran/sci_sfinit.f 1389sci_sfinit.lo: sci_gateway/fortran/sci_sfinit.f
1384 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_sfinit.lo `test -f 'sci_gateway/fortran/sci_sfinit.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_sfinit.f 1390 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_sfinit.lo `test -f 'sci_gateway/fortran/sci_sfinit.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_sfinit.f
1385 1391
1392sci_ta2lpd.lo: sci_gateway/fortran/sci_ta2lpd.f
1393 $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_ta2lpd.lo `test -f 'sci_gateway/fortran/sci_ta2lpd.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_ta2lpd.f
1394
1386mostlyclean-libtool: 1395mostlyclean-libtool:
1387 -rm -f *.lo 1396 -rm -f *.lo
1388 1397
diff --git a/scilab/modules/sparse/includes/gw_sparse.h b/scilab/modules/sparse/includes/gw_sparse.h
index 6364186..9f97da2 100644
--- a/scilab/modules/sparse/includes/gw_sparse.h
+++ b/scilab/modules/sparse/includes/gw_sparse.h
@@ -43,6 +43,7 @@ int C2F(sci_bfinit) (char *fname,unsigned long fname_len);
43int C2F(sci_msparse) (char *fname,unsigned long fname_len); 43int C2F(sci_msparse) (char *fname,unsigned long fname_len);
44int C2F(sci_mspget) (char *fname,unsigned long fname_len); 44int C2F(sci_mspget) (char *fname,unsigned long fname_len);
45int C2F(sci_mfull) (char *fname,unsigned long fname_len); 45int C2F(sci_mfull) (char *fname,unsigned long fname_len);
46int C2F(scita2lpd) (char *fname,unsigned long fname_len);
46/*--------------------------------------------------------------------------*/ 47/*--------------------------------------------------------------------------*/
47#endif /* __GW_SPARSE__ */ 48#endif /* __GW_SPARSE__ */
48/*--------------------------------------------------------------------------*/ 49/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/sparse/macros/sp2adj.sci b/scilab/modules/sparse/macros/sp2adj.sci
index 13c5123..a1218d0 100644
--- a/scilab/modules/sparse/macros/sp2adj.sci
+++ b/scilab/modules/sparse/macros/sp2adj.sci
@@ -24,7 +24,7 @@ function [lp,ln,v]=sp2adj(A)
24 if ij == [] then, 24 if ij == [] then,
25 lp=ones(n(2)+1,1);ln=[];v=[]; 25 lp=ones(n(2)+1,1);ln=[];v=[];
26 else, 26 else,
27 [lp,la,ln]=m6ta2lpd(ij(:,1)',ij(:,2)',N+1,N) 27 [lp,la,ln]=ta2lpd(ij(:,1)',ij(:,2)',N+1,N)
28 lp=lp(:);ln=ln(:); 28 lp=lp(:);ln=ln(:);
29 end; 29 end;
30endfunction 30endfunction
diff --git a/scilab/modules/sparse/sci_gateway/c/gw_sparse.c b/scilab/modules/sparse/sci_gateway/c/gw_sparse.c
index 9c4f2d8..7fbb77a 100644
--- a/scilab/modules/sparse/sci_gateway/c/gw_sparse.c
+++ b/scilab/modules/sparse/sci_gateway/c/gw_sparse.c
@@ -40,7 +40,8 @@ static gw_generic_table Tab[]=
40 {C2F(sci_bfinit),"bfinit"}, 40 {C2F(sci_bfinit),"bfinit"},
41 {C2F(sci_msparse),"msparse"}, 41 {C2F(sci_msparse),"msparse"},
42 {C2F(sci_mspget),"mspget"}, 42 {C2F(sci_mspget),"mspget"},
43 {C2F(sci_mfull),"mfull"} 43 {C2F(sci_mfull),"mfull"},
44 {C2F(scita2lpd),"ta2lpd"}
44}; 45};
45/*--------------------------------------------------------------------------*/ 46/*--------------------------------------------------------------------------*/
46int gw_sparse(void) 47int gw_sparse(void)
diff --git a/scilab/modules/sparse/sci_gateway/fortran/sci_ta2lpd.f b/scilab/modules/sparse/sci_gateway/fortran/sci_ta2lpd.f
new file mode 100644
index 0000000..94ebb5e
--- /dev/null
+++ b/scilab/modules/sparse/sci_gateway/fortran/sci_ta2lpd.f
@@ -0,0 +1,88 @@
1c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2c Copyright (C) DIGITEO 2010 - Yann COLLETTE
3c
4c This file must be used under the terms of the CeCILL.
5c This source file is licensed as described in the file COPYING, which
6c you should have received as part of this distribution. The terms
7c are also available at
8c http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9
10 subroutine scita2lpd(fname)
11c
12 character*(*) fname
13 include 'stack.h'
14c
15 integer iadr, sadr
16 integer topk,rhsk,topl
17 logical checkrhs,checklhs,getvectrow,getscalar,checkval,cremat
18 iadr(l)=l+l-1
19 sadr(l)=(l/2)+1
20 rhs = max(0,rhs)
21c
22 topk = top
23 rhsk = rhs
24 if(.not.checkrhs(fname,4,4)) return
25 if(.not.checklhs(fname,1,3)) return
26c checking variable tail (number 1)
27c
28 if(.not.getvectrow(fname,top,top-rhs+1,it1,m1,n1,lr1,lc1)) return
29c checking variable head (number 2)
30c
31 if(.not.getvectrow(fname,top,top-rhs+2,it2,m2,n2,lr2,lc2)) return
32c checking variable n1 (number 3)
33c
34 if(.not.getscalar(fname,top,top-rhs+3,lr3)) return
35c checking variable n (number 4)
36c
37 if(.not.getscalar(fname,top,top-rhs+4,lr4)) return
38c
39c cross variable size checking
40c
41 if(.not.checkval(fname,n1,n2)) return
42 call entier(n1,stk(lr1),istk(iadr(lr1)))
43 call entier(n2,stk(lr2),istk(iadr(lr2)))
44 call entier(1,stk(lr4),istk(iadr(lr4)))
45 nn5= int(stk(lr3))
46 if(.not.cremat(fname,top+1,0,nn5,1,lw5,loc5)) return
47 if(.not.cremat(fname,top+2,0,n1,1,lw6,loc6)) return
48 if(.not.cremat(fname,top+3,0,n1,1,lw7,loc7)) return
49 call ta2lpd(istk(iadr(lr1)),istk(iadr(lr2)),n1,istk(iadr(lr4)),st
50 $ k(lw5),stk(lw6),stk(lw7))
51 if(err .gt. 0 .or. err1 .gt. 0) return
52c
53 topk=top-rhs
54 topl=top+3
55c
56 if(lhs .ge. 1) then
57c --------------output variable: lp
58 top=topl+1
59 if(.not.cremat(fname,top,0,1,nn5,lrs,lcs)) return
60 call int2db(1*nn5,istk(iadr(lw5)),-1,stk(lrs),-1)
61 endif
62c
63 if(lhs .ge. 2) then
64c --------------output variable: la
65 top=topl+2
66 if(.not.cremat(fname,top,0,1,n1,lrs,lcs)) return
67 call int2db(1*n1,istk(iadr(lw6)),-1,stk(lrs),-1)
68 endif
69c
70 if(lhs .ge. 3) then
71c --------------output variable: ls
72 top=topl+3
73 if(.not.cremat(fname,top,0,1,n1,lrs,lcs)) return
74 call int2db(1*n1,istk(iadr(lw7)),-1,stk(lrs),-1)
75 endif
76c Putting in order the stack
77 if(lhs .ge. 1) then
78 call copyobj(fname,topl+1,topk+1)
79 endif
80 if(lhs .ge. 2) then
81 call copyobj(fname,topl+2,topk+2)
82 endif
83 if(lhs .ge. 3) then
84 call copyobj(fname,topl+3,topk+3)
85 endif
86 top=topk+lhs
87 return
88 end
diff --git a/scilab/modules/sparse/sci_gateway/sparse_gateway.xml b/scilab/modules/sparse/sci_gateway/sparse_gateway.xml
index fe2b748..fd8850d 100644
--- a/scilab/modules/sparse/sci_gateway/sparse_gateway.xml
+++ b/scilab/modules/sparse/sci_gateway/sparse_gateway.xml
@@ -56,4 +56,5 @@
56<PRIMITIVE gatewayId="27" primitiveId="23" primitiveName="mtlb_sparse" /> 56<PRIMITIVE gatewayId="27" primitiveId="23" primitiveName="mtlb_sparse" />
57<PRIMITIVE gatewayId="27" primitiveId="24" primitiveName="%msp_spget" /> 57<PRIMITIVE gatewayId="27" primitiveId="24" primitiveName="%msp_spget" />
58<PRIMITIVE gatewayId="27" primitiveId="25" primitiveName="%msp_full" /> 58<PRIMITIVE gatewayId="27" primitiveId="25" primitiveName="%msp_full" />
59<PRIMITIVE gatewayId="27" primitiveId="26" primitiveName="ta2lpd" />
59</GATEWAY> 60</GATEWAY>
diff --git a/scilab/modules/sparse/src/fortran/LibScilab_Import.def b/scilab/modules/sparse/src/fortran/LibScilab_Import.def
index 7f8b9a0..d902005 100644
--- a/scilab/modules/sparse/src/fortran/LibScilab_Import.def
+++ b/scilab/modules/sparse/src/fortran/LibScilab_Import.def
@@ -37,6 +37,10 @@ getsmat_
37checkrhs_ 37checkrhs_
38checklhs_ 38checklhs_
39formatnumber_ 39formatnumber_
40copyobj_
41cremat_
42getscalar_
43getvectrow_
40; 44;
41; elementary_functions 45; elementary_functions
42unsfdcopy_ 46unsfdcopy_
diff --git a/scilab/modules/sparse/src/fortran/sparse_f.vfproj b/scilab/modules/sparse/src/fortran/sparse_f.vfproj
index 67747f5..d1f9acb 100644
--- a/scilab/modules/sparse/src/fortran/sparse_f.vfproj
+++ b/scilab/modules/sparse/src/fortran/sparse_f.vfproj
@@ -140,6 +140,7 @@ copy sparse_f_header.def+sparse_f.vcdef sparse_f.def &gt;nul" Description="Build
140 <File RelativePath="..\..\sci_gateway\fortran\sci_spmatrix.f"/> 140 <File RelativePath="..\..\sci_gateway\fortran\sci_spmatrix.f"/>
141 <File RelativePath="..\..\sci_gateway\fortran\sci_spmax.f"/> 141 <File RelativePath="..\..\sci_gateway\fortran\sci_spmax.f"/>
142 <File RelativePath="..\..\sci_gateway\fortran\sci_symfcti.f"/> 142 <File RelativePath="..\..\sci_gateway\fortran\sci_symfcti.f"/>
143 <File RelativePath="..\..\sci_gateway\fortran\sci_ta2lpd.f"/>
143 <File RelativePath="sp2col.f"/> 144 <File RelativePath="sp2col.f"/>
144 <File RelativePath="spcho1.f"/> 145 <File RelativePath="spcho1.f"/>
145 <File RelativePath="spcho2.f"/> 146 <File RelativePath="spcho2.f"/>
@@ -159,6 +160,7 @@ copy sparse_f_header.def+sparse_f.vcdef sparse_f.def &gt;nul" Description="Build
159 <File RelativePath="sputil.f"/> 160 <File RelativePath="sputil.f"/>
160 <File RelativePath="symfct.f"/> 161 <File RelativePath="symfct.f"/>
161 <File RelativePath="sz2ptr.f"/> 162 <File RelativePath="sz2ptr.f"/>
163 <File RelativePath=".\ta2lpd.f"/>
162 <File RelativePath="wcompa.f"/> 164 <File RelativePath="wcompa.f"/>
163 <File RelativePath="wful2sp.f"/> 165 <File RelativePath="wful2sp.f"/>
164 <File RelativePath="wij2sp.f"/> 166 <File RelativePath="wij2sp.f"/>
diff --git a/scilab/modules/sparse/src/fortran/sparse_f2c.vcproj b/scilab/modules/sparse/src/fortran/sparse_f2c.vcproj
index b572738..5915f99 100644
--- a/scilab/modules/sparse/src/fortran/sparse_f2c.vcproj
+++ b/scilab/modules/sparse/src/fortran/sparse_f2c.vcproj
@@ -679,6 +679,10 @@
679 > 679 >
680 </File> 680 </File>
681 <File 681 <File
682 RelativePath="..\..\sci_gateway\fortran\sci_ta2lpd.c"
683 >
684 </File>
685 <File
682 RelativePath=".\sp2col.c" 686 RelativePath=".\sp2col.c"
683 > 687 >
684 </File> 688 </File>
@@ -755,6 +759,10 @@
755 > 759 >
756 </File> 760 </File>
757 <File 761 <File
762 RelativePath=".\ta2lpd.c"
763 >
764 </File>
765 <File
758 RelativePath=".\wcompa.c" 766 RelativePath=".\wcompa.c"
759 > 767 >
760 </File> 768 </File>
@@ -1143,6 +1151,10 @@
1143 > 1151 >
1144 </File> 1152 </File>
1145 <File 1153 <File
1154 RelativePath="..\..\sci_gateway\fortran\sci_ta2lpd.f"
1155 >
1156 </File>
1157 <File
1146 RelativePath=".\sp2col.f" 1158 RelativePath=".\sp2col.f"
1147 > 1159 >
1148 </File> 1160 </File>
@@ -1219,6 +1231,10 @@
1219 > 1231 >
1220 </File> 1232 </File>
1221 <File 1233 <File
1234 RelativePath=".\ta2lpd.f"
1235 >
1236 </File>
1237 <File
1222 RelativePath=".\wcompa.f" 1238 RelativePath=".\wcompa.f"
1223 > 1239 >
1224 </File> 1240 </File>
diff --git a/scilab/modules/sparse/src/fortran/ta2lpd.f b/scilab/modules/sparse/src/fortran/ta2lpd.f
new file mode 100644
index 0000000..59dd54b
--- /dev/null
+++ b/scilab/modules/sparse/src/fortran/ta2lpd.f
@@ -0,0 +1,63 @@
1c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2c Copyright (C) DIGITEO 2010 - Yann COLLETTE
3c
4c This file must be used under the terms of the CeCILL.
5c This source file is licensed as described in the file COPYING, which
6c you should have received as part of this distribution. The terms
7c are also available at
8c http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9
10 subroutine ta2lpd(tail,head,ma,n,lp,la,ls)
11c
12c ta2lpd computes the adjacency vectors lp, la and ls
13c from vectors tail and head for a directed graph
14c NO CHECKING IS MADE on tail, head and n
15c input: tail(ma) = tail nodes
16c head(ma) = head nodes
17c ma = number of edges
18c n = number of nodes
19c output: lp(n+1) = pointer vector
20c la(ma) = vector of arcs
21c ls(ma) = vector of corresponding head nodes
22c
23 integer tail(ma),head(ma),ma,n
24 integer lp(*),la(ma),ls(ma)
25c
26 integer iarc,inode
27c
28c first computation of lp
29c lp(i+1) = number of tail nodes
30c = number of arcs with tail node i+1
31c
32 do 1,inode=1,n+1
33 lp(inode)=0
34 1 continue
35 do 2,iarc=1,ma
36 lp(tail(iarc)+1)=lp(tail(iarc)+1)+1
37 2 continue
38c
39c second computation of lp
40c lp(i) = pointer to the first arc
41c with tail i in sorted tail
42c
43 lp(1)=1
44 do 3,inode=2,n
45 lp(inode)=lp(inode-1)+lp(inode)
46 3 continue
47c
48c computation of la and ls
49c
50 do 4,iarc=1,ma
51 inode=tail(iarc)
52 la(lp(inode))=iarc
53 ls(lp(inode))=head(iarc)
54 lp(inode)=lp(inode)+1
55 4 continue
56c
57c last computation of lp
58c
59 do 5,inode=n,1,-1
60 lp(inode+1)=lp(inode)
61 5 continue
62 lp(1)=1
63 end
diff --git a/scilab/modules/sparse/tests/nonreg_tests/bug_6412.dia.ref b/scilab/modules/sparse/tests/nonreg_tests/bug_6412.dia.ref
new file mode 100644
index 0000000..b364f09
--- /dev/null
+++ b/scilab/modules/sparse/tests/nonreg_tests/bug_6412.dia.ref
@@ -0,0 +1,19 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2009 - DIGITEO - Yann COLLETTE <yann.collette@scilab.fr>
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- JVM NOT MANDATORY -->
8// <-- Non-regression test for bug 6412 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6412
12//
13// <-- Short Description -->
14// the function sp2adj was not working
15A = sprand(100,50,.05);
16[xadj,adjncy,anz]= sp2adj(A);
17[n,m]=size(A);
18p = adj2sp(xadj,adjncy,anz,[n,m]);
19if norm(A-p)~=0 then bugmes();quit;end
diff --git a/scilab/modules/sparse/tests/nonreg_tests/bug_6412.tst b/scilab/modules/sparse/tests/nonreg_tests/bug_6412.tst
new file mode 100644
index 0000000..1ba5428
--- /dev/null
+++ b/scilab/modules/sparse/tests/nonreg_tests/bug_6412.tst
@@ -0,0 +1,22 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2009 - DIGITEO - Yann COLLETTE <yann.collette@scilab.fr>
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- JVM NOT MANDATORY -->
9
10// <-- Non-regression test for bug 6412 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=6412
14//
15// <-- Short Description -->
16// the function sp2adj was not working
17
18A = sprand(100,50,.05);
19[xadj,adjncy,anz]= sp2adj(A);
20[n,m]=size(A);
21p = adj2sp(xadj,adjncy,anz,[n,m]);
22if norm(A-p)~=0 then pause, end