[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave criterion for matrix singularity
From: |
Eddy Xiao |
Subject: |
Re: Octave criterion for matrix singularity |
Date: |
Tue, 26 Feb 2019 07:11:56 -0600 (CST) |
mabalenk wrote
> At each iteration I'm increasing the matrix order by one. At some point
> Octave issues a warning:
>
> warning: matrix singular to machine precision, rcond = 1.56508e-17
>
> If possible, would you please direct me to the Octave source code, where
> this decision is made? I would like to understand the criterion, that
> ...
You can search the source code by key words
$ grep -IR 'matrix singular to machine precision'
This direct you to file "liboctave/util/lo-array-errwarn.cc" and function
"warn_singular_matrix (double rcond)".
With this next key words, search by
$ grep -IR 'warn_singular_matrix'
get you to e.g. file "liboctave/array/dMatrix.cc". I would guess it is the
function "Matrix::fsolve" that accomplishes the work of "back slash". And
the key lines are
volatile double rcond_plus_one = rcon + 1.0;
if (rcond_plus_one == 1.0 || octave::math::isnan (rcon))
Alternatively, if you know that the operator "back slash" is called
"mldivide", then you can do "help mldivide" in Octave, it tells you:
'mldivide' is a built-in function from the file
libinterp/corefcn/data.cc
>From there you may trace down what's going on. Though probably not that easy
due to layers of abstraction.
One lesson I learn is: this "rcond" is actually (reciprocal) condition
number of L1 (or L-infinity) norm, instead of L2 norm. Thus it is easier and
faster to compute (by LAPACK routine dgecon()). You can get this rcond by
"rcond" function in Octave. And to my surprise, it is much more capable to
super-low reciprocal condition number, compared to cond() which is based on
SVD. e.g. rcond(vander((1:50)/50))=1.4262e-31,
1/cond(vander((1:50)/50))=4.8811e-20 (which is well under estimated).
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html