3 * $Date: 2003/01/17 19:38:13 $
\r
12 #include "qcunitcalc.h"
\r
17 static QBits *gQBits = NULL;
\r
18 static int gNumberOfQBits = 0;
\r
19 static double *gRe = NULL;
\r
20 static double *gIm = NULL;
\r
21 static bool gInitialized = false;
\r
23 //----------------------------------------------------------------------------
\r
26 * This function must be called at first.
\r
28 void allocWith(const QBits &qBits)
\r
31 gQBits = new QBits(qBits);
\r
32 gNumberOfQBits = gQBits->GetNumberOfQBits();
\r
33 gRe = gQBits->GetBitsR();
\r
34 gIm = gQBits->GetBitsI();
\r
35 gInitialized = true;
\r
36 } catch (std::bad_alloc ex) {
\r
37 std::cerr << "qclib: failed in init.\n";
\r
42 //----------------------------------------------------------------------------
\r
46 QBits *getQBits(void)
\r
48 if (false == gInitialized)
\r
50 std::cerr << "qclib: you must initialized correctly.\n";
\r
56 //----------------------------------------------------------------------------
\r
59 * This function should be called in the end.
\r
63 if (NULL != gQBits) delete gQBits;
\r
66 //----------------------------------------------------------------------------
\r