public static double fro(Z1 u){
  int i;
  double fac, nrm, scale;
  int n=u.n;
  scale=0.0;
  for (i=0; i < n; i++) {
    scale=Math.max(scale,Math.abs(u.re[i]) + Math.abs(u.im[i]));
  }
  if (scale == 0) {
    return 0.0;
  }
  if (scale < 1) {
    scale=scale * 1.0e20;
  }
  scale=1 / scale;
  nrm=0;
  for (i=0; i < n; i++) {
    fac=scale * u.re[i];
    nrm=nrm + fac * fac;
    fac=scale * u.im[i];
    nrm=nrm + fac * fac;
  }
  return Math.sqrt(nrm) / scale;
}

public static double fro ( Z1 u ) { int i ; double fac , nrm , scale ; int n = u . n ; scale = 0.0 ; for ( i = 0 ; i < n ; i ++ ) { scale = Math . max ( scale , Math . abs ( u . re [ i ] ) + Math . abs ( u . im [ i ] ) ) ; } if ( scale == 0 ) { return 0.0 ; } if ( scale < 1 ) { scale = scale * 1.0e20 ; } scale = 1 / scale ; nrm = 0 ; for ( i = 0 ; i < n ; i ++ ) { fac = scale * u . re [ i ] ; nrm = nrm + fac * fac ; fac = scale * u . im [ i ] ; nrm = nrm + fac * fac ; } return Math . sqrt ( nrm ) / scale ; }
computes the frobenius norm of a z1 .
