Frobenius norm of a null matrix is not zero

Ben Abbott bpabbott at mac.com
Mon Jan 14 10:32:15 CST 2008


On Monday, January 14, 2008, at 09:16AM, "Rolf Fabian" <Rolf.Fabian at gmx.de> wrote:
>
>
>Ben Abbott wrote:
>> 
>> 
>> On Jan 14, 2008, at 5:37 AM, Rolf Fabian wrote:
>> 
>>>
>>> You should not expect that anybody doing work for Octave is
>>> doing it always on a UNIX system.
>>>
>>> E.g. trying to use 'diff.exe' (which is distributed as part of
>>> 'msys' shell with the Octave 3.0.0 windows installer) from
>>> within a Windows XP command prompt ('cmd') results in :
>>>
>>>   Microsoft Windows XP [Version 5.1.2600]
>>>   (C) Copyright 1985-2001 Microsoft Corp.
>>>
>>>   C:\WINDOWS\system32> diff --help
>>>   'diff' is not recognized as an internal or external command,
>>>   operable program or batch file.
>>>
>>> Obviously appropriate system paths for 'msys' were not added
>>> during the installation process ( at least on the system I used ).
>>>
>>> I needed some time to figure out, that in order to use 'diff'
>>> implemented in the Windows 'msys' - shell is expected to be
>>> used from the Octave prompt using Octave's "system"-command
>>> ( then 'msys'-functions are obviously found ):
>>>
>>> octave-3.0.0.exe:1>
>>> system ("diff  -u  old_file.m  new_file.m  >  new_file.patch")
>>>
>>> which is a bit different from your oversimplification above.
>>>
>>> Rolf Fabian
>>>
>>>
>>>
>>> John W. Eaton wrote:
>>>>
>>>> On 11-Jan-2008, Rolf Fabian wrote:
>>>>
>>>> |
>>>> | This fixes the problem.
>>>> | Sorry, no time to send patches etc ....
>>>>
>>>> Sorry, how hard is it to run diff -u my-orig-file my-new-file?
>>>>
>>>> jwe
>>>>
>>> -----
>>> Rolf Fabian
>>> <r dot fabian at jacobs-university dot de>
>> 
>> 
>> Rolf,
>> 
>> It appears to me that the changes you made and those of jfc were  
>> different (at least a diff of yours produced a larger result).
>> 
>> Are jfc's in fact the same, or sufficient?
>> 
>> Ben
>> 
>
>Right, I did more changes.
>
>Besides catching the 'division by zero' errors which appeared
>for both input shapes (vector & matrix) of Frobenius norm (p='fro'),
>I also applied minor changes to modes (p='inf') and (p=Inf) of the
>the infinity norm which is used for scaling the input in the Frobenius
>case.
>
>Conceptually, infinity norm (largest sum of abs of row elements ) of
>a (non-vector) matrix x may be calculated as the 1-norm
>(largest sum of abs of column elements ) of the transposed 
>input matrix x.' , thus  
>"retval = max (sum (abs (x.')));"  
>should be appropriate for matrix infinity norm case in the
>'__norm__.m' code.
>
>Instead,  Octave used  "retval = max (sum (abs (x')));" 
>as long as I can remember back ( >10 y ).
>Of course, the result for 'retval' in both code snippets is
>the same ( as a consequence of the invoked abs-function ),
>but I thought it's really time now to remove this confusing
>redundant complex conjugation of the transposed matrix while
>evaluating matrix infinity norm.
>
>Rolf Fabian
><r dot fabian at jacobs-university dot de>
>

Ok. It sounds like you're version is to be preferred over the one submitted by jfc, correct?

If so perhaps a patch and changelog can be created?

It would also be useful to add some test scripts. If you're unfamiliar with those I can add them. I just need some examples of how  __norm__ is used.

Ben


More information about the Bug-octave mailing list