From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to make the function 'norm' treat its input as vectors?
Date: Wed, 13 Oct 2010 18:54:04 +0000 (UTC)
Organization: Xoran Technologies
Lines: 10
Message-ID: <i94v8c$r8p$>
References: <i938ok$smb$> <i93kdo$o8f$> <i94def$3h4$> <i94mh3$9c3$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1286996044 27929 (13 Oct 2010 18:54:04 GMT)
NNTP-Posting-Date: Wed, 13 Oct 2010 18:54:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:678178

By modifying Bruno's benchnorm, I've found some contenders that are faster than norm().

norm(a) -> 0.003428
sqrt(a*a.') -> 0.001468
sqrt(mtimesx(a,a,'t')) -> 0.001392

The problem is that a*a.' can't be easily generalized to multiple rows, but the approach using mtimesx can. It is available here,