@@ -34,7 +34,7 @@ var formatFloat = function(f, options) {
3434 var s = f + "" ;
3535
3636 if ( options . fixedWidth ) {
37- s = f . toFixed ( options . decimalPlaces ) ;
37+ s = f . toFixed ( options . decimalPlaces || 14 ) ;
3838 }
3939
4040 var plusChar = options . plusChar ;
@@ -3560,6 +3560,58 @@ QuantumCircuit.prototype.removeTrailingRows = function() {
35603560 }
35613561} ;
35623562
3563+ QuantumCircuit . prototype . removeQubit = function ( wire ) {
3564+ if ( ! this . gates [ wire ] ) {
3565+ return ;
3566+ }
3567+
3568+ this . resetState ( ) ;
3569+
3570+ var numCols = this . numCols ( ) ;
3571+ for ( var col = 0 ; col < numCols ; col ++ ) {
3572+ this . removeGateAt ( col , wire ) ;
3573+ }
3574+
3575+ for ( var w = wire + 1 ; w < this . numQubits ; w ++ ) {
3576+ for ( var col = 0 ; col < numCols ; col ++ ) {
3577+ this . gates [ w - 1 ] [ col ] = this . gates [ w ] [ col ] ;
3578+ }
3579+ }
3580+
3581+ this . gates . pop ( ) ;
3582+ this . numQubits -- ;
3583+ } ;
3584+
3585+
3586+ QuantumCircuit . prototype . flipVertically = function ( ) {
3587+ this . resetState ( ) ;
3588+
3589+ var numCols = this . numCols ( ) ;
3590+ var lastQubit = this . numQubits - 1 ;
3591+ for ( var w = 0 ; w < this . numQubits / 2 ; w ++ ) {
3592+ for ( var col = 0 ; col < numCols ; col ++ ) {
3593+ var tmp = this . gates [ w ] [ col ] ;
3594+ this . gates [ w ] [ col ] = this . gates [ lastQubit - w ] [ col ] ;
3595+ this . gates [ lastQubit - w ] [ col ] = tmp ;
3596+ }
3597+ }
3598+ } ;
3599+
3600+ QuantumCircuit . prototype . flipHorizontally = function ( ) {
3601+ this . resetState ( ) ;
3602+
3603+ var numCols = this . numCols ( ) ;
3604+ var lastCol = numCols - 1 ;
3605+ for ( var w = 0 ; w < this . numQubits ; w ++ ) {
3606+ for ( var col = 0 ; col < numCols / 2 ; col ++ ) {
3607+ var tmp = this . gates [ w ] [ col ] ;
3608+ this . gates [ w ] [ col ] = this . gates [ w ] [ lastCol - col ] ;
3609+ this . gates [ w ] [ lastCol - col ] = tmp ;
3610+ }
3611+ }
3612+ } ;
3613+
3614+
35633615
35643616QuantumCircuit . prototype . applyTransform = function ( U , qubits ) {
35653617 var newState = { } ;
0 commit comments