File: spcompack.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (60 lines) | stat: -rw-r--r-- 1,876 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
58
59
60

spcompack(1)                   Scilab Function                   spcompack(1)
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 spcompak 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