// template declarations for complex or real state amplitudes // uses macros QTYPE, qtype, and State, defined in qce.h // // this is included twice by qce.h, once for QTYPE Complex and once for QTYPE Real // // R. Perry, Aug. 2019 // State_Complex or State_Real // typedef struct { unsigned int n; // number of bits unsigned long N; // number of states, N = 2**n qtype *a; // N amplitudes } State; // functions: _Complex or _Real // State _name_( Q, QTYPE)( unsigned int n); void _name_( zero, QTYPE)( State q); void _name_( init, QTYPE)( State q, unsigned long k #ifdef QTYPE_COMPLEX , int rphase #endif ); void _name_( swap, QTYPE)( State q, unsigned long i, unsigned long j); State _name_( product, QTYPE)( State r, State s); double _name_( tangle, QTYPE)( State q, unsigned int k); void _name_( H, QTYPE)( State q, unsigned int k); void _name_( X, QTYPE)( State q, unsigned int k); void _name_( Z, QTYPE)( State q, unsigned int k); void _name_( CX, QTYPE)( State q, unsigned int c, unsigned int k); unsigned long _name_( M, QTYPE)( State q); State _name_( reduce, QTYPE)( State q, unsigned int n, unsigned long m); void _name_( collapse, QTYPE)( State q, unsigned int k, unsigned int m); void _name_( operate, QTYPE)( State q, unsigned int n, Func f, unsigned long z); void _name_( print, QTYPE)( const char *msg, State q, int option); double _name_( abs2, QTYPE)( qtype x);