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/Julia/BeginROPTLIB.jl b/Julia/BeginROPTLIB.jl | |
index ea53bd6..d56b1fc 100644 | |
--- a/Julia/BeginROPTLIB.jl | |
+++ b/Julia/BeginROPTLIB.jl | |
@@ -2,12 +2,12 @@ | |
using Cxx | |
# to the path of ROPTLIB | |
-cd("/home/whuang/Documents/ROPTLIB") | |
+cd("/home/antoine/ROPTLIB") |
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
(gdb) bt | |
#0 0x00007ffff6bf3428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 | |
#1 0x00007ffff6bf502a in __GI_abort () at abort.c:89 | |
#2 0x00007ffff6c357ea in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff6d4ee98 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 | |
#3 0x00007ffff6c3b814 in malloc_printerr (action=<optimized out>, str=0x7ffff6d4eee0 "corrupted double-linked list (not small)", ptr=<optimized out>, | |
ar_ptr=<optimized out>) at malloc.c:5006 | |
#4 0x00007ffff6c40b54 in _int_malloc (av=av@entry=0x7ffff6f82b20 <main_arena>, bytes=bytes@entry=88) at malloc.c:3727 | |
#5 0x00007ffff6c42184 in __GI___libc_malloc (bytes=88) at malloc.c:2913 | |
#6 0x00007ffff4a80e78 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | |
#7 0x00007ffff52a39c1 in llvm::User::operator new(unsigned long, unsigned int) () from /home/antoine/julia-0.6.0/usr/bin/../lib/libLLVM-3.9.so |
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 BenchmarkTools | |
BLAS.set_num_threads(1) | |
function BLAS2(A,x) | |
A*x | |
end | |
function loop_mn(A,x) | |
m,n = size(A) | |
y = zeros(m) | |
@inbounds @simd for i=1: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
function build_A(κ) | |
N = length(κ) | |
A = zeros(N,N) | |
for n=2:N-2 | |
# A[n,n] = 2*κ[n] | |
# A[n,n+1] = 1/4*(κ[n-1] - κ[n+1] - 4κ[n]) | |
# A[n+1,n] = 1/4*(κ[n+2] - κ[n] - 4κ[n+1]) | |
#Reference case: we know that AK is symmetric with K = diag(1/κ) | |
A[n,n] = -2*(κ[n+1] + κ[n-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
module Anderson | |
export anderson | |
function anderson(g,x0,m::Int,niter::Int,eps::Real,warming=0) | |
@assert length(size(x0)) == 1 #1D array input | |
N = size(x0,1) | |
T = eltype(x0) | |
#xs: ring buffer storing the iterates, from newest to oldest | |
xs = zeros(T,N,m+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
n = 100 | |
A = randn(n,n) | |
A = A'A + I | |
b = randn(n) | |
f(x) = vecdot(x,A*x)/2 - vecdot(b,x) | |
g(x) = A*x-b | |
g!(stor,x) = copy!(stor,g(x)) | |
x0 = randn(n) |
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 Optim | |
struct Box <: Optim.Manifold | |
min | |
max | |
end | |
import Optim.retract! | |
import Optim.project_tangent! | |
retract!(B::Box, x) = (x .= min.(B.max,max.(B.min, x))) | |
function project_tangent!(B::Box,g,x) | |
for i in eachindex(x) |
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 StaticArrays | |
using PyPlot | |
const gap = 0.0 # gap at the Dirac points. 0 for graphene | |
const n = 80 # number of k point per direction | |
const t2 = 0.0 | |
#http://www-personal.umich.edu/~sunkai/teaching/Fall_2014/Chapter6.pdf | |
# K = 1/3,-1/3 |
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/share/julia/stdlib/v1.0/REPL/src/REPLCompletions.jl b/share/julia/stdlib/v1.0/REPL/src/REPLCompletions.jl | |
index 3a3e507..5b1db55 100644 | |
--- a/share/julia/stdlib/v1.0/REPL/src/REPLCompletions.jl | |
+++ b/share/julia/stdlib/v1.0/REPL/src/REPLCompletions.jl | |
@@ -696,7 +696,47 @@ function completions(string, pos, context_module=Main)::Completions | |
s = string[startpos:pos] | |
end | |
end | |
+ | |
+ # Completion of strings like si(1.0) with pos after si should only |
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 |
OlderNewer