Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

guimspace/envelope-matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Envelope Matrix

License Release

Methods to generate and work with envelopes of matrices.

Notice Use envelope-matrix methods for educational purposes only. The methods are NOT suitable for professional application as it is not meant to be the most efficient, optimized, correct and secure implementation.

The envelope of a symmetric or upper-triangular matrix A is a set of ordered pairs (i, j), i < j, representing element locations in the upper triangle of A, defined as follows: (i, j) is in the envelope of A if and only if a_kj != 0 for some k <= i. Thus, if the first nonzero entry of the j th column is a_mj and m < j, then (m, j), (m + 1, j), ..., (j - 1, j) are the members of the envelope of A from the j th column. [1]

About

A basic data structure of four arrays is one way to store the envelope a matrix A.

Array Description
DIAG Stores the elements from the diagonal of A.
ENV Stores the envelope of A.
ENVcol Points to elements of ENV. ENVcol(j) points to position in ENV that stores the first non-zero element of the j th column. If the j th column is "empty", then ENVcol(j) points to ENVcol(j + 1).
ENVlin Stores the line index of each element from ENV.

Example

A = [
  11  12  0   14  0   0;
  0   22  23  0   0   0;
  0   0   33  0   0   0;
  0   0   0   44  0   46;
  0   0   0   0   55  0;
  0   0   0   0   0   66
]

DIAG = [11   22   33   44   55   66];
ENV = [12   23   14    0    0   46    0    null];
ENVcol = [1   1   2   3   6   6   8];
ENVlin = [1   2   1   2   3   4   5   null];

To retrieve an element a_ij from an envelope:

  1. If i == j, return DIAG(i).
  2. Get pos = ENVcol(j).
  3. If pos == ENVcol(j + 1), then the j th column is empty: return 0.
  4. If ENVlin(pos) > i, then the column has 0's up to the ENVlin(pos) th line.
  5. Get pos = pos + i - ENVlin(pos).
  6. Return ENV(pos).

Contribute code and ideas

Contributors sign-off that they adhere to the Developer Certificate of Origin (DCO) by adding a Signed-off-by line to commit messages.

$ git commit -s -m 'This is my commit message'

For straight forward patches and minor changes, create a pull request.

For larger changes and feature ideas, please open an issue first for a discussion before implementation.

Reference

  1. Watkins, David S. (2010), Fundamentals of matrix computations (Third ed.), New York: John Wiley & Sons, Inc., ISBN 0-470-52833-4