$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [ublas] norm_2_squared in a fast way
From: Manoj Rajagopalan (rmanoj_at_[hidden])
Date: 2009-09-06 14:29:03
On Sunday 06 September 2009 10:50:19 am Michael Norel wrote:
> So norm_2(vec) is comparable to "sqrt(inner_prod(vec, vec)) "?
>
yes, see vector_norm_2::apply() and vector_inner_prod::apply() in 
functional.hpp.
Also there are some #defines which seem to be able to use existing SIMD. One 
of these is BOOST_UBLAS_USE_SIMD. I don't know how this works exactly - I'm 
guessing this flag is set/reset at configure-time prior to installation.
Also, norm_2(vec) gives you the option to calculate the result more accurately 
if you #define BOOST_UBLAS_SCALED_NORM. This gives you a more accurate result 
compared to a simple sqrt(inner_prod(vec)) but at the expense of a few more 
processor cycles (it controls error propagation). Hence this is useful in 
iterative calculations.
-- Manoj