Skip to content

Commit

Permalink
Polish some phase text
Browse files Browse the repository at this point in the history
- Hidden phase -> Global phase
- Phase r+i -> Phase degs
  • Loading branch information
Strilanc committed Sep 9, 2019
1 parent 7f461a9 commit 966318c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion html/forge.partial.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<td>
<input tabindex="100" id='gate-forge-rotation-axis' type="text" size="8" placeholder="X+Z"> axis<br/>
<input tabindex="101" id='gate-forge-rotation-angle' type="text" size="8" placeholder="45" style="margin:0.5em 0 0 0;">° angle<br/>
<input tabindex="102" id='gate-forge-rotation-phase' type="text" size="8" placeholder="0" style="margin:0.5em 0 0 0;">° phase
<input tabindex="102" id='gate-forge-rotation-phase' type="text" size="8" placeholder="0" style="margin:0.5em 0 0 0;">° global phase
</td>
<td></td>
<td>
Expand Down
5 changes: 3 additions & 2 deletions src/draw/WidgetPainter.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class WidgetPainter {
return "doesn't affect " + inputDescription;
}
} else if (Seq.range(n).every(r => r === c || col[r].isEqualTo(0))) {
return "phases " + inputDescription + " by " + col[c].toString(format);
let degs = col[c].ln().imag * 180/Math.PI;
return "phases " + inputDescription + " by " + format.formatFloat(degs) + "°";
}
let outputDescription = new Seq(col).
mapWithIndex((e, c) => WidgetPainter.describeKet(b, c, e, format)).
Expand Down Expand Up @@ -146,7 +147,7 @@ class WidgetPainter {
`rotates: ${format.formatFloat(angle * 180 / Math.PI)}°`,
`around: ${WidgetPainter.describeAxis(axis, format)}`,
'',
`hidden phase: exp(${format.formatFloat(phase * 180 / Math.PI)}°i)`,
`global phase: exp(${format.formatFloat(phase * 180 / Math.PI)}°i)`,
''
]).join('\n');
pushRect(painter.printParagraph(
Expand Down

0 comments on commit 966318c

Please sign in to comment.