Skip to content

Commit

Permalink
passing isstrided for BlockGramians for efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianAment committed Apr 11, 2022
1 parent 680f2b7 commit 2ca6833
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.BlockFactorizations]]
deps = ["LinearAlgebra", "Test"]
git-tree-sha1 = "d9063bd637e50ecba604a00691434b161076459c"
git-tree-sha1 = "0abb1500c57376d219d58492c833de3c7a949b80"
uuid = "5c499583-5bfe-4591-9b59-c1e192d48697"
version = "1.1.0"
version = "1.2.0"

[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra", "SparseArrays"]
Expand Down Expand Up @@ -192,9 +192,9 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[deps.LogExpFunctions]]
deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"]
git-tree-sha1 = "58f25e56b706f95125dcb796f39e1fb01d913a71"
git-tree-sha1 = "a7e100b068a6cbead98b9f4e5c8b488934b7aea0"
uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
version = "0.3.10"
version = "0.3.11"

[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CovarianceFunctions"
uuid = "b3329135-7958-41d4-bb02-e084c5a526bf"
authors = ["sebastianament"]
version = "0.2.2"
version = "0.2.3"

[deps]
BlockFactorizations = "5c499583-5bfe-4591-9b59-c1e192d48697"
Expand All @@ -22,7 +22,7 @@ ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"
WoodburyFactorizations = "9f1bac23-581c-4ebc-bd36-df60d764636d"

[compat]
BlockFactorizations = "1.1"
BlockFactorizations = "1.2"
DiffResults = "1.0"
FillArrays = "0.12, 0.13"
ForwardDiff = "0.10"
Expand Down
4 changes: 2 additions & 2 deletions src/gramian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ end
# by default, Gramians of matrix-valued kernels are BlockFactorizations, O(1) memory complexity
function gramian(k::MultiKernel, x::AbstractVector, y::AbstractVector, lazy::Val{true} = Val(true))
G = Gramian(k, x, y)
BlockFactorization(G)
BlockFactorization(G, isstrided = true) # strided because every block has same size
end

# instantiates the blocks but respects structure O(n^2d) memory complexity for gradient kernel
function gramian(k::MultiKernel, x::AbstractVector, y::AbstractVector, lazy::Val{false})
G = Gramian(k, x, y)
G = Matrix(G)
BlockFactorization(G)
BlockFactorization(G, isstrided = true)
end

LinearAlgebra.issymmetric(G::Gramian) = (G.x G.y) || (G.x == G.y) # pointer check is constant time
Expand Down

0 comments on commit 2ca6833

Please sign in to comment.