~ubuntu-branches/ubuntu/natty/suitesparse/natty

« back to all changes in this revision

Viewing changes to CSparse/Source/cs_happly.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2006-12-22 10:16:15 UTC
  • Revision ID: james.westby@ubuntu.com-20061222101615-2ohaj8902oix2rnk
Tags: upstream-2.3.1
ImportĀ upstreamĀ versionĀ 2.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "cs.h"
 
2
/* apply the ith Householder vector to x */
 
3
int cs_happly (const cs *V, int i, double beta, double *x)
 
4
{
 
5
    int p, *Vp, *Vi ;
 
6
    double *Vx, tau = 0 ;
 
7
    if (!CS_CSC (V) || !x) return (0) ;     /* check inputs */
 
8
    Vp = V->p ; Vi = V->i ; Vx = V->x ;
 
9
    for (p = Vp [i] ; p < Vp [i+1] ; p++)   /* tau = v'*x */
 
10
    {
 
11
        tau += Vx [p] * x [Vi [p]] ;
 
12
    }
 
13
    tau *= beta ;                           /* tau = beta*(v'*x) */
 
14
    for (p = Vp [i] ; p < Vp [i+1] ; p++)   /* x = x - v*tau */
 
15
    {
 
16
        x [Vi [p]] -= Vx [p] * tau ;
 
17
    }
 
18
    return (1) ;
 
19
}