// Gate class header file

#ifndef gate_h

#undef AFX_API
#define AFX_API AFX_EXT_CLASS
#define gate_h

#include "complex.h"
#include "bstate.h"
#include "hilbert.h"

class CGate
{

public:

	// constructors
	CGate();
	CGate(int, char*);

	// destructor
	~CGate();

	// accessor functions
	int retn_gqbs(void);			// return the number of qubits operated 
									// on by the gate
	char* retname(void);			// return gate name - pure virtual
									// really need to strcpy - fix												
	// gate application functions
	void apply(CHilbert*);			// apply gate to entire system
									// number of qbits in system assumed 
									// to be the same as number of bits
									// operated on by the gate
	void applysub(CHilbert*, int*);	// apply gate to a subspace of the entire space
									// defined by a list of qubits

protected:

	int n_gqbs;						// number of qubits operated on by the gate
	int g_d;						// gate dimensions
	char* gname;					// gate name
	CComplex* garray;				// ptr to gate array (allocated in 1-d);
	bool binsearch(int, int, int*);	// binary search function
	bool search(int, int, int*);	// standard search function
	
	// copy operator (not used)
	CGate& operator =(CGate&);
};

#endif