Skip to content

Commit

Permalink
bump major version
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhang314 committed Aug 27, 2024
1 parent 098d8c7 commit 2f8d5cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 320 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RungeKuttaToolKit"
uuid = "5ccfa5ee-da33-4844-afab-33f13f6d8736"
authors = ["David K. Zhang <[email protected]>"]
version = "1.0.0"
version = "2.0.0"

[deps]
MultiFloats = "bdf0d083-296b-4888-a5b6-7498122e68a5"
Expand All @@ -10,4 +10,5 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
MultiFloats = "2.0"
StatsBase = "^0"
julia = "1.0"
318 changes: 0 additions & 318 deletions src/RungeKuttaToolKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1144,322 +1144,4 @@ function reshape_implicit!(
end


############################################################## FUNCTOR INTERFACE


# function populate_Q!(
# Q::AbstractMatrix{T}, Phi::AbstractMatrix{T},
# selected_indices::AbstractVector{Int}
# ) where {T}
# t, s = size(Q)
# @assert s == size(Phi, 1)
# @assert (t,) == size(selected_indices)
# for (i, k) in pairs(selected_indices)
# @simd ivdep for j = 1:s
# @inbounds Q[i, j] = Phi[j, k]
# end
# end
# end


# function (ev::RKOCEvaluatorAE{T})(x::Vector{T}) where {T}
# reshape_explicit!(ev.A, x)
# compute_Phi!(ev.Phi, ev.A, ev.table.instructions)
# populate_Q!(ev.Q, ev.Phi, ev.table.selected_indices)
# gram_schmidt_qr!(ev.Q)
# compute_residuals!(ev.residuals, ev.Q, ev.inv_gamma)
# return residual_norm_squared(ev.residuals)
# end


# function (ev::RKOCEvaluatorAD{T})(x::Vector{T}) where {T}
# reshape_diagonally_implicit!(ev.A, x)
# compute_Phi!(ev.Phi, ev.A, ev.table.instructions)
# populate_Q!(ev.Q, ev.Phi, ev.table.selected_indices)
# gram_schmidt_qr!(ev.Q)
# compute_residuals!(ev.residuals, ev.Q, ev.inv_gamma)
# return residual_norm_squared(ev.residuals)
# end


# function (ev::RKOCEvaluatorAI{T})(x::Vector{T}) where {T}
# reshape_implicit!(ev.A, x)
# compute_Phi!(ev.Phi, ev.A, ev.table.instructions)
# populate_Q!(ev.Q, ev.Phi, ev.table.selected_indices)
# gram_schmidt_qr!(ev.Q)
# compute_residuals!(ev.residuals, ev.Q, ev.inv_gamma)
# return residual_norm_squared(ev.residuals)
# end


# function (ev::RKOCResidualEvaluatorAE{T})(
# residuals::Vector{T}, x::Vector{T}
# ) where {T}
# reshape_explicit!(ev.A, x)
# compute_Phi!(ev.Phi, ev.A, ev.table.instructions)
# populate_Q!(ev.Q, ev.Phi, ev.table.selected_indices)
# gram_schmidt_qr!(ev.Q)
# compute_residuals!(residuals, ev.Q, ev.inv_gamma)
# return residuals
# end


# function (ev::RKOCResidualEvaluatorAD{T})(
# residuals::Vector{T}, x::Vector{T}
# ) where {T}
# reshape_diagonally_implicit!(ev.A, x)
# compute_Phi!(ev.Phi, ev.A, ev.table.instructions)
# populate_Q!(ev.Q, ev.Phi, ev.table.selected_indices)
# gram_schmidt_qr!(ev.Q)
# compute_residuals!(residuals, ev.Q, ev.inv_gamma)
# return residuals
# end


# function (ev::RKOCResidualEvaluatorAI{T})(
# residuals::Vector{T}, x::Vector{T}
# ) where {T}
# reshape_implicit!(ev.A, x)
# compute_Phi!(ev.Phi, ev.A, ev.table.instructions)
# populate_Q!(ev.Q, ev.Phi, ev.table.selected_indices)
# gram_schmidt_qr!(ev.Q)
# compute_residuals!(residuals, ev.Q, ev.inv_gamma)
# return residuals
# end


# function (adj::RKOCEvaluatorAEAdjoint{T})(g::Vector{T}, x::Vector{T}) where {T}
# reshape_explicit!(adj.ev.A, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# populate_Q!(adj.ev.Q, adj.ev.Phi, adj.ev.table.selected_indices)
# gram_schmidt_qr!(adj.ev.Q, adj.ev.R)
# compute_residuals_and_b!(adj.ev.residuals, adj.ev.b,
# adj.ev.Q, adj.ev.inv_gamma)
# solve_upper_triangular!(adj.ev.b, adj.ev.R)
# pullback_dPhi_from_residual!(adj.ev.dPhi,
# adj.ev.b, adj.ev.residuals, adj.ev.table.source_indices)
# pullback_dPhi!(adj.ev.dPhi,
# adj.ev.A, adj.ev.Phi, adj.ev.table.extension_indices,
# adj.ev.table.rooted_sum_ranges, adj.ev.table.rooted_sum_indices)
# pullback_dA!(adj.ev.dA,
# adj.ev.Phi, adj.ev.dPhi, adj.ev.table.extension_indices)
# reshape_explicit!(g, adj.ev.dA)
# return g
# end


# function (adj::RKOCEvaluatorADAdjoint{T})(g::Vector{T}, x::Vector{T}) where {T}
# reshape_diagonally_implicit!(adj.ev.A, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# populate_Q!(adj.ev.Q, adj.ev.Phi, adj.ev.table.selected_indices)
# gram_schmidt_qr!(adj.ev.Q, adj.ev.R)
# compute_residuals_and_b!(adj.ev.residuals, adj.ev.b,
# adj.ev.Q, adj.ev.inv_gamma)
# solve_upper_triangular!(adj.ev.b, adj.ev.R)
# pullback_dPhi_from_residual!(adj.ev.dPhi,
# adj.ev.b, adj.ev.residuals, adj.ev.table.source_indices)
# pullback_dPhi!(adj.ev.dPhi,
# adj.ev.A, adj.ev.Phi, adj.ev.table.extension_indices,
# adj.ev.table.rooted_sum_ranges, adj.ev.table.rooted_sum_indices)
# pullback_dA!(adj.ev.dA,
# adj.ev.Phi, adj.ev.dPhi, adj.ev.table.extension_indices)
# reshape_diagonally_implicit!(g, adj.ev.dA)
# return g
# end


# function (adj::RKOCEvaluatorAIAdjoint{T})(g::Vector{T}, x::Vector{T}) where {T}
# reshape_implicit!(adj.ev.A, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# populate_Q!(adj.ev.Q, adj.ev.Phi, adj.ev.table.selected_indices)
# gram_schmidt_qr!(adj.ev.Q, adj.ev.R)
# compute_residuals_and_b!(adj.ev.residuals, adj.ev.b,
# adj.ev.Q, adj.ev.inv_gamma)
# solve_upper_triangular!(adj.ev.b, adj.ev.R)
# pullback_dPhi_from_residual!(adj.ev.dPhi,
# adj.ev.b, adj.ev.residuals, adj.ev.table.source_indices)
# pullback_dPhi!(adj.ev.dPhi,
# adj.ev.A, adj.ev.Phi, adj.ev.table.extension_indices,
# adj.ev.table.rooted_sum_ranges, adj.ev.table.rooted_sum_indices)
# pullback_dA!(adj.ev.dA,
# adj.ev.Phi, adj.ev.dPhi, adj.ev.table.extension_indices)
# reshape_implicit!(g, adj.ev.dA)
# return g
# end


# function (adj::RKOCResidualEvaluatorAEAdjoint{T})(
# jacobian::Matrix{T}, x::Vector{T}
# ) where {T}
# @assert length(adj.ev.table.selected_indices) == size(jacobian, 1)
# @assert length(x) == size(jacobian, 2)
# reshape_explicit!(adj.ev.A, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# populate_Q!(adj.ev.Q, adj.ev.Phi, adj.ev.table.selected_indices)
# gram_schmidt_qr!(adj.ev.Q, adj.ev.R)
# compute_residuals_and_b!(adj.ev.residuals, adj.ev.b,
# adj.ev.Q, adj.ev.inv_gamma)
# solve_upper_triangular!(adj.ev.b, adj.ev.R)
# s = length(adj.ev.b)
# k = 1
# for i = 2:s
# for j = 1:i-1
# pushforward_dPhi!(adj.ev.dPhi,
# adj.ev.Phi, adj.ev.A, i, j, adj.ev.table.instructions)
# column = view(jacobian, :, k)
# pushforward_db!(adj.ev.db, column,
# adj.ev.residuals, adj.ev.dPhi, adj.ev.b, adj.ev.Q, adj.ev.R,
# adj.ev.table.selected_indices)
# pushforward_dresiduals!(column,
# adj.ev.db, adj.ev.b, adj.ev.dPhi, adj.ev.Phi,
# adj.ev.table.selected_indices)
# k += 1
# end
# end
# return jacobian
# end


# function (adj::RKOCResidualEvaluatorADAdjoint{T})(
# jacobian::Matrix{T}, x::Vector{T}
# ) where {T}
# @assert length(adj.ev.table.selected_indices) == size(jacobian, 1)
# @assert length(x) == size(jacobian, 2)
# reshape_diagonally_implicit!(adj.ev.A, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# populate_Q!(adj.ev.Q, adj.ev.Phi, adj.ev.table.selected_indices)
# gram_schmidt_qr!(adj.ev.Q, adj.ev.R)
# compute_residuals_and_b!(adj.ev.residuals, adj.ev.b,
# adj.ev.Q, adj.ev.inv_gamma)
# solve_upper_triangular!(adj.ev.b, adj.ev.R)
# s = length(adj.ev.b)
# k = 1
# for i = 1:s
# for j = 1:i
# pushforward_dPhi!(adj.ev.dPhi,
# adj.ev.Phi, adj.ev.A, i, j, adj.ev.table.instructions)
# column = view(jacobian, :, k)
# pushforward_db!(adj.ev.db, column,
# adj.ev.residuals, adj.ev.dPhi, adj.ev.b, adj.ev.Q, adj.ev.R,
# adj.ev.table.selected_indices)
# pushforward_dresiduals!(column,
# adj.ev.db, adj.ev.b, adj.ev.dPhi, adj.ev.Phi,
# adj.ev.table.selected_indices)
# k += 1
# end
# end
# return jacobian
# end


# function (adj::RKOCResidualEvaluatorAIAdjoint{T})(
# jacobian::Matrix{T}, x::Vector{T}
# ) where {T}
# @assert length(adj.ev.table.selected_indices) == size(jacobian, 1)
# @assert length(x) == size(jacobian, 2)
# reshape_implicit!(adj.ev.A, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# populate_Q!(adj.ev.Q, adj.ev.Phi, adj.ev.table.selected_indices)
# gram_schmidt_qr!(adj.ev.Q, adj.ev.R)
# compute_residuals_and_b!(adj.ev.residuals, adj.ev.b,
# adj.ev.Q, adj.ev.inv_gamma)
# solve_upper_triangular!(adj.ev.b, adj.ev.R)
# s = length(adj.ev.b)
# k = 1
# for i = 1:s
# for j = 1:s
# pushforward_dPhi!(adj.ev.dPhi,
# adj.ev.Phi, adj.ev.A, i, j, adj.ev.table.instructions)
# column = view(jacobian, :, k)
# pushforward_db!(adj.ev.db, column,
# adj.ev.residuals, adj.ev.dPhi, adj.ev.b, adj.ev.Q, adj.ev.R,
# adj.ev.table.selected_indices)
# pushforward_dresiduals!(column,
# adj.ev.db, adj.ev.b, adj.ev.dPhi, adj.ev.Phi,
# adj.ev.table.selected_indices)
# k += 1
# end
# end
# return jacobian
# end


# function (adj::RKOCResidualEvaluatorBEAdjoint{T})(
# jacobian::Matrix{T}, x::Vector{T}
# ) where {T}
# @assert length(adj.ev.table.selected_indices) == size(jacobian, 1)
# @assert length(x) == size(jacobian, 2)
# reshape_explicit!(adj.ev.A, adj.ev.b, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# s = length(adj.ev.b)
# k = 1
# for i = 2:s
# for j = 1:i-1
# pushforward_dPhi!(adj.ev.dPhi,
# adj.ev.Phi, adj.ev.A, i, j, adj.ev.table.instructions)
# pushforward_dresiduals!(view(jacobian, :, k),
# adj.ev.b, adj.ev.dPhi, adj.ev.table.selected_indices)
# k += 1
# end
# end
# return jacobian
# end


# function (adj::RKOCResidualEvaluatorBDAdjoint{T})(
# jacobian::Matrix{T}, x::Vector{T}
# ) where {T}
# @assert length(adj.ev.table.selected_indices) == size(jacobian, 1)
# @assert length(x) == size(jacobian, 2)
# reshape_diagonally_implicit!(adj.ev.A, adj.ev.b, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# s = length(adj.ev.b)
# k = 1
# for i = 1:s
# for j = 1:i
# pushforward_dPhi!(adj.ev.dPhi,
# adj.ev.Phi, adj.ev.A, i, j, adj.ev.table.instructions)
# pushforward_dresiduals!(view(jacobian, :, k),
# adj.ev.b, adj.ev.dPhi, adj.ev.table.selected_indices)
# k += 1
# end
# end
# for j = 1:s
# for (i, m) in pairs(adj.ev.table.selected_indices)
# @inbounds jacobian[i, k] = adj.ev.Phi[j, m]
# end
# k += 1
# end
# return jacobian
# end


# function (adj::RKOCResidualEvaluatorBIAdjoint{T})(
# jacobian::Matrix{T}, x::Vector{T}
# ) where {T}
# @assert length(adj.ev.table.selected_indices) == size(jacobian, 1)
# @assert length(x) == size(jacobian, 2)
# reshape_implicit!(adj.ev.A, adj.ev.b, x)
# compute_Phi!(adj.ev.Phi, adj.ev.A, adj.ev.table.instructions)
# s = length(adj.ev.b)
# k = 1
# for i = 1:s
# for j = 1:s
# pushforward_dPhi!(adj.ev.dPhi,
# adj.ev.Phi, adj.ev.A, i, j, adj.ev.table.instructions)
# pushforward_dresiduals!(view(jacobian, :, k),
# adj.ev.b, adj.ev.dPhi, adj.ev.table.selected_indices)
# k += 1
# end
# end
# for j = 1:s
# for (i, m) in pairs(adj.ev.table.selected_indices)
# @inbounds jacobian[i, k] = adj.ev.Phi[j, m]
# end
# k += 1
# end
# return jacobian
# end


end # module RungeKuttaToolKit
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Test
const NUMERIC_TYPES = [
Float16, Float32, Float64, BigFloat,
Float64x1, Float64x2, Float64x3, Float64x4,
Float64x5, Float64x6, Float64x7, Float64x8,]
Float64x5, Float64x6, Float64x7, Float64x8]


function maximum_relative_difference(
Expand Down

2 comments on commit 2f8d5cc

@dzhang314
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/113966

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.0.0 -m "<description of version>" 2f8d5cce00d667639dfb331a656c9c9ab399fb8b
git push origin v2.0.0

Please sign in to comment.