Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: English - Português - 日本語 - Русский
Aide de Scilab >> Matrices creuses > Sparse Matrix Conversion > spcompack

# spcompack

### Arguments

integer vector of length (n+1).

xlindx

integer vector of length n+1 (pointers).

lindx

integer vector

integer vector

### Description

```Utility function is used to convert a compressed adjacency

### Examples

```// 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:
adjncy=[1, 2, 3,4,5,6,7, 4,5,6,7, 5, 6,7, 7];
// 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,
// 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.
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).