Skip to content

Commit

Permalink
Precompile basic algebra operations (#283)
Browse files Browse the repository at this point in the history
* Precompile basic algebra operations

* Add compat bound
  • Loading branch information
jishnub authored Feb 7, 2023
1 parent c753f40 commit 1009bb9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ version = "0.17.10"
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Aqua = "0.5"
ArrayLayouts = "0.8.14"
Documenter = "0.27"
FillArrays = "0.13"
SnoopPrecompile = "1"
julia = "1.6"

[extras]
Expand Down
1 change: 1 addition & 0 deletions src/BandedMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ include("tribanded.jl")

include("interfaceimpl.jl")

include("precompile.jl")

# function _precompile_()
# precompile(Tuple{typeof(gbmm!), Char, Char, Float64, BandedMatrix{Float64,Array{Float64,2},Base.OneTo{Int64}}, BandedMatrix{Float64,Array{Float64,2},Base.OneTo{Int64}}, Float64, BandedMatrix{Float64,Array{Float64,2},Base.OneTo{Int64}}})
Expand Down
14 changes: 14 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SnoopPrecompile

@precompile_setup begin
vs = ([1.0], Float32[1.0], ComplexF32[1.0], ComplexF64[1.0])
Bs = Any[BandedMatrix(0 => v) for v in vs]
@precompile_all_calls begin
for B in Bs, op in (+, -, *)
op(B, B)
end
for (v, B) in zip(vs, Bs)
B * v
end
end
end

0 comments on commit 1009bb9

Please sign in to comment.