src/Pulses/PulComposite.cc
// ____________________________________________________________________________
// iv       CLASS COMPOSITE PULSE HAMILTONIAN & PROPAGATOR INDICES
// ____________________________________________________________________________
iv       CLASS COMPOSITE PULSE HAMILTONIAN & PROPAGATOR INDICES
iv CLASS COMPOSITE PULSE HAMILTONIAN & PROPAGATOR INDICES
void PulComposite::SetHIndxs( )
  {
  if(!WFsteps) return;			
  if(!Hindex) Hindex = new int[WFsteps];
  int i, j, found;			
  Hcount = 0;                           
  for(i=0; i<WFsteps; i++)		
    {
    found = 0;				
    for(j=0; j<i && !found; j++)	
      {
      if(WFvals.get(i) == WFvals.get(j))
        {				
        found = 1; 			
        Hindex[i] = j;
        }
      else if(!WFvals.getRe(i) && 	
                       !WFvals.getRe(i))
        {				
        found = 1; 			
        Hindex[i] = j;
        }
      }
    if(!found)				
      {
      Hindex[i] = i;			
      Hcount++;				
      }
    }
  }
void PulComposite :: SetHIndxs ( ) { if ( ! WFsteps ) return ; if ( ! Hindex ) Hindex = new int [ WFsteps ] ; int i , j , found ; Hcount = 0 ; for ( i = 0 ; i < WFsteps ; i ++ ) { found = 0 ; for ( j = 0 ; j < i && ! found ; j ++ ) { if ( WFvals . get ( i ) == WFvals . get ( j ) ) { found = 1 ; Hindex [ i ] = j ; } else if ( ! WFvals . getRe ( i ) && ! WFvals . getRe ( i ) ) { found = 1 ; Hindex [ i ] = j ; } } if ( ! found ) { Hindex [ i ] = i ; Hcount ++ ; } } }
____________________________________________________________________________
iv       CLASS COMPOSITE PULSE HAMILTONIAN & PROPAGATOR INDICES
____________________________________________________________________________
____________________________________________________________________________ iv CLASS COMPOSITE PULSE HAMILTONIAN & PROPAGATOR INDICES ____________________________________________________________________________
// Input        CPul	: A pulse cycle (this) // Output       none    : CPul Hamiltonian indices are //                        are set up // Note                 : Assumed array Hindex is currently empty // Do nothing if no steps defined // If no prop. indices, allocate space // Flag if found {gamB1, phase} repeat // Zero the propagator count // Loop steps & look for repeat Hs // 	Assume Hamiltonian step unique //	Loop all previous steps //      If same {gamB1, phase} then //      repeat H! Flag its been found  //	and store index where it is kept //	If same gamB1=0, then things //	match no matter what phase & //      repeat H! Flag its been found  //	and store index where it is kept // If not found then, H is unique //      Store its index //      Update the H counter