Quantum Computing sim ?
-
this is verry interesting :
Quote:
i tryed to get it in c++ its a start i been programming clasical computers for +-30 year's i not even shure i wil understad this [ if ever ]
// bluatigro 8 nov 2017
// QC sim
// see :
// https://quantumexperience.ng.bluemix.net/qx/experience#include #include #include void rot( double & k , double & l , double r)
{
double s , c , hk , hl ;
s = sin( r ) ;
c = cos( r ) ;
hk = k * c - l * s ;
hl = k * s + l * c ;
k = hk ;
l = hl ;
}
const double PI = atn( 1.0 ) * 4.0 ;class Qbit
{
public :
double x , y , z ;
Qbit() // |0>
{
x = 0.0 ;
y = 0.0 ;
z = 1.0 ;
}
Qbit( double a , double b , double c )
{
x = a ;
y = b ;
z = c ;
}
void X()
{
rot( y , z , PI ) ;
}
void Y()
{
rot( x , z , PI ) ;
}
void Z()
{
rot( x , y , PI ) ;
}
void H() // |+>
{
;
}
void S()
{
rot( x , y , PI / 2 ) ;
}
void S1()
{
rot( x , y , -PI / 2 ) ;
}
void T()
{
rot( x , y , PI / 4 ) ;
}
void T1()
{
rot( x , y , -PI / 4 ) ;
}
double get_state()
{
return z < 0.0 ? 1.0 : 0.0 ;
}
} ;
void cnot( Qbit & control , Qbit & target )
{
if ( control.get_state() == 1.0 )
target.z = 1.0 - target.z ;
}using namespace std ;
int main()
{
cout << "Hello world!" << endl;
return 0;
} -
this is verry interesting :
Quote:
i tryed to get it in c++ its a start i been programming clasical computers for +-30 year's i not even shure i wil understad this [ if ever ]
// bluatigro 8 nov 2017
// QC sim
// see :
// https://quantumexperience.ng.bluemix.net/qx/experience#include #include #include void rot( double & k , double & l , double r)
{
double s , c , hk , hl ;
s = sin( r ) ;
c = cos( r ) ;
hk = k * c - l * s ;
hl = k * s + l * c ;
k = hk ;
l = hl ;
}
const double PI = atn( 1.0 ) * 4.0 ;class Qbit
{
public :
double x , y , z ;
Qbit() // |0>
{
x = 0.0 ;
y = 0.0 ;
z = 1.0 ;
}
Qbit( double a , double b , double c )
{
x = a ;
y = b ;
z = c ;
}
void X()
{
rot( y , z , PI ) ;
}
void Y()
{
rot( x , z , PI ) ;
}
void Z()
{
rot( x , y , PI ) ;
}
void H() // |+>
{
;
}
void S()
{
rot( x , y , PI / 2 ) ;
}
void S1()
{
rot( x , y , -PI / 2 ) ;
}
void T()
{
rot( x , y , PI / 4 ) ;
}
void T1()
{
rot( x , y , -PI / 4 ) ;
}
double get_state()
{
return z < 0.0 ? 1.0 : 0.0 ;
}
} ;
void cnot( Qbit & control , Qbit & target )
{
if ( control.get_state() == 1.0 )
target.z = 1.0 - target.z ;
}using namespace std ;
int main()
{
cout << "Hello world!" << endl;
return 0;
} -
this is verry interesting :
Quote:
i tryed to get it in c++ its a start i been programming clasical computers for +-30 year's i not even shure i wil understad this [ if ever ]
// bluatigro 8 nov 2017
// QC sim
// see :
// https://quantumexperience.ng.bluemix.net/qx/experience#include #include #include void rot( double & k , double & l , double r)
{
double s , c , hk , hl ;
s = sin( r ) ;
c = cos( r ) ;
hk = k * c - l * s ;
hl = k * s + l * c ;
k = hk ;
l = hl ;
}
const double PI = atn( 1.0 ) * 4.0 ;class Qbit
{
public :
double x , y , z ;
Qbit() // |0>
{
x = 0.0 ;
y = 0.0 ;
z = 1.0 ;
}
Qbit( double a , double b , double c )
{
x = a ;
y = b ;
z = c ;
}
void X()
{
rot( y , z , PI ) ;
}
void Y()
{
rot( x , z , PI ) ;
}
void Z()
{
rot( x , y , PI ) ;
}
void H() // |+>
{
;
}
void S()
{
rot( x , y , PI / 2 ) ;
}
void S1()
{
rot( x , y , -PI / 2 ) ;
}
void T()
{
rot( x , y , PI / 4 ) ;
}
void T1()
{
rot( x , y , -PI / 4 ) ;
}
double get_state()
{
return z < 0.0 ? 1.0 : 0.0 ;
}
} ;
void cnot( Qbit & control , Qbit & target )
{
if ( control.get_state() == 1.0 )
target.z = 1.0 - target.z ;
}using namespace std ;
int main()
{
cout << "Hello world!" << endl;
return 0;
}Okay, and? :confused:
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Okay, and? :confused:
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles