Re: [eigen] notes on Householder and Givens |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] notes on Householder and Givens
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 4 Feb 2009 19:10:03 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=6deX3O4PGLiJ80g0v50wfG9pZDQpStv/2NtYyMeRCXo=; b=GQ+JTdEFJZ3rHZHEtcNXqji/ay4xLzN9X7O4OA9r2wjMl3rCuCiM2+9RuEOkIgbPLX aFW3cuoGVtVRbIx9uQx7a0bC7xVXwFzQeA8+QebXu9CqPdjPs1ZvWKZAEgwHNyhTalOL 5LZyyWwuvmPU1hJ613r/NEReSmQJwTnREeHSE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=vfiFCTLxgYsdTt6pV3645ePwZqHx+vhVy1CNU5OA796wfnksxokppyCiwQHtp8IDP9 8zkaRrZCyOU9dogrrQjY7pp+BBSuiaGRTXHQuml4ywYZZytNfTRKNgqn7rV/24oJmi8W zrsmr8PoejQNKIdwI+A+DY7Eijzd/J5c8kLMg=
Something just occured to me.
If x_0 is "zero", that is muchSmallerThan(norm(x)), then there is
nothing wrong with this formula:
v = x + norm(x) e_0
Indeed, no cancellation can occur since x0 is much smaller than
norm(x), and after that v0 is guaranteed to be approximately equal to
norm(x).
So, i'm sorry to not have thought of that earlier, but it seems that
no pivoting is needed: i think that the following
ei_compute_householder will work for all nonzero vectors x even if x0
= 0:
void ei_compute_householder(const Vector& x of size n, Householder *h)
{
// compute natural householder vector v
Vector v = x;
if(ei_isMuchSmallerThan(x0, norm(x))
{
v0 += norm(x);
}
else
{
v0 += ( x_0 / abs(x_0) ) norm(x);
}
Vector v_starting_with_1 = v/v0;
h->essential = v_starting_with_1.end(n-1);
h->beta = 2 / v_starting_with_1.squaredNorm();
};
Notice that this is still very different from Golub's code since our
code takes good care of the case x0=0 while they don't.
Cheers,
Benoit