`(D,dind)=spdiags(A)`

`(D)=spdiags(A,d)`

`(S)=spdiags(A,d,B)`

`(S)=spdiags(A,d,m,n)`

Inputs | |

`A` |
Any matrix |

`d` |
A vector of integers specifying the diagonals of `A` . |

`B` |
A matrix. |

`m` |
An integer. |

`n` |
An integer. |

Outputs | |

`D` |
A matrix of various diagonals of A. |

`dind` |
A vector of integers. |

`S` |
A sparse matrix. |

`spdiags(A)`

returns all the `(m+n-1)`

diagonals of the `pXq`

matrix `A`

in the coulmns of `D`

.
In this context, a diagonal is one of the following:
- The main diagonal, i.e., the vector
`A(i,i), 1<=i<=min(p,q).`

- The sub-diagonals, i.e., for a given
`j`

, the vector`A(1+j+k,j+k)`

, with`0<=k<=min(p-1-j,q-j)`

, identified by`(-j)`

, with`1<=j<=p-1`

. - The (super-diagonals, i.e., the vector, for a given
`j`

,`A(j+k,1+j+k)`

, with`0<=k<=min(p-j,q-1-j)`

, identified by`(j)`

, with`1<=j<=q-1`

.

`dind`

is the integer vector `[-(p-1):1:q-1]`

.
`spdiags(A, d)`

, with each element of the integer vector `d`

satisfying
`-(p-1)<=d[i]<=(q-1)`

, returns the matrix whose columns are the diagonals of
`A`

specified by the elements of `d`

.
`spdiags(A,d,m,n)`

returns an `mXn`

sparse matrix
whose diagonals specified by
the vector `d`

are the columns of `A`

.
The number of columns of `A`

must
be identical to the number of elements in `d`

, and the elements of `d`

must
be in the range `[-(m-1):1:(n-1)]`

.
If `m` , the sub-diagonal `(-N)`

of
the resulting matrix is the part of the corrsponding
column of `A`

that begins from
the row `(N+1)`

, and all the super-diagonals of the resulting matrix
are the approriate columns of `A`

starting from the first row.
Conversely, if `m>=nn`

, the sub-diagonal `(-N)`

of
the resulting matrix is the part of the corresponding column of `A`

that begins from
the row `(N+1)`

, and all the super-diagonals of the resulting matrix
are the approriate columns of `A`

starting from the first row.

`spdiags(A,d,B)`

returns a sparse matrix constructed from `mXn`

matrix
`B`

, but whose diagonals, specified by
the vector `d`

, are replaced by columns of `A`

.
The number of columns of `A`

must
be identical to the number of elements in `d`

, and the elements of `d`

must
be in the range `[-(m-1):1:(n-1)]`

.