14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

160 Data Structures Chapter 7<br />

Matrices<br />

newA=evecs*diag(evals)*evecs`;<br />

Note the following about eigenvalues and eigenvectors:<br />

• The eigenvector matrices are orthonormal, such that the inverse is the transpose: E′E = EE′ = I .<br />

• Eigenvectors are uniquely determined only if the eigenvalues are unique.<br />

• Zero eigenvalues correspond to singular matrices.<br />

• Inverses can be obtained by inverting the eigenvalues and reconstituting with the eigenvectors.<br />

Moore-Penrose generalized inverses can be formed by inverting the nonzero eigenvalues and<br />

reconstituting. (See “GInverse” on page 156.)<br />

Note: You must decide whether a very small eigenvalue is effectively zero.<br />

• The eigenvalue decomposition enables you to view any square-matrix multiplication as the following:<br />

– a rotation (multiplication by an orthonormal matrix)<br />

– a scaling (multiplication by a diagonal matrix)<br />

– a reverse rotation (multiplication by the orthonormal inverse, which is the transpose), or in notation:<br />

A*x = E`*diag(M)*E*x; // E rotates, diag(M) scales, E` reverse-rotates<br />

Cholesky Decomposition<br />

The Cholesky() function performs Cholesky decomposition. A positive semi-definite matrix A is<br />

re-expressed as the product of a nonsingular, lower-triangular matrix L and its transpose: L*L' = A.<br />

E=[ 5 4 1 1, 4 5 1 1, 1 1 4 2, 1 1 2 4];<br />

L=Cholesky(E);<br />

[2.23606797749979 0 0 0,<br />

1.788854381999832 1.341640786499874 0 0,<br />

0.447213595499958 0.149071198499986 1.9436506316151 0,<br />

0.447213595499958 0.149071198499986 0.914659120760047 1.71498585142509]<br />

To verify the results, enter the following:<br />

L*L`;<br />

[5 4 1 1,<br />

4 5 1 1,<br />

1 1 4 2,<br />

1 1 2 4]<br />

About Cholesky Decomposition<br />

Cholesky() is useful for reconstituting expressions into a more manageable form. For example, eigenvalues<br />

are available only for symmetric matrices in JMP, so the eigenvalues of the product AB could not be<br />

obtained directly. (Although A and B can be symmetric, the product is not symmetric.) However, you can<br />

usually rephrase the problem in terms of eigenvalues of L′BL where L is the Cholesky root of A, which has<br />

the same eigenvalues.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!