Source code: Q.js


The Q object

The root of Q.js is the Q object. It provides a single point for attaching all other Q.js functionality to, thereby avoiding pollution of the global namespace while keeping everything accessible to us. It also provides some convenience properties and methods for use across the library. Most conveniently, the Q object is actually a function that wraps the Q.Circuit.fromText function. This makes defining quantum circuits incredibly brief.


var circuit = Q`

	H-X#0
	I-X#1
`

See “Writing quantum circuits” for more details.


Properties

Help and inspection

Constants and constant creation

Maths

Miscellaneous