protected double measureHermitianOverlap(ComplexVector other){
  other.toCartesian();
  double result=0;
  double norm1=0;
  double norm2=0;
  for (int i=0; i < dimension * 2; ++i) {
    result+=coordinates[i] * other.coordinates[i];
    norm1+=coordinates[i] * coordinates[i];
    norm2+=other.coordinates[i] * other.coordinates[i];
  }
  return result / Math.sqrt(norm1 * norm2);
}

protected double measureHermitianOverlap ( ComplexVector other ) { other . toCartesian ( ) ; double result = 0 ; double norm1 = 0 ; double norm2 = 0 ; for ( int i = 0 ; i < dimension * 2 ; ++ i ) { result += coordinates [ i ] * other . coordinates [ i ] ; norm1 += coordinates [ i ] * coordinates [ i ] ; norm2 += other . coordinates [ i ] * other . coordinates [ i ] ; } return result / Math . sqrt ( norm1 * norm2 ) ; }
measure overlap , again using the hermitian / euclidean scalar product .
