; IDL Version 7.1.1 (linux x86_64 m64) ; Journal File for mats@sally ; Working directory: /home/mats/idl/develop/matrixalgebra ; Date: Thu Apr 5 16:19:19 2012 ;The QRfac routine makes sense (for the ## convention) ;if we realize that QRfac should be called with the ;transpose of the matrix we want to factorize. Here ;with the example from the qrfac.pro documentation. ; ;------ |A| (op:##) [3x2] ------ ; 9.00 4.00 ; 2.00 8.00 ; 6.00 7.00 ;------------------------------- ; ;------ |AT=transpose(A)| (op:##) [2x3] ------ ; 9.00 2.00 6.00 ; 4.00 8.00 7.00 ;--------------------------------------------- ; ;Now call "QRFAC, AT, R1, QMATRIX = Q" ; ; ;The R matrix returned is properly upper-right triangular ;with the ## conventions: ; ;------ |R1| (op:##) [2x2] ------ ; -11.000 -8.545 ; 0.000 -7.482 ;-------------------------------- ; ;QRfac calculates a "thin" QR factorization, where both the ;returned R and Q matrices are square. Q1 is the partition ;of Q that matches R1: ; ;------ |Q| (op:##) [3x3] ------ ; -0.818 0.400 -0.413 ; -0.182 -0.862 -0.474 ; -0.545 -0.313 0.778 ;------------------------------- ; ;------ |Q1| (op:##) [3x2] ------ ; -0.818 0.400 ; -0.182 -0.862 ; -0.545 -0.313 ;-------------------------------- ; ;Now we just need to make sure the product actually is ;equal to the original matrix: ; ;------ |Q1 ## R1| (op:##) [3x2] ------ ; 9.000 4.000 ; 2.000 8.000 ; 6.000 7.000 ;-------------------------------------- ; ;------ |A| (op:##) [3x2] ------ ; 9.000 4.000 ; 2.000 8.000 ; 6.000 7.000 ;------------------------------- ; ;------ |A - (Q1 ## R1)| (op:##) [3x2] ------ ; 0.000 0.000 ; 0.000 0.000 ; 0.000 0.000 ;--------------------------------------------