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 LinearAlgebra, LoopVectorization | |
function error_norm(u::AbstractArray{T}, v::AbstractArray{T}) where T | |
result = T(0) | |
@avx for i = eachindex(u) | |
result += (u[i] - v[i])^2 | |
end | |
return sqrt(result) |
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 SIMDPirates | |
canonicalize(A) = A | |
canonicalize(A::Union{<:SubArray}) = canonicalize(parent(A)) | |
function version_1!(B::AbstractMatrix{Float64}, A::AbstractMatrix{Float64}) | |
m, n = size(A) | |
Ac = canonicalize(A) |
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 LinearAlgebra: givensAlgorithm, SymTridiagonal, I, Diagonal | |
using Base: @propagate_inbounds | |
import LinearAlgebra: lmul!, rmul! | |
import Base: Matrix | |
@propagate_inbounds is_offdiagonal_small(H::SymTridiagonal{T}, i::Int, tol = eps(real(T))) where {T} = | |
abs(H.ev[i]) ≤ tol*(abs(H.dv[i]) + abs(H.dv[i+1])) | |
abstract type SmallRotation end |
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 LinearAlgebra: givensAlgorithm, SymTridiagonal, I, Diagonal | |
using Base: @propagate_inbounds | |
import LinearAlgebra: lmul!, rmul! | |
import Base: Matrix | |
@propagate_inbounds is_offdiagonal_small(H::SymTridiagonal{T}, i::Int, tol = eps(real(T))) where {T} = | |
abs(H.ev[i]) ≤ tol*(abs(H.dv[i]) + abs(H.dv[i+1])) | |
abstract type SmallRotation end |
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 SIMD | |
using BenchmarkTools | |
using Test | |
struct Rot{T} | |
c::T | |
s::T | |
end | |
mul(G::Rot, a, b) = (G.c * a + G.s * b, -G.s * a + G.c * b) |
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: getindex, setindex, length, isless | |
struct SortPair{A,B} | |
x::A | |
mapped::B | |
end | |
struct SortCache{A,B,AV,BV} <: AbstractVector{SortPair{A,B}} | |
xs::AV | |
mapped::BV |
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 PrimeMonstrosity | |
const bit_1 = ~(0x01 << 7) | |
const bit_2 = ~(0x01 << 6) | |
const bit_3 = ~(0x01 << 5) | |
const bit_4 = ~(0x01 << 4) | |
const bit_5 = ~(0x01 << 3) | |
const bit_6 = ~(0x01 << 2) | |
const bit_7 = ~(0x01 << 1) | |
const bit_8 = ~(0x01 << 0) |
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
Bluetooth monitor ver 5.50 | |
= Note: Linux version 5.0.0-25-generic (x86_64) 0.401834 | |
= Note: Bluetooth subsystem version 2.22 0.401835 | |
= New Index: 80:C5:F2:F8:D6:54 (Primary,USB,hci0) [hci0] 0.401836 | |
@ MGMT Open: btmon (privileged) version 1.14 {0x0001} 0.401851 | |
= bluetoothd: Bluetooth daemon 5.50 3.341004 | |
@ MGMT Open: bluetoothd (privileged) version 1.14 {0x0002} 3.342105 | |
= bluetoothd: Starting SDP server 3.342212 | |
= bluetoothd: Excluding (cli) wiimote 3.342323 | |
@ MGMT Command: Read Management Version In.. (0x0001) plen 0 {0x0002} 3.343725 |
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 <iostream> | |
#include <vector> | |
#include <string> | |
#include <tuple> | |
using namespace std; | |
// Some instances of events; we're using "public" const data members. | |
struct UsernameChanged { | |
string const username; |
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
// Computes y <- alpha * A * x + beta * y for tall and skinny A. | |
// Compile with `nvcc -O3 -o cerfacs cerfacs.cu` | |
// Assumes we have a *large* basis of COLS = 100 columns, you can play with this param | |
// Timing is measured without copies from / to device (copies should not happen in a good impl of arnoldi anyways) | |
// Assumes a fixed number of 256 threads per block. | |
#include <stdio.h> | |
#include <sys/time.h> | |
#define COLS 100 |