// }}} itpp::Mat<std::complex<double> > RandomGUE(int const dim, std::string normalization="sigma_offdiag=1", double const percentage_away=0.1){ //{{{ if (normalization=="sigma_offdiag=1"){ return RandomGUEDeltaOne(dim); } else if (normalization=="unfolded mean_level_spacing=1"){ itpp::Mat<std::complex<double> > U(dim, dim), tmp(dim,dim); itpp::Vec<std::complex<double> > vec1(dim); itpp::Vec<double> eigenvalues(dim); FlatSpectrumGUE(U, eigenvalues); for (int i=0; i<dim; i++){ vec1=itpp::elem_mult(conj(U.get_col(i)), to_cvec(eigenvalues)); for (int j=i; j<dim; j++){ tmp(i,j)=vec1*U.get_col(j); if (i<j){tmp(j,i)=conj(tmp(i,j));} } } return tmp; // std::cout << eigenvalues << std::endl ; // ya dentro de temp tenemos a una matriz que no esta // unfolded. tengo que encontrar los eigenvectores, // luego los eigenvalores, eso diagonalizarlos y chan } else { std::cerr << "Illegal normalization RandomGUE" << percentage_away; exit(1); } // Aca poner un factor de normalizacion opcional }
// }}} itpp::Mat<std::complex<double> > RandomCUE(int const dim) { //{{{ itpp::Mat<std::complex<double> > H; H = RandomGUEDeltaOne(dim); itpp::Mat<std::complex<double> > U(dim,dim); itpp::Vec<double> eigenvalues(dim); eig_sym(H, eigenvalues, U); // FlatSpectrumGUE(U, eigenvalues); // return exp( 2*itpp::pi*std::complex<double>(0.,1.)* itpp:randu())*U; return exp(2.*itpp::pi*std::complex<double>(0.,1.) *itpp::randu() )*U; }
// }}} void FlatSpectrumGUE(itpp::Mat<std::complex<double> >& U, itpp::Vec<double>& eigenvalues){ // {{{ int dim=eigenvalues.size(); if(dim != U.rows() || dim != U.cols()){ std::cerr << "error, dimensionenes no apropiadas " << " en FlatSpectrumGUE" <<std::endl ; exit(1); } itpp::Mat<std::complex<double> > temp(dim,dim); bool exito=false; for( ; !exito ; ){ temp=RandomGUEDeltaOne(dim); itpp::eig_sym(temp, eigenvalues, U); eigenvalues/=sqrt(4*dim); exito=unfoldcircular(eigenvalues); } }
// }}} itpp::Vec<double> FlatSpectrumGUE(int const dim, double const percen_out=0.2){ //{{{ int extra_per_side=itpp::round_i(std::ceil(0.5*percen_out*dim)); int dim_large=itpp::round_i(std::ceil(dim+2*extra_per_side)); itpp::Mat<std::complex<double> > temp(dim_large,dim_large); itpp::Vec<double> eigenvalues(dim); itpp::Vec<double> eigenvalues_enlarged(dim_large); // eigenvalues.set_size(dim_enlarged); temp=RandomGUEDeltaOne(dim_large); itpp::eig_sym(temp, eigenvalues_enlarged); eigenvalues_enlarged /= sqrt(4*dim_large); if (eigenvalues_enlarged(extra_per_side)<-1 || eigenvalues_enlarged(dim+extra_per_side-1)> 1){ std::cout<<"UUps, we need to a bigger part of the " <<" spectrum in routine FlatSpectrumGUE"; exit(1); } unfoldcircular(eigenvalues_enlarged); eigenvalues=eigenvalues_enlarged.get(extra_per_side, dim+extra_per_side-1); return eigenvalues; }