HyperMath

SymBandMatrixIndices

SymBandMatrixIndices

Previous topic Next topic No expanding text in this topic  

SymBandMatrixIndices

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Computes the indices for the symmetric compressed diagonal storage matrix equivalent of a symmetric banded matrix.  This needs to be called for each of the original matrix entries within the sub-diagonal of the band.

Syntax

row, col = SymBandMatrixIndices(i, j, size, k)

Arguments

Name

Description

 

i

The row index of the element of the original matrix.

 

j

The column index of the element of the original matrix.

 

size

The size of each dimension of the original square matrix.

 

k

Number of off-diagonals in the lower or upper band of the original matrix.  This should include zero entry off-diagonals that are placed in-between.

Output

Name

Description

 

row

The corresponding row index in the symmetric compressed diagonal format.

 

col

The corresponding column index in the symmetric compressed diagonal format.

Example

Construct the symmetric compressed diagonal storage matrix for A, where A is a 3x3 symmetric matrix with one sub- and super-diagonal.

 

Syntax

 

A = [1,41,0;41,15,8;0,8,9]; // 3x3 symmetric band matrix

k = 1; // Number of sub-diagonals

M = SymBandMatrix(3,k); // This will hold the compressed matrix

// For each lower band entry (i,j) including the main

//diagonal of A do the following two operations

row,col = SymBandMatrixIndices (i,j,3,k);

M(row,col) = A(i,j);

 

Result

 

M will be the symmetric compressed diagonal matrix version of A.

[Matrix] 2 x 3

1 15 9

41 8 0

Comments

The matrix M becomes an input to a function such as LSolveSPDB.

See Also:

BandMatrix

SymBandMatrix