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 LinearAlgebra | |
function ortho(X) | |
Array(qr(X).Q) | |
end | |
function align(X,Y) | |
# returns an orthogonal combination X * c with c unitary such that X*c is closest to Y | |
proj = X'Y |
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 LinearAlgebra | |
function ortho(X) | |
Array(qr(X).Q) | |
end | |
function align(X,Y) | |
# returns an orthogonal combination X * c with c unitary such that X*c is closest to Y | |
proj = X'Y |
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
diff --git a/src/solvers/anderson.jl b/src/solvers/anderson.jl | |
index 0d47b6a..60dc122 100644 | |
--- a/src/solvers/anderson.jl | |
+++ b/src/solvers/anderson.jl | |
@@ -42,8 +42,8 @@ AndersonCache(df, ::Anderson{0}) = | |
@views function anderson_(df::Union{NonDifferentiable, OnceDifferentiable}, | |
initial_x::AbstractArray{T}, | |
- xtol::T, | |
- ftol::T, |
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 LinearAlgebra.BLAS | |
const libblas = Base.libblas_name | |
const liblapack = Base.liblapack_name | |
import LinearAlgebra | |
import LinearAlgebra: BlasReal, BlasComplex, BlasFloat, BlasInt, DimensionMismatch, checksquare, stride1, chkstride1, axpy! | |
import Libdl |
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 LinearAlgebra.BLAS | |
const libblas = Base.libblas_name | |
const liblapack = Base.liblapack_name | |
import LinearAlgebra | |
import LinearAlgebra: BlasReal, BlasComplex, BlasFloat, BlasInt, DimensionMismatch, checksquare, stride1, chkstride1, axpy! | |
import Libdl |
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
(require 'latex nil t) | |
;; Math insertion in julia. Use it with | |
(defun julia-math-insert (s) | |
"Inserts math symbol given by `s'" | |
(when s | |
(let ((sym (gethash (concat "\\" s) julia-latexsubs))) | |
(when sym | |
(insert sym))))) |
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 FFTW | |
const MAX_THREADS = Threads.nthreads() | |
println("$(MAX_THREADS) threads") | |
N = 128 | |
M = 40 | |
println("N=$N, M=$M") |
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 FFTW | |
n = 128 | |
m = 5 | |
X = randn(ComplexF64, n, n, n, m) | |
p = plan_fft!(X, (1, 2, 3)) | |
Y = copy(X) | |
GC.gc() | |
GC.enable(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
## 2D Gross-Pitaevskii equation, with magnetic field, and with | |
## multiple electrons (of course, it doesn't make physical sense, but | |
## why not) | |
## This is pretty WIP, and only serves as a very rough demo. Nothing | |
## has been checked properly, so do not use for any serious purposes. | |
using PyCall | |
using DFTK | |
using Printf |
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
## 2D Gross-Pitaevskii equation, with magnetic field, and with | |
## multiple electrons (of course, it doesn't make physical sense, but | |
## why not) | |
## This is pretty WIP, and only serves as a very rough demo. Nothing | |
## has been checked properly, so do not use for any serious purposes. | |
using PyCall | |
using DFTK | |
using Printf |