This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import qsim | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from qsim.evolution import hamiltonian | |
| from qsim.graph_algorithms.graph import unit_disk_grid_graph, rydberg_graph | |
| from qsim.graph_algorithms.adiabatic import SimulateAdiabatic | |
| from qsim import schrodinger_equation | |
| import matplotlib.gridspec as gridspec | |
| import scipy.sparse | |
| import scipy.optimize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function remote () { | |
| code --remote ssh-remote+desktop /home/roger/code/$1 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Expronicon | |
| using MLStyle | |
| function expand_mlstyle(m::Module, ex) | |
| @switch ex begin | |
| @case Expr(:macrocall, Symbol("@match"), xs...) || Expr(:macrocall, Symbol("@switch"), xs...) || | |
| Expr(:macrocall, Symbol("@λ"), xs...) | |
| return expand_mlstyle(m, macroexpand(m, ex)) | |
| @case ::Expr | |
| return Expr(ex.head, map(x->expand_mlstyle(m, x), ex.args)...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using YaoLocations | |
| using BenchmarkTools | |
| using BQCESubroutine | |
| using StrideArrays | |
| using BQCESubroutine.Utilities | |
| using LoopVectorization | |
| using ThreadingUtilities | |
| using ArrayInterface | |
| using BQCESubroutine.Utilities: BitSubspace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Random | |
| using Yao | |
| using Plots | |
| using LinearAlgebra | |
| using QuantumInformation | |
| function run_circuit!(r::AbstractRegister, θs::Matrix, p::Real=0.0) | |
| n = nqubits(r) | |
| for j in 1:size(θs, 2) # each layer | |
| for i in 1:size(θs, 1)÷2 # each wire |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| macro _threads(ex) | |
| return quote | |
| if (Threads.nthreads() > 1) && (length(st) > 4096) | |
| $(Expr(:macrocall, Expr(:(.), :Threads, QuoteNode(Symbol("@threads"))), __source__, ex)) | |
| else | |
| $ex | |
| end | |
| end |> esc | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using YaoCompiler | |
| using YaoCompiler.Intrinsics | |
| qasm"""OPENQASM 2.0; | |
| include "qelib1.inc"; | |
| gate post q {x q;} | |
| """ | |
| @device function circuit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Dates | |
| function count_hours(m) | |
| days = filter(Date(2020, m, 14): Day(1):Date(2020, m+1, 13)) do day | |
| !(dayname(day) in ["Saturday", "Sunday"]) | |
| end | |
| return length(days) * 8 | |
| end | |
| count_hours(7) * 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using CUDA | |
| using ExponentialUtilities | |
| using LinearAlgebra | |
| using BenchmarkTools | |
| using ExponentialUtilities: getV, getH, get_cache, _exp! | |
| using LinearAlgebra: BlasReal, BlasComplex | |
| using SparseArrays | |
| using CUDA: CUBLAS | |
| CUDA.allowscalar(false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Flux | |
| struct Linear{T, WT <: AbstractMatrix{T}, BT <: AbstractVector{T}} | |
| W::WT | |
| b::BT | |
| end | |
| Flux.functor(m::Linear) = (m.W, m.b), (W, b) -> Linear(W, b) | |
| m = Linear(rand(2, 2), rand(2)) |
NewerOlder