[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: norm, 'fro' - warning: division by zero
From: |
Jaroslav Hajek |
Subject: |
Re: norm, 'fro' - warning: division by zero |
Date: |
Fri, 26 Sep 2008 22:05:54 +0200 |
On Fri, Sep 26, 2008 at 9:24 PM, Zbigniew Komarnicki <address@hidden> wrote:
> Hello,
>
> Please see on this code in octave:
> octave-3.0.1 and octave-3.0.2 in Debian lenny.
>
>
> Here is an example:
> =========================
> octave:1> A=zeros(5)
> A =
>
> 0 0 0 0 0
> 0 0 0 0 0
> 0 0 0 0 0
> 0 0 0 0 0
> 0 0 0 0 0
>
> octave:2> norm(A, 'fro')
> warning: division by zero
> ans = NaN
> octave:3>
>
>
> But when, according to the manual (help norm) write in this way:
>
> >From help system:
> P = `"fro"'
> Frobenius norm of A, `sqrt (sum (diag (A' * A)))'.
>
> =========================
> octave:5> sqrt (sum (diag (A' * A)))
> ans = 0
> octave:6>
>
> Here no warning 'division by zero' and answer is 0 not NaN.
>
> It is a bug in 'norm' implementation or something else?
>
It seems as a problem of the current norm implementation.
The following patch
http://hg.tw-math.de/highegg/rev/3c8c55dde77b
reimplements norm adding a number of new capabilities, and does not
suffer from this problem. I guess, however, that this particular issu
is worth fixing separately.
> Thank you, for any comments.
>
> Best wishes,
> Zbigniew
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz