This file contains 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
#!/bin/bash | |
SOURCE_DIR=/home/niklas/ | |
TARGET_DIR=/media/Backup/FileBackup | |
EXCLUDE_FILE=/home/niklas/rsync_excludelist | |
rsync -avP --exclude-from=${EXCLUDE_FILE} --delete-excluded --delete --stats ${SOURCE_DIR} ${TARGET_DIR} | |
# add log entry to target dir | |
LOGFILE="$TARGET_DIR/backup_log" | |
DATE=$(date) | |
echo "Last backup on $DATE" >> $LOGFILE |
This file contains 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
class C(object): | |
def __init__(self, i, n): | |
self.i = i | |
self.n = n | |
self.psi0 = [] | |
self.tlist = [] | |
def qubit_integrate(self, epsilon, delta, g1, g2, solver): | |
import qutip |
This file contains 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 DifferentialEquations | |
L = 4; | |
U=0.1; Δ=0.1; J=0.45; F=1.57; | |
u₀ = fill(0.2+0.2im, L, 1); | |
Jmat = J.*(diagm(linspace(1,1,L-1),1)+diagm(linspace(1,1,L-1),-1)); | |
function ff(dα,α,p,t) | |
dα[:] = (-im*(Δ - U*(α .* conj(α) - 1.0)) - 1/2.0).*α + im*F -im.*(Jmat*α); | |
end | |
function gg(dα, α, p, t) |
This file contains 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 Distributed, Random | |
addprocs(3) | |
@everywhere module Test | |
using Distributed, Random | |
# My custom weight class, a vector with a couple of views into itself | |
struct Weights{T} <: AbstractVector{T} | |
weights::Vector{T} | |
a::AbstractVector{T} |
This file contains 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 LightGraphs, MetaGraphs, GraphPlot, DataStructures | |
# Create the structures I need... | |
function create_graph() | |
mg = MetaDiGraph(DiGraph()) | |
stack = Stack{Any}() | |
ssastack = Stack{Any}() | |
# Add a dictionary holding all global references | |
set_prop!(mg, :global_refs, Dict()) |
This file contains 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
export minresqlp_iterable, minresqlp, minresqlp! | |
using Printf | |
import LinearAlgebra: BLAS.axpy!, givensAlgorithm | |
import Base: iterate | |
mutable struct MINRESQLPIterable{matT, solT, vecT <: DenseVector, shiftT<: Number, realT <: Real} | |
A::matT | |
shift::shiftT | |
skew_hermitian::Bool | |
x::solT |
This file contains 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 TensorBoardLogger, Logging, ValueHistories | |
function read_event(f::IOStream) | |
header = read(f, 8) | |
crc_header = read(f, 4) | |
# check | |
crc_header_ck = reinterpret(UInt8, UInt32[TensorBoardLogger.masked_crc32c(header)]) | |
@assert crc_header == crc_header_ck |
This file contains 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 Zygote | |
using LinearAlgebra, Statistics | |
# Create a state of index i | |
function make_state(i, Nsites) | |
@assert i<=2^Nsites && i>0 | |
i = i-1 | |
v = Zygote.Buffer(zeros(ComplexF64, Nsites)) | |
for j=1:Nsites | |
i, loc = divrem(i,2) |
This file contains 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
module QuantumOptics | |
using TimerOutputs | |
to = TimerOutput() | |
@timeit to "using" using SparseArrays, LinearAlgebra | |
export bases, Basis, GenericBasis, CompositeBasis, basis, | |
tensor, ⊗, permutesystems, @samebases, | |
states, StateVector, Bra, Ket, basisstate, norm, |
This file contains 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 UnsafeArrays | |
struct ThreadsCommunicator{A,B,C} | |
status::A | |
passthrough::B | |
nthreads::C | |
end | |
function ThreadsCommunicator() | |
return ThreadsCommunicator( |
OlderNewer