Skip to content

Commit

Permalink
feat: support passing arrays of Symbolic to registered functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Oct 16, 2024
1 parent d1cb2d1 commit d69d842
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wrapper-types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ function wrap_func_expr(mod, expr, wrap_arrays = true)
(elT) -> :(AbstractArray{T} where {T <: $elT})
end
if has_symwrapper(eT)
Ts = (Ts..., # _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT})),
Ts = (Ts..., _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT})),
_arr_type_fn(wrapper_type(eT)))
# else
# Ts = (Ts..., _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT})))
else
Ts = (Ts..., _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT})))
end
end
Ts
Expand Down
8 changes: 8 additions & 0 deletions test/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ let
@test eltype(gg) == Real
@test symtype(unwrap(gg)) == SymMatrix{Real, 2}
@test promote_symtype(ggg, Vector{symtype(typeof(a))}) == Any

_a = unwrap(a)
gg = ggg([_a, 2_a])
@test ndims(gg) == 2
@test size(gg) == (4, 4)
@test eltype(gg) == Real
@test symtype(unwrap(gg)) == SymMatrix{Real, 2}
@test promote_symtype(ggg, Vector{symtype(typeof(a))}) == Any
end
let
# redefine with promote_symtype
Expand Down

0 comments on commit d69d842

Please sign in to comment.