Skip to content

Commit 340e67d

Browse files
committed
ldiv
1 parent 8ba630a commit 340e67d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/function_call.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
struct FunctionCall{F,A} <: SciMLLinearSolveAlgorithm
2+
func!::F
3+
argsyms::A
4+
5+
function FunctionCall(func!::Function, argsyms::Tuple)
6+
new{typeof(func!), typeof(argsyms)}(func!, argsyms)
7+
end
8+
end
9+
10+
LdivBang2Args() = FunctionCall(ldiv!, (:A, :u))
11+
LdivBang3Args() = FunctionCall(ldiv!, (:u, :A, :b))
12+
13+
function (f::FunctionCall)(cache::LinearCache)
14+
@unpack func!, argsyms = f
15+
args = [getproperty(cache,argsym) for argsym in argsyms]
16+
func!(args...)
17+
end
18+
19+
function SciMLBase.solve(cache::LinearCache, alg::FunctionCall,
20+
args...; kwargs...)
21+
@unpack u, b = cache
22+
copy!(u, b)
23+
alg(cache)
24+
25+
return SciMLBase.build_linear_solution(alg,cache.u,nothing,cache)
26+
end

0 commit comments

Comments
 (0)