Skip to content

Instantly share code, notes, and snippets.

@danlkv
Last active June 5, 2020 21:15
Show Gist options
  • Save danlkv/ce37017f2a07827d7c6ee7b8fbc4706f to your computer and use it in GitHub Desktop.
Save danlkv/ce37017f2a07827d7c6ee7b8fbc4706f to your computer and use it in GitHub Desktop.

UNIX Philosophy

  1. Write programs that do one thing and do it well.
  2. Write programs to work together.
  3. Write programs to handle text streams, because that is a universal interface.

Different concerns

  • Parse the file
  • Simulate circuit
    • Optimise expression (find ordering, slice, etc)
    • Actually simulate

Example of usage

Simulator program: tensim

  1. Simply simulate a circuit:

    cat circuit | tensim > result
  2. Simulate a circuit in a wierd format

    cat circuit | tensim parse -f wierd | tensim > result
    1. Q: Why not tensim --input-fmt wierd?

      A: Because we might have other actions working with this format

      cat circuit | tensim parse -f wierd | visualise-circ > circ.png
    2. Q: Why not tensim --input circuit, but cat circuit | tensim?

      A: Because we can a) process many circuits line-by-line and b) connect with other tools

      connect_to_db --table circuits | tensim > results
  3. Simulate N generated circuits in one command

    generate_circ -n 1 >> circuits
    generate_circ -n 2 >> circuits
    ....
    cat circuits | tensim > results
  4. Simulate circuit based on Hamiltonian composed of tensor network, not gates

    gen_tensor_net | tensim optimize | tensim simulate > result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment