public static Z1 genc(Zmat A,int r1,int r2,int c) throws JampackException {
  int i, ru;
  double norm;
  double s;
  Z scale;
  Z t=new Z();
  Z t1=new Z();
  c=c - A.basex;
  r1=r1 - A.basex;
  r2=r2 - A.basex;
  ru=r2 - r1 + 1;
  Z1 u=new Z1(r2 - r1 + 1);
  for (i=r1; i <= r2; i++) {
    u.put(i - r1,A.re[i][c],A.im[i][c]);
    A.re[i][c]=0.0;
    A.im[i][c]=0.0;
  }
  norm=Norm.fro(u);
  if (r1 == r2 || norm == 0) {
    A.re[r1][c]=-u.re[0];
    A.im[r1][c]=-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(r1 + A.basex,c + A.basex,t.Minus(t.Div(Z.ONE,scale)));
  for (i=0; i < ru; i++) {
    u.Times(i,scale);
  }
  u.re[0]=u.re[0] + 1;
  u.im[0]=0;
  s=Math.sqrt(1 / u.re[0]);
  for (i=0; i < ru; i++) {
    u.re[i]=s * u.re[i];
    u.im[i]=s * u.im[i];
  }
  return u;
}

public static Z1 genc ( Zmat A , int r1 , int r2 , int c ) throws JampackException { int i , ru ; double norm ; double s ; Z scale ; Z t = new Z ( ) ; Z t1 = new Z ( ) ; c = c - A . basex ; r1 = r1 - A . basex ; r2 = r2 - A . basex ; ru = r2 - r1 + 1 ; Z1 u = new Z1 ( r2 - r1 + 1 ) ; for ( i = r1 ; i <= r2 ; i ++ ) { u . put ( i - r1 , A . re [ i ] [ c ] , A . im [ i ] [ c ] ) ; A . re [ i ] [ c ] = 0.0 ; A . im [ i ] [ c ] = 0.0 ; } norm = Norm . fro ( u ) ; if ( r1 == r2 || norm == 0 ) { A . re [ r1 ] [ c ] = - u . re [ 0 ] ; A . im [ r1 ] [ c ] = - 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 ( r1 + A . basex , c + A . basex , t . Minus ( t . Div ( Z . ONE , scale ) ) ) ; for ( i = 0 ; i < ru ; i ++ ) { u . Times ( i , scale ) ; } u . re [ 0 ] = u . re [ 0 ] + 1 ; u . im [ 0 ] = 0 ; s = Math . sqrt ( 1 / u . re [ 0 ] ) ; for ( i = 0 ; i < ru ; i ++ ) { u . re [ i ] = s * u . re [ i ] ; u . im [ i ] = s * u . im [ i ] ; } return u ; }
generates a householder transformation from within the part of column c of a zmat ( altered ) extending from rows r1 to r2 . the method overwrites the column with the result of applying the transformation .
