cs_happly.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* apply the ith Householder vector to x */
00003 int cs_happly (const cs *V, int i, double beta, double *x)
00004 {
00005     int p, *Vp, *Vi ;
00006     double *Vx, tau = 0 ;
00007     if (!CS_CSC (V) || !x) return (0) ;     /* check inputs */
00008     Vp = V->p ; Vi = V->i ; Vx = V->x ;
00009     for (p = Vp [i] ; p < Vp [i+1] ; p++)   /* tau = v'*x */
00010     {
00011         tau += Vx [p] * x [Vi [p]] ;
00012     }
00013     tau *= beta ;                           /* tau = beta*(v'*x) */
00014     for (p = Vp [i] ; p < Vp [i+1] ; p++)   /* x = x - v*tau */
00015     {
00016         x [Vi [p]] -= Vx [p] * tau ;
00017     }
00018     return (1) ;
00019 }


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:36:56