// Basis state class header file

#ifndef bstate_h

#undef AFX_API
#define AFX_API AFX_EXT_CLASS
#define bstate_h

#include <iostream.h>

class CBstate
{
	// overloaded operators
	friend ostream& operator <<(ostream&, CBstate&);

private:

	int n_qbs;		// number of qubits in basis state
	bool* state;	// ptr to boolean array representing
					// the basis state
public:

	// constructors
	CBstate(int);		// basis state of n qubits  	
	CBstate(int, int);	// i'th basis state for n qubits

	// destructor
	~CBstate();

	// accessor functions
	int numbits(void);	// number of qubits in the basis state
	bool retbool(int);	// state of individual qubit in the basis state
						// i.e. |1001000>.retbool(3) = true
	
	// set function
	void setbasis(int);	// set basis state corresponding to integer index 

	// functions
	int indexnumber(void);		// the integer index corresponding
								// to the basis state
	int small_index(int, int*);	// the integer index corresponding
								// to the basis state in the smaller space
								// defined by the array integers
								// i.e. |1101>.small_index(2,[0,1]) = num(|01>) = 1
	int rev_index(void);		// the integer index corresponding 
								// to the reverse of the basis state
								// i.e. |00101> -> index |10100>

	// concatenate two basis states together in qubit order
	// args are each basis state followed by a list of qubits describing
	// the subspace that they represnet
	// this function isn't actually used - basis state indexes
	// are used instead
	static CBstate* concatenate(CBstate*, int*, CBstate*, int*); 
		
};

#endif