private double[][] determineBasis(double[] alpha){
  final int dim=alpha.length;
  double[] nn=new double[dim + 1];
  for (int i=0; i < nn.length; i++) {
    double alpha_i=i == alpha.length ? 0 : alpha[i];
    nn[i]=sinusProduct(0,i,alpha) * StrictMath.cos(alpha_i);
  }
  timesEquals(nn,1. / euclideanLength(nn));
  double[][] basis=new double[dim][];
  int found=0;
  for (int i=0; i < nn.length && found < dim; i++) {
    final double[] e_i=new double[nn.length];
    e_i[i]=1.0;
    minusTimesEquals(e_i,nn,scalarProduct(e_i,nn));
    double len=euclideanLength(e_i);
    for (int j=0; j < found; j++) {
      if (len < 1e-9) {
        break;
      }
      minusTimesEquals(e_i,basis[j],scalarProduct(e_i,basis[j]));
      len=euclideanLength(e_i);
    }
    if (len < 1e-9) {
      continue;
    }
    timesEquals(e_i,1. / len);
    basis[found++]=e_i;
  }
  if (found < dim) {
    for (int i=found; i < dim; i++) {
      basis[i]=new double[nn.length];
    }
  }
  return transpose(basis);
}

private double [ ] [ ] determineBasis ( double [ ] alpha ) { final int dim = alpha . length ; double [ ] nn = new double [ dim + 1 ] ; for ( int i = 0 ; i < nn . length ; i ++ ) { double alpha_i = i == alpha . length ? 0 : alpha [ i ] ; nn [ i ] = sinusProduct ( 0 , i , alpha ) * StrictMath . cos ( alpha_i ) ; } timesEquals ( nn , 1. / euclideanLength ( nn ) ) ; double [ ] [ ] basis = new double [ dim ] [ ] ; int found = 0 ; for ( int i = 0 ; i < nn . length && found < dim ; i ++ ) { final double [ ] e_i = new double [ nn . length ] ; e_i [ i ] = 1.0 ; minusTimesEquals ( e_i , nn , scalarProduct ( e_i , nn ) ) ; double len = euclideanLength ( e_i ) ; for ( int j = 0 ; j < found ; j ++ ) { if ( len < 1e-9 ) { break ; } minusTimesEquals ( e_i , basis [ j ] , scalarProduct ( e_i , basis [ j ] ) ) ; len = euclideanLength ( e_i ) ; } if ( len < 1e-9 ) { continue ; } timesEquals ( e_i , 1. / len ) ; basis [ found ++ ] = e_i ; } if ( found < dim ) { for ( int i = found ; i < dim ; i ++ ) { basis [ i ] = new double [ nn . length ] ; } } return transpose ( basis ) ; }
determines a basis defining a subspace described by the specified alpha values .
