File: sp2col.f

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (37 lines) | stat: -rw-r--r-- 1,228 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
      subroutine sp2col(m,n,ind,nel,indr)
c     given a sparse matrix storage information sp2col compute the  
c     storage of the column conversion of the original matrix
c!parameters
c     m : number of rows of original matrix
c     n : number of columns of original matrix
c     ind : 
c          ind(i) contains the number of non zero elements in the 
c                 original matrix ith row
c          ind(m+j) contains the column number of jth non zero elements
c                   (non zeros elements are counted row by row)
c     nel : total number of non zero elements
c     indr:
c          ind(i) contains the number of non zero elements in the 
c                 resulting vector ith row (must be 0 or 1)
c          indr(m*n+j) contains the old position of the jth non zero 
c                      element
c     Copyright INRIA
      integer ind(*),indr(*)
c
      call iset(m*n,0,indr,1)
      k0=0
      k1=0
      do 20 i=1,m
         ni=ind(i)
         if (ni.gt.0) then
            do 10 k=1,ni
               j=ind(m+k0+k)
               indr(i+(j-1)*m)=1
               k1=k1+1
               indr(m*n+k0+k)=k1
 10         continue
            k0=k0+ni
         endif
 20   continue
      return
      end