-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support matrix-valued forward recurrence (#14)
* Support dims keywords for matrix coefficients, Mutate first argument * Add tests * Support matrix-valued forward recurrence * Make polynomialtype take just coeffs and var types * Update forward.jl * Update Project.toml
- Loading branch information
1 parent
26cda4b
commit 8bdd81c
Showing
5 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "RecurrenceRelationships" | ||
uuid = "807425ed-42ea-44d6-a357-6771516d7b2c" | ||
authors = ["Sheehan Olver <[email protected]>"] | ||
version = "0.2.0-dev" | ||
version = "0.2.0" | ||
|
||
[weakdeps] | ||
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
module RecurrenceRelationshipsLinearAlgebraExt | ||
using RecurrenceRelationships, LinearAlgebra | ||
|
||
import RecurrenceRelationships: olver | ||
import RecurrenceRelationships: olver, forwardrecurrence! | ||
|
||
olver(T::Tridiagonal, f, n...; kwds...) = olver(T.dl, T.d, T.du, f, n...; kwds...) | ||
olver(T::SymTridiagonal, f, n...; kwds...) = olver(T.ev, T.dv, T.ev, f, n...; kwds...) | ||
|
||
function forwardrecurrence!(v::AbstractVector{T}, A::AbstractVector, B::AbstractVector, C::AbstractVector, x::AbstractMatrix, p0=one(x)) where T | ||
N = length(v) | ||
N == 0 && return v | ||
length(A)+1 ≥ N && length(B)+1 ≥ N && length(C)+1 ≥ N || throw(ArgumentError("A, B, C must contain at least $(N-1) entries")) | ||
p1 = convert(T, N == 1 ? p0 : muladd(A[1],x,B[1]*I)*p0) # avoid accessing A[1]/B[1] if empty | ||
forwardrecurrence!(v, A, B, C, x, convert(T, p0), p1) | ||
end | ||
|
||
|
||
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
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
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