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
# apply reflector from right | |
# derived from base/linalg/generic.jl | |
@inline function reflectorApplyRight!(x::AbstractVector, τ::Number, A::AbstractMatrix) | |
m, n = size(A) | |
if length(x) != n | |
throw(DimensionMismatch("reflector has length $(length(x)), which must match the first dimension of matrix A, $n")) | |
end | |
@inbounds begin | |
for i = 1:m | |
# note: ommited x[1] == 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
""" | |
QR decomposition by givens rotations of matrix without pivoting. | |
```math | |
A = Q R | |
``` | |
Thin (reduced) method will produce `Q` and `R` in truncated form, | |
in opposite case `thin=false` Q is full, but R is still reduced, see [`qr`](@ref). | |
""" |
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
K=1 | |
0.403818 seconds (113.14 k allocations: 5.859 MiB) | |
7.123 ns (0 allocations: 0 bytes) | |
775.527 ns (21 allocations: 1.13 KiB) | |
K=2 | |
0.021828 seconds (19.79 k allocations: 1019.997 KiB) | |
12.328 ns (0 allocations: 0 bytes) | |
1.474 μs (21 allocations: 1.22 KiB) | |
K=3 | |
0.036278 seconds (38.94 k allocations: 1.880 MiB) |
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 BenchmarkTools, Compat | |
a = m = 0 | |
for K = 1:18 | |
a = rand(SMatrix{K,K,Float64,K*K}) | |
m = Matrix(a) | |
print("K=$K\n") | |
@time qr(a) | |
@btime qr($a) |
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
const U = Union{Type{Val{true}}, Type{Val{false}}} | |
f1(p::U = Val{false}) = p isa Type{Val{true}} | |
f2(p::U = Val{false}) = p isa Val{true} # false | |
f3(p::U = Val{false}) = p <: Type{Val{true}} # false | |
f4(p::U = Val{false}) = p <: Val{true} | |
f5(p::U = Val{false}) = p === Type{Val{true}} # false | |
f6(p::U = Val{false}) = p === Val{true} | |
f7(p::U = Val{false}) = p == Type{Val{true}} # 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
#!/bin/bash | |
# parse args | |
# args=$(getopt -o i:o:vh --long input:,output:,verbose,help -- "$@") | |
args=$(getopt -o c::g:s:r:o:tvh -l crop::,geom:,scale:,output:,preserve,trim,verbose,help -a -- "$@") | |
if [ $? -ne 0 ]; then | |
echo "Error in args" | |
exit 1 | |
fi |