Matvec Users’ Guide
Matvec Users' Guide
Matvec Users' Guide
- 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 31<br />
Col 1 Col 2 Col 3<br />
Row 1 1 0 0<br />
Row 2 4 5 0<br />
Row 3 7 8 9<br />
> A.tril(-1)<br />
triu<br />
Col 1 Col 2 Col 3<br />
Row 1 0 0 0<br />
Row 2 4 0 0<br />
Row 3 7 8 0<br />
A.triu(k) returns the elements on and above the k-th diagonal of A where k is optional. k=0 (default) is the<br />
main diagonal, k ¿ 0 is above the main diagonal and k ¡ 0 is below the main diagonal.<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.triu()<br />
Col 1 Col 2 Col 3<br />
Row 1 1 2 3<br />
Row 2 0 5 6<br />
Row 3 0 0 9<br />
> A.triu(1)<br />
variance<br />
Col 1 Col 2 Col 3<br />
Row 1 0 2 3<br />
Row 2 0 0 6<br />
Row 3 0 0 0<br />
A.variance() returns a vector containing variance values for each column of A.<br />
vec<br />
A.vec(), where A is a matrix, returns a Vector converting from matrix A column-by-column. For example,<br />
> A=[1,2;3,4]<br />
Col 1 Col 2<br />
Row 1 1 2<br />
Row 2 3 4<br />
> A.vec()<br />
i = 1 i = 2 i = 3 i = 4<br />
1 3 2 4