Author: henry

  • Package Development in Julia

    Start out by developing as a simple set of files to be included, say “/home/henry/devel/MyCode.jl” use by calling: julia> include(“/home/henry/devel/MyCode.jl”) When ready to make it a real package Create a git repo with the name of the package, e.g. “MyPkg”, in ‘~/.julia/dev’: cd /home/henry/.julia/dev julia> generate MyPkg cd MyPkg git init git add -A git…

  • Julia for Python Developers

    If you’re a long-time python developer, an hour should be all the time you need to get up to speed with julia too. Here are notes that I’ve used to onboard python coders in the past (I may fill in more details over time). REPL ? (-> docstrings) Tab-completion (-> Unicode) end vs indentation JIT…

  • QR Decomposition

    The different algorithms to compute the QR algorithm can be easily remembered according to this scheme: Either, one thinks about creating the Q matrix from the initial matrix A. The simplest approach is then to go through the columns and orthogonalize them against all previous ones. Because this means that the first column in A…

  • Davidson’s Algorithm

    A common problem in Quantum Chemistry is the computation of select eigenvalues of a matrix. This problem can be solved much more cheaply than by complete diagonalization if the number of required eigenvalues is reasonably small. The Theory A great account of the theory of iterative projection methods can be found in the book “Templates…

  • Mutability (and Performance) in julia

    A common source of confusion when beginning julia is the idea of mutability and its performance implications. People tend to confuse semantics and implementation. So, because the Docs state An object with an immutable type is passed around (both in assignment statements and in function calls) by copying, whereas a mutable type is passed around…

  • julia: print, show, display, dump, … – What to override? What to use?

    The julia language has quite a few functions to show information about an object to the user. While the output is often similar, it is not exactly the same with each of these methods. The official documentation is still missing a cohesive description of I/O functions, so I went through some of the julia base…

  • Abstract and Parametric Types in Julia

    Introduction When I first started using Julia, I thought I should write my code as generic as possible using abstract types whereever I could so that no matter whether users would like to use my functions with floating point precision or with exact rationals, they could do so and obtain the corresponding result. Later I…

  • Understanding julia Allocations

    When considering the allocations needed for a few julia functions I was kind of surprised of my original findings. First of all, @time and @allocated very often don’t yield the same result. Which one is more reliable? That’s an easy one once you find out that @allocated actually wraps the function  to measure into another…

  • Inception Pattern – Dream within a dream …

    QuantumLab is meant less as an high performance machinery, as it is a place for experimentation. As such we want to be able to swap in and out terms and implementations easily and effortlessly while still keeping the code readable. This is where the inception pattern, as I call it, comes in. Especial thanks to…

  • Privateer Pattern

    The aim of the privateer pattern is to be able to develop julia code in a separate branch synchronised over several computers without giving information away to the official github repository. This is a means to be able to develop unpublished algorithms. It should however not become a stable solution as it decreases mergability: Merge…