jump-dev / jump-dev/MutableArithmetics.jl
@rewrite for arbitrary operation/function
- Dominant language
- TeX
- Stars
- 55
- Forks
- 15
- Avg merge
- 2d 21m
- Merged PRs (30d)
- 2
Description
Does MutableArithmetics not work for general functions, only for the standard arithmetic operations (+,-,/,*)? I have a mutable type that overrides many of the Base functions (sin, cos, abs, sqrt, csc) as well as some others not in base (sinhc). I'd really like to use this interface and the `@rewrite` macro to speed up evaluation of expressions, but I've found it doesn't work for these functions.
My code for sin for example is
```julia
mutability(::Type{TPS}) = IsMutable()
function promote_operation(::typeof(sin), ::Type{TPS}, ::Type{TPS})
return TPS
end
function operate!(::typeof(sin), a::TPS)
mad_tpsa_sin!(a.tpsa, a.tpsa)
return a
end
function operate_to!(output::TPS, ::typeof(sin), a::TPS)
mad_tpsa_sin!(a.tpsa, output.tpsa)
return output
end
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.