vec EnsembleCCE::cluster_evolution(int cce_order, int index) { vector<cSPIN> spin_list = _my_clusters.getCluster(cce_order, index); Hamiltonian hami0 = create_spin_hamiltonian(_center_spin, _state_pair.first, spin_list); Hamiltonian hami1 = create_spin_hamiltonian(_center_spin, _state_pair.second, spin_list); vector<QuantumOperator> left_hm_list = riffle((QuantumOperator) hami0, (QuantumOperator) hami1, _pulse_num); vector<QuantumOperator> right_hm_list; if (_pulse_num % 2 == 0) right_hm_list= riffle((QuantumOperator) hami1, (QuantumOperator) hami0, _pulse_num); else right_hm_list = riffle((QuantumOperator) hami0, (QuantumOperator) hami1, _pulse_num); vector<double> time_segment = Pulse_Interval(_pulse_name, _pulse_num); DensityOperator ds = create_spin_density_state(spin_list); PiecewiseFullMatrixMatrixEvolution kernel(left_hm_list, right_hm_list, time_segment, ds); kernel.setTimeSequence( _t0, _t1, _nTime); ClusterCoherenceEvolution dynamics(&kernel); dynamics.run(); return calc_observables(&kernel); }
vec SingleSampleCCE::cluster_evolution(int cce_order, int index) {/*{{{*/ vector<cSPIN> spin_list = _my_clusters.getCluster(cce_order, index); cClusterIndex clstIndex = _my_clusters.getClusterIndex(cce_order, index); Hamiltonian hami0 = create_spin_hamiltonian(_center_spin, _state_pair.first, spin_list, clstIndex); Hamiltonian hami1 = create_spin_hamiltonian(_center_spin, _state_pair.second, spin_list, clstIndex); vector<QuantumOperator> hm_list1 = riffle((QuantumOperator) hami0, (QuantumOperator) hami1, _pulse_num); vector<QuantumOperator> hm_list2 = riffle((QuantumOperator) hami1, (QuantumOperator) hami0, _pulse_num); vector<double> time_segment = Pulse_Interval(_pulse_name, _pulse_num); PureState psi = create_cluster_state(clstIndex); PiecewiseFullMatrixVectorEvolution kernel1(hm_list1, time_segment, psi); PiecewiseFullMatrixVectorEvolution kernel2(hm_list2, time_segment, psi); kernel1.setTimeSequence( _t0, _t1, _nTime); kernel2.setTimeSequence( _t0, _t1, _nTime); ClusterCoherenceEvolution dynamics1(&kernel1); ClusterCoherenceEvolution dynamics2(&kernel2); dynamics1.run(); dynamics2.run(); return calc_observables(&kernel1, &kernel2); }/*}}}*/
static void oddEvenMerge(vec<Formula>& fs, int begin, int end) { assert(end - begin > 1); if (end - begin == 2) cmp2(fs,begin); else { int mid = (end - begin) / 2; vec<Formula> tmp; for (int i = 0; i < end - begin; i++) tmp.push(fs[begin+i]); unriffle(tmp); oddEvenMerge(tmp,0,mid); oddEvenMerge(tmp,mid,tmp.size()); riffle(tmp); for (int i = 1; i < tmp.size() - 1; i += 2) cmp2(tmp,i); for (int i = 0; i < tmp.size(); i++) fs[i + begin] = tmp[i]; } }