On Mon, Jun 6, 2022 at 6:47 AM Sven Schreiber <sveto...@gmx.net> wrote: > > Am 06.06.2022 um 02:46 schrieb Cottrell, Allin: > > > > I tend to think these are different error conditions: (a) the input > > contains exactly collinear data, and (b) one or more of the input > > series/columns are all zero. > > But that was just an example, not the encompassing definition of the > problem. > Consider this variation without all-zero columns: > > <hansl> > R = {} > A = I(4,1) ~ I(4,2) > print A > Q = qrdecomp(A , &R) > print rank(A) # correct: 2 > print R > scalar r = sumc(abs(diag(R)).>1.0e-12) > print r # wrong: 1 > </hansl>
Is there any general characterization of what it takes for plain QR not to reveal rank? It would appear that the presence of all-zero rows and/or columns is necessary but not sufficient. With m > n you can construct mostly-zero matrices where diag(R) does give the right answer. E.g. <hansl> function void rank_check (const matrix X) R = {} qrdecomp(X, &R) printf "rank via SVD: %d\n", rank(X) printf "rank via QR: %d\n\n", sumc(abs(diag(R)) .> 1.0e-12) end function matrix X = zeros(8,4) X[6,1] = 1 X[7,4] = 1 X[8,4] = 1 print X rank_check(X) </hansl> Allin _______________________________________________ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/