bandrv#

Purpose#

Creates a symmetric banded matrix, given its compact form.

Format#

y = bandrv(a)#
Parameters:

a (KxN compact form matrix)

Returns:

y (KxK symmetric banded matrix)

Examples#

Create a diagonal matrix#

v = { 1, 9, 6 };

v_mat = bandrv(v);

After the above code, v_mat will equal:

1  0  0
0  9  0
0  0  6

Create a symmetric banded matrix#

x = { 1 2 0 0,
      2 8 1 0,
      0 1 5 2,
      0 0 2 3 };

// Create a version of 'x' in band format
a = band(x, 1);

// Expand the banded version of 'x' back to a full matrix
y = bandrv(a);

After the code above:

     0   1       1   2   0   0          1   2   0   0
a =  2   8   x = 2   8   1   0      y = 2   8   1   0
     1   5       0   1   5   2          0   1   5   2
     2   3       0   0   2   3          0   0   2   3

Remarks#

a is the compact form of a symmetric banded matrix, as generated by band(). a stores subdiagonals right to left, with the principal diagonal in the rightmost (Nth) column. The upper left corner of a is unused. bandchol() expects a matrix of this form.

y is the fully expanded form of a, a KxK matrix with N-1 subdiagonals.