File: spcompack.cat

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (57 lines) | stat: -rw-r--r-- 1,888 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
spcompack          Scilab Group          Scilab Function          spcompack
NAME
   spcompack  - converts a compressed adjacency representation
  
CALLING SEQUENCE
   adjncy =  spcompak(xadj,xlindx,lindx)
  
PARAMETERS
 xadj    :  integer vector of length (n+1).
         
 xlindx  :  integer vector of length n+1 (pointers).
         
 lindx   :  integer vector
         
 adjncy  :  integer vector
         
DESCRIPTION
 Utility fonction \fVspcompak\fR is used to convert a compressed adjacency
 representation into standard adjacency representation.
EXAMPLE
 // A is the sparse matrix:
 A=[1,0,0,0,0,0,0;
    0,1,0,0,0,0,0;
    0,0,1,0,0,0,0;
    0,0,1,1,0,0,0;
    0,0,1,1,1,0,0;
    0,0,1,1,0,1,0;
    0,0,1,1,0,1,1];
 A=sparse(A);
 //For this matrix, the standard adjacency representation is given by:
 xadj=[1,2,3,8,12,13,15,16];
 adjncy=[1, 2, 3,4,5,6,7, 4,5,6,7, 5, 6,7, 7];
 //(see sp2adj).
 // increments in vector xadj give the number of non zero entries in each column
 // ie there is 2-1=1 entry in the column 1
 //    there is 3-2=1 entry in the column 2
 //    there are 8-3=5 entries in the column 3
 //              12-8=4                      4
 //etc
 //The row index of these entries is given by the adjncy vector
 // for instance, 
 // adjncy (3:7)=adjncy(xadj(3):xadj(4)-1)=[3,4,5,6,7] 
 // says that the 5=xadj(4)-xadj(3) entries in column 3 have row
 // indices 3,4,5,6,7.
 //In the compact representation, the repeated sequences in adjncy
 //are eliminated.
 //Here in adjncy the sequences 4,5,6,7  and 7 are eliminated.
 //The standard structure (xadj,adjncy) takes the compressed form (lindx,xlindx)
 lindx=[1, 2, 3,4,5,6,7, 5, 6,7];
 xlindx=[1,2,3,8,9,11];
 //(Columns 4 and 7 of A are eliminated).
 //A can be reconstructed from (xadj,xlindx,lindx).
 [xadj,adjncy,anz]= sp2adj(A);
 adjncy -  spcompack(xadj,xlindx,lindx)
SEE ALSO
   sp2adj, adj2sp, spget