{{ message }}

Instantly share code, notes, and snippets.

# Harmen Stoppels haampie

Created Nov 8, 2016
test
View test
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
 0.5258035496409385338996633621320518075577262895034576824436935036190909359484821735511244086357105703763089095001084909503562784106432631780885381833487161441115426324089735535648577478022198173062961599662707079574920200839277886235481421364962201726366096411855900154689889962293083318039904967542464945043705977339467548513433912472348985230682047335936507184327257718362160494751446144883847282407215005669970705901314196397855777633081493954608446354...
Last active Nov 14, 2016
Pell's equation
View pell.txt
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
 3^2 - 2 * 2^2 = 1 9^2 - 5 * 4^2 = 1
Created Dec 3, 2016
Problem 94
View 94.cc
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
 #include #include using pell = std::pair; inline pell next(pell const &solution) { return { 2 * solution.first + 3 * solution.second, 2 * solution.second + solution.first
Created Apr 19, 2016
View inject.js
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
Last active Apr 16, 2017
better_collections.php
View better_collections.php
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
 valid(); \$i++, \$it->next()) { yield \$it->current(); } } function filter(Iterator \$it, callable \$f) { foreach (\$it as \$item) {
Last active Jun 10, 2017
More efficient GMRES
View gmres.jl
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 BenchmarkTools using IterativeSolvers module GMRES using Base.LinAlg.axpy! function gmres(A, b; outer::Int = 5, restart::Int = 20, tol = sqrt(eps(real(eltype(b))))) T = eltype(b)
Created Jun 15, 2017
reorthogonalization.jl
View reortho.jl
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
 import Base.LinAlg.BlasFloat import Base.LinAlg.BLAS: gemv!, gemv, axpy! using BenchmarkTools function classical_gram_schmidt!{T<:BlasFloat}(V::StridedMatrix{T}, w::StridedVector{T}) # orthogonalize h = gemv('T', one(T), V, w) gemv!('N', -one(T), V, h, one(T), w)
Created Jul 5, 2017
3d
View 3d.jl
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
 function literature_example() # Problem: Δu + 1000uₓ = f # u = 0 on the boundaries # f(x, y, z) = exp(xyz) sin(πx) sin(πy) sin(πz) # 2nd order central differences (shows serious wiggles) # Unknowns per dimension N = 50 # Total number of unknowns
Created Jul 6, 2017
unsafe.jl
View unsafe.jl
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
 struct UnsafeView{T, N} <: DenseArray{T, N} dim::NTuple{N, Int} ptr::Ptr{T} end const UnsafeVectorView{T} = UnsafeView{T,1} const UnsafeMatrixView{T} = UnsafeView{T,2} @inline Base.size(v::UnsafeView) = v.dim @inline Base.size(v::UnsafeVectorView, idx::Int) = idx == 1 ? v.dim[idx] : 1
Created Aug 9, 2017
Comparison row / column
View jacobi.jl
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
 import Base: start, next, done using BenchmarkTools mutable struct RowJacobi{matT,vecT} A::matT x::vecT next::vecT b::vecT maxiter::Int