public static ZMatrixRMaj householderVector ( ZMatrixRMaj x ) { ZMatrixRMaj u = x . copy ( ) ; double max = CommonOps_ZDRM . elementMaxAbs ( u ) ; CommonOps_ZDRM . elementDivide ( u , max , 0 , u ) ; double nx = NormOps_ZDRM . normF ( u ) ; Complex_F64 c = new Complex_F64 ( ) ; u . get ( 0 , 0 , c ) ; double realTau , imagTau ; if ( c . getMagnitude ( ) == 0 ) { realTau = nx ; imagTau = 0 ; } else { realTau = c . real / c . getMagnitude ( ) * nx ; imagTau = c . imaginary / c . getMagnitude ( ) * nx ; } u . set ( 0 , 0 , c . real + realTau , c . imaginary + imagTau ) ; CommonOps_ZDRM . elementDivide ( u , u . getReal ( 0 , 0 ) , u . getImag ( 0 , 0 ) , u ) ; return u ; }
Computes the householder vector used in QR decomposition .