@@ -5,9 +5,21 @@ import Base: asin, acos, atan, acot, asec, acsc, asinh, acosh, atanh, acoth, ase
55import Base: sinc, cosc
66import Base: + , - , * , / , \ , ^ , > , < , >= , <= , ==
77import Base: hypot, max, min
8+ import Base: zero, one, adjoint, conj, transpose
9+
10+ using Base: tail
811
912# Unary
1013
14+ @inline zero (:: Type{TaylorScalar{T, N}} ) where {T, N} = TaylorScalar {T, N} (zero (T))
15+ @inline one (:: Type{TaylorScalar{T, N}} ) where {T, N} = TaylorScalar {T, N} (one (T))
16+ @inline zero (:: TaylorScalar{T, N} ) where {T, N} = zero (TaylorScalar{T, N})
17+ @inline one (:: TaylorScalar{T, N} ) where {T, N} = one (TaylorScalar{T, N})
18+
19+ transpose (t:: TaylorScalar ) = t
20+ adjoint (t:: TaylorScalar ) = t
21+ conj (t:: TaylorScalar ) = t
22+
1123# # Delegated
1224
1325@inline sqrt (t:: TaylorScalar ) = t^ 0.5
113125 ex = :($ ex; TaylorScalar ($ ([Symbol (' v' , i) for i in 1 : N]. .. )))
114126 return :(@inbounds $ ex)
115127end
116- @inline * (a:: TaylorScalar{T1, N} , b:: TaylorScalar{T2, N} ) where {T1,T2,N} = * (promote (a,b)... )
117- @inline / (a:: TaylorScalar{T1, N} , b:: TaylorScalar{T2, N} ) where {T1,T2,N} = * (promote (a,b)... )
128+ @inline function * (a:: TaylorScalar{T1, N} , b:: TaylorScalar{T2, N} ) where {T1, T2, N}
129+ * (promote (a, b)... )
130+ end
131+ @inline function / (a:: TaylorScalar{T1, N} , b:: TaylorScalar{T2, N} ) where {T1, T2, N}
132+ * (promote (a, b)... )
133+ end
118134
119135for R in (Integer, Real)
120136 @eval @generated function ^ (t:: TaylorScalar{T, N} , n:: S ) where {S <: $R , T, N}
0 commit comments