14.09.2015 Views

Matvec Users’ Guide

Matvec Users' Guide

Matvec Users' Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.4. COMPUTATION 23<br />

> A.fliplr()<br />

flipud<br />

Col 1 Col 2 Col 3<br />

Row 1 3 2 1<br />

Row 2 6 5 4<br />

Row 3 9 8 7<br />

A.flipud() return a matrix with the rows of A to be flipped upside down.<br />

This member function is a user-defined function, it’s loaded automatically into memory whenever you<br />

launch <strong>Matvec</strong>.<br />

For example,<br />

> A = [1,2,3;4,5,6;7,8,9]<br />

Col 1 Col 2 Col 3<br />

Row 1 1 2 3<br />

Row 2 4 5 6<br />

Row 3 7 8 9<br />

> A.flipud()<br />

ginv<br />

Col 1 Col 2 Col 3<br />

Row 1 7 8 9<br />

Row 2 4 5 6<br />

Row 3 1 2 3<br />

A.ginv(mc) returns a matrix G, a generalized (or pseudo) inverse of A. The matrix G has the same dimensions<br />

as A’ so that A*G*A = A, G*A*G = G and AG and GA are Hermitian.<br />

The argument mc is the method code, which is optional with default value 1. If mc = 0, then a method<br />

based on the singular value decomposition (SVD) is used. If mc = 1, then a method based on Cholesky<br />

decomposition is ued. This method works only for symmetric positive semi-definite matrices, and is more<br />

efficient than the method based on SVD.<br />

Any singular values less than a tolerance are treated as zero<br />

For example,<br />

> X=[1,1,0;<br />

1,1,0;<br />

1,1,0;<br />

1,0,1;<br />

1,0,1];<br />

> A = X’*X<br />

Col 1 Col 2 Col 3<br />

Row 1 5 3 2<br />

Row 2 3 3 0<br />

Row 3 2 0 2<br />

> A.ginv()<br />

Col 1 Col 2 Col 3<br />

Row 1 0.0925926 0.0185185 0.0740741<br />

Row 2 0.0185185 0.203704 -0.185185<br />

Row 3 0.0740741 -0.185185 0.259259

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

Saved successfully!

Ooh no, something went wrong!