diff --git a/src/ReduceLinAlg.jl b/src/ReduceLinAlg.jl index e0f72d0..9eabf56 100644 --- a/src/ReduceLinAlg.jl +++ b/src/ReduceLinAlg.jl @@ -7,8 +7,12 @@ import Compat.String # This file is part of ReduceLinAlg.jl. It is licensed under the MIT license # Copyright (C) 2018 Michael Reed +const VectorAny = Union{Vector,RowVector} +import Reduce: parse_calculus, treecombine!, irr + const lin = [ :hessian, + :mat_jacobian ] :(export $(lin...)) |> eval @@ -28,7 +32,13 @@ for fun in lin end end -hessian(r::Reduce.ExprSymbol,l::T) where T <: Union{Vector,RowVector} = hessian(r,list(l)) +hessian(r::Reduce.ExprSymbol,l::T) where T <: VectorAny = hessian(r,list(l)) + +function mat_jacobian(r::T,v::S) where T <: VectorAny where S <: VectorAny + mat_jacobian(list(r),list(v)) |> parse +end + +jacobian = mat_jacobian function __init__() load_package(:linalg)