Liberty BASIC Community Forum
« quatum computer sim »

Welcome Guest. Please Login or Register.
Nov 20th, 2017, 05:55am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: quatum computer sim  (Read 60 times)
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 922
xx quatum computer sim
« Thread started on: Nov 6th, 2017, 05:13am »

this is a try at a QC sim in LB

i m not sure this wil ever work as intended

there are QC sim out there
so it shoot be posible

see :
https://quantumexperience.ng.bluemix.net/qx/experience

i been programming clasical computers for +-30 years
so i m compleetly new at this

i got so far :
Code:
'' bluatigro 6 nov 2017
'' quantum computig sim
'' see :
'' https://quantumexperience.ng.bluemix.net/qx/experience

dim q$( 1 )
global Qbit$ : Qbit$ = Qbit$( 0 , 0 , 1 ) '' |0>
global pi : pi = atn( 1 ) * 4
end

function Qbit$( x , y , z )
'' constructor
  Qbit$ = str$( x ) + " " ; y ; " " ; z
end function
function Qbit.state( in$ )
  z = val( word$( in$ , 3 ) )
  Qbit.state = iif( z < 0 , 1 , 0 )
end function
function Xgate$( in$ )
  x = val( word$( in$ , 1 ) )
  y = val( word$( in$ , 2 ) )
  z = val( word$( in$ , 3 ) )
  call rotate y , z , pi
  Xgate$ = Qbit$( x , y , z )
end function
function Ygate$( in$ )
  x = val( word$( in$ , 1 ) )
  y = val( word$( in$ , 2 ) )
  z = val( word$( in$ , 3 ) )
  call rotate x , z , pi
  Ygate$ = Qbit$( x , y , z )
end function
function Zgate$( in$ )
  x = val( word$( in$ , 1 ) )
  y = val( word$( in$ , 2 ) )
  z = val( word$( in$ , 3 ) )
  call rotate x , y , pi
  Zgate$ = Qbit$( x , y , z )
end function
function Hgate$( in$ ) '' |+>
  '' superposition
  '' what do i do here ?
  z = iif( rnd(0) < .5 , 1 , -1 )
  Hgate$ = Qbit$( x , y , z )
end function
sub rotate byref k , byref l , r
  s = sin( r )
  c = cos( r )
  hk = k * c - l * s
  hl = k * s + l * c
  k = hk
  l = hl
end sub
function iif( bool , t , f )
  uit = f
  if bool then uit = t
  iif = uit
end function
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls