Skip to content

Commit

Permalink
placed methods for jacobian
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Apr 28, 2018
1 parent 5191e43 commit a656e62
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ReduceLinAlg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit a656e62

Please sign in to comment.