public static Z1 genr(Zmat A,int r,int c1,int c2) throws JampackException {
  int j, cu;
  double norm, s;
  Z scale;
  Z t=new Z();
  Z t1=new Z();
  r=r - A.basex;
  c1=c1 - A.basex;
  c2=c2 - A.basex;
  cu=c2 - c1 + 1;
  Z1 u=new Z1(cu);
  for (j=c1; j <= c2; j++) {
    u.put(j - c1,A.re[r][j],A.im[r][j]);
    A.re[r][j]=0.0;
    A.im[r][j]=0.0;
  }
  norm=Norm.fro(u);
  if (c1 == c2 || norm == 0) {
    A.re[r][c1]=-u.re[0];
    A.im[r][c1]=-u.im[0];
    u.put(0,Math.sqrt(2),0);
    return u;
  }
  scale=new Z(1 / norm,0);
  if (u.re[0] != 0 || u.im[0] != 0) {
    t=u.get(0);
    scale.Times(scale,t.Div(t1.Conj(t),Z.abs(t)));
  }
  A.put(r + A.basex,c1 + A.basex,t.Minus(t.Div(Z.ONE,scale)));
  for (j=0; j < cu; j++) {
    u.Times(j,scale);
  }
  u.re[0]=u.re[0] + 1;
  u.im[0]=0;
  s=Math.sqrt(1 / u.re[0]);
  for (j=0; j < cu; j++) {
    u.re[j]=s * u.re[j];
    u.im[j]=-s * u.im[j];
  }
  return u;
}

public static Z1 genr ( Zmat A , int r , int c1 , int c2 ) throws JampackException { int j , cu ; double norm , s ; Z scale ; Z t = new Z ( ) ; Z t1 = new Z ( ) ; r = r - A . basex ; c1 = c1 - A . basex ; c2 = c2 - A . basex ; cu = c2 - c1 + 1 ; Z1 u = new Z1 ( cu ) ; for ( j = c1 ; j <= c2 ; j ++ ) { u . put ( j - c1 , A . re [ r ] [ j ] , A . im [ r ] [ j ] ) ; A . re [ r ] [ j ] = 0.0 ; A . im [ r ] [ j ] = 0.0 ; } norm = Norm . fro ( u ) ; if ( c1 == c2 || norm == 0 ) { A . re [ r ] [ c1 ] = - u . re [ 0 ] ; A . im [ r ] [ c1 ] = - u . im [ 0 ] ; u . put ( 0 , Math . sqrt ( 2 ) , 0 ) ; return u ; } scale = new Z ( 1 / norm , 0 ) ; if ( u . re [ 0 ] != 0 || u . im [ 0 ] != 0 ) { t = u . get ( 0 ) ; scale . Times ( scale , t . Div ( t1 . Conj ( t ) , Z . abs ( t ) ) ) ; } A . put ( r + A . basex , c1 + A . basex , t . Minus ( t . Div ( Z . ONE , scale ) ) ) ; for ( j = 0 ; j < cu ; j ++ ) { u . Times ( j , scale ) ; } u . re [ 0 ] = u . re [ 0 ] + 1 ; u . im [ 0 ] = 0 ; s = Math . sqrt ( 1 / u . re [ 0 ] ) ; for ( j = 0 ; j < cu ; j ++ ) { u . re [ j ] = s * u . re [ j ] ; u . im [ j ] = - s * u . im [ j ] ; } return u ; }
generates a householder transformation from within the part of row r of a zmat ( altered ) extending from columns c1 to c2 . the method overwrites the row with the result of applying the transformation .
