Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Imaginary World

Introduction to Imaginary World

発表: https://www.youtube.com/watch?v=Oxn-mgAaR7Q&t=7s

// Japanese
Goのcomplex (複素数) builtin typeについて話しました。
実用例にQuaternionとQuantum Information ScienceのDeutsch-Jozsaアルゴリズムについて話しました。GoによるDeutsch-Jozsaアルゴリズムの実装もあります。
使ったライブラリ: https://github.com/itsubaki/q

// English
I Talked about Go's complex builtin type.
As a real usage example, I picked up Quaternion and Quantum Information Science's Deutsch-Jozsa algorithm. This slide also has the implementation of Deutsch-Jozsa Algorithm in Go.
Used Library: https://github.com/itsubaki/q

たふみ

May 17, 2020
Tweet

More Decks by たふみ

Other Decks in Technology

Transcript

  1. Go

  2. Why Go? • Nice Standard Pkgs? • Clear Dependencies? •

    Less Syntax Sugar? • Single Binary? • Cross Compile? • Simple Syntax? • Fast Build? • gofmt?
  3. Fortran real re, im complex z z = (1.0,2.0) re

    = real(z) ! Re im = aimag(z) ! Im end
  4. C99 // GNU Extention #include <complex.h> ... double _Complex x

    = 1.0 + 2.0i; // C99 Spec #include <complex.h> ... float _Complex x = 1.0 + 2.0 * _Complex_I; Ref https://cpplover.blogspot.com/2013/11/c99.html
  5. C99 // GNU Extention #include <complex.h> ... double _Complex x

    = 1.0 + 2.0i; // C99 Spec #include <complex.h> ... float _Complex x = 1.0 + 2.0 * _Complex_I; Ref https://cpplover.blogspot.com/2013/11/c99.html
  6. Go package main import ( "fmt" ) func main() {

    z := 1 + 2i fmt.Printf("%T", z) } // output: complex128
  7. You, the people have the power - the power to

    create machines. The power to create happiness! You, the people, have the power to make this life free and beautiful, to make this life a wonderful adventure. Retrieved from “The Great Dictator” (1940)
  8. You, the people have the power - the power to

    create machines. The power to create happiness! You, the people, have the power to make this life free and beautiful, to make this life a wonderful adventure. Retrieved from “The Great Dictator” (1940)
  9. Quaternion is used for 3D Graphics rotation, like Games. Another

    methods: - Euler angles (オイラー角) - Rotation Matrix (回転行列) FYI
  10. Euler angles (オイラー角) Euler angles needs only 3 params. ...BUT,

    - the computation is heavy - The problem of Gimbal Lock FYI
  11. Quaternion (4元数) Quaternion needs 4 params. - No Gimbal Lock

    - Balanced for memory & computating resources FYI
  12. 量子情報学入門 石坂 智 (著) 小川 朋宏 (著) 河内 亮周 (著)

    木村 元 (著) 林 正人 (著) 共立出版 2012 References Retrieved from https://www.amazon.co.jp/%E9%87%8F%E5%AD%90%E6%83%85%E5%A0%B1%E7%A7%91%E5%AD%A6%E5% 85%A5%E9%96%80-%E7%9F%B3%E5%9D%82-%E6%99%BA/dp/4320122992
  13. Quantum Physics Raymer, G. M. Oxford Univ. Press 2017 References

    Retrieved from https://www.amazon.co.jp/Quantum-Physics-What-Everyone-Needs/dp/0190250712
  14. 0 1

  15. Unitary Evolution & Unitary Matrix * : Adjoint Matrix (随伴行列)

    This shows that |ψ> changes with time to |ψ>’
  16. Significant Unitary Matrix (cont.) • Hadamard Matrix • Also called

    “Hadamard Transform” when used as an operator • Particularly make the basis superposition which the probability of |0> and |1> is the same
  17. Deutsch- Jozsa Algorithm • Multiply n+1’th bit by Pauli’s \sigma_x

    • Multiply all the bits by Hadamard Operator • Multiply all the bits by U_f • Multiply first n bits by Hadamard Operator • If the observed classical first n bit array is 0...0, then it is constant function, otherwise balanced function.
  18. Deutsch- Jozsa Algorithm (cont.) • f is Oracle, it is

    like black box • So in classical computing, 2/n + 1 inputs must be evaluated. → must be asked 2^(n-1) + 1 times • Deutsch-Jozsa needs 1 time ask
  19. Deutsch- Jozsa Impl // deutschjozsa return is given f is

    constant, returns true. Otherwise retuens false. func deutschjozsa(size int, f func(_ *qsim.Q, _ ...qsim.Qubit)) string { q := qsim.New() is := make([]qsim.Qubit, size) for i := range is { is[i] = q.Zero() } o := q.One() // equivalent to `o := q.Zero(); q.X(o);` q.H(is...) q.H(o) // Apply func as Oracle Uf f(q, is...) q.H(is...) q.Measure(is...) return q.Binary() }
  20. func balanced(space *qsim.Q, qs ...qsim.Qubit) { cnt := 0 for

    _, q := range qs { if cnt%2 == 0 { space.Z(q) } cnt++ } } Deutsch- Jozsa Impl