help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MacOSX: Octave.app 2.9.14


From: Quentin Spencer
Subject: Re: MacOSX: Octave.app 2.9.14
Date: Wed, 03 Oct 2007 16:01:51 -0500
User-agent: Thunderbird 2.0.0.5 (X11/20070727)

John W. Eaton wrote:
On 30-Sep-2007, Dmitri A. Sergatskov wrote:

| Another speedup can be done if we make a norm (x,1) a special case,
| so instead of calculating:
| | octave:29> tic; sum((abs(x) .^1))^1 ; toc
| Elapsed time is 0.174812 seconds.
| | We can simply calculate: | | octave:30> tic; sum((abs(x))) ; toc
| Elapsed time is 0.080658 seconds.

Patches, anyone?

It looks like it should be as simple as this.
Quentin

Index: scripts/linear-algebra/norm.m
===================================================================
RCS file: /cvs/octave/scripts/linear-algebra/norm.m,v
retrieving revision 1.31
diff -u -r1.31 norm.m
--- scripts/linear-algebra/norm.m       1 Oct 2007 15:59:33 -0000       1.31
+++ scripts/linear-algebra/norm.m       3 Oct 2007 21:01:41 -0000
@@ -93,6 +93,8 @@
           retval = max (abs (x));
         elseif (p == -Inf)
           retval = min (abs (x));
+        elseif (p == 1)
+          retval = sum (abs (x));
         else
           retval = sum (abs (x) .^ p) ^ (1/p);
         endif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]