[Master Index] [Index for PublicToolbox/regutools]

# gen_hh

## (PublicToolbox/regutools/gen_hh.m in BrainStorm 2.0 (Alpha))

### Function Synopsis

    [x1,beta,v] = gen_hh(x)

### Help Text

    GEN_HH Generate a Householder transformation.

     [x1,beta,v] = gen_hh(x)

     Given a vector x, gen_hh computes the scalar beta and the vector v
     determining a Householder transformation
        H = (I - beta*v*v'),
     such that H*x = +-norm(x)*e_1. x1 is the first element of H*x.

### Cross-Reference Information

This function is called by

    bidiag                             C:\BrainStorm_2001\PublicToolbox\regutools\bidiag.m
    lanc_b                             C:\BrainStorm_2001\PublicToolbox\regutools\lanc_b.m
    lsqr                               C:\BrainStorm_2001\PublicToolbox\regutools\lsqr.m
    plsqr                              C:\BrainStorm_2001\PublicToolbox\regutools\plsqr.m

### Listing of function C:\BrainStorm_2001\PublicToolbox\regutools\gen_hh.m

    function [x1,beta,v] = gen_hh(x)
    %GEN_HH Generate a Householder transformation.
    %
    % [x1,beta,v] = gen_hh(x)
    %
    % Given a vector x, gen_hh computes the scalar beta and the vector v
    % determining a Householder transformation
    %    H = (I - beta*v*v'),
    % such that H*x = +-norm(x)*e_1. x1 is the first element of H*x.

    % Per Christian Hansen, UNI-C, 05/13/1989.

    v = x; alpha = norm(v);
    if (alpha==0),
      beta = 0;
    else
      beta = 1/(alpha*(alpha + abs(v(1))));
    end
    v(1) = v(1) + sign(v(1))*alpha; x1 = -sign(x(1))*alpha;

Produced by color_mat2html, a customized BrainStorm 2.0 (Alpha) version of mat2html on Tue Oct 12 12:05:14 2004
Cross-Directory links are: ON