11module HyperDualNumbersExt
22
33using HyperDualNumbers: Hyper
4- using Octavian: ArrayInterface,
5- @turbo , @tturbo ,
6- One, Zero,
7- indices, static
4+ using Octavian: ArrayInterface, @turbo , @tturbo , One, Zero, indices, static
85import Octavian: real_rep, _matmul!, _matmul_serial!
96
107real_rep (a:: AbstractArray{DualT} ) where {T,DualT<: Hyper{T} } =
@@ -23,7 +20,7 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
2320 nthread:: Nothing = nothing ,
2421 MKN = nothing ,
2522 contig_axis = nothing
26- ) where {T, DualT<: Hyper{T} }
23+ ) where {T,DualT<: Hyper{T} }
2724 B = real_rep (_B)
2825 C = real_rep (_C)
2926
@@ -52,9 +49,9 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
5249 MKN = nothing
5350 ) where {T,DualT<: Hyper{T} }
5451 if Bool (ArrayInterface. is_dense (_C)) &&
55- Bool (ArrayInterface. is_column_major (_C)) &&
56- Bool (ArrayInterface. is_dense (_A)) &&
57- Bool (ArrayInterface. is_column_major (_A))
52+ Bool (ArrayInterface. is_column_major (_C)) &&
53+ Bool (ArrayInterface. is_dense (_A)) &&
54+ Bool (ArrayInterface. is_column_major (_A))
5855 # we can avoid the reshape and call the standard method
5956 A = reinterpret (T, _A)
6057 C = reinterpret (T, _C)
@@ -93,9 +90,9 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
9390 C = real_rep (_C)
9491 B = real_rep (_B)
9592 if Bool (ArrayInterface. is_dense (_C)) &&
96- Bool (ArrayInterface. is_column_major (_C)) &&
97- Bool (ArrayInterface. is_dense (_A)) &&
98- Bool (ArrayInterface. is_column_major (_A))
93+ Bool (ArrayInterface. is_column_major (_C)) &&
94+ Bool (ArrayInterface. is_dense (_A)) &&
95+ Bool (ArrayInterface. is_column_major (_A))
9996 # we can avoid the reshape and call the standard method
10097 Ar = reinterpret (T, _A)
10198 Cr = reinterpret (T, _C)
@@ -139,7 +136,7 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
139136 α,
140137 β,
141138 MKN
142- ) where {T, DualT<: Hyper{T} }
139+ ) where {T,DualT<: Hyper{T} }
143140 B = real_rep (_B)
144141 C = real_rep (_C)
145142
@@ -157,7 +154,7 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
157154 _C
158155 end
159156
160- # multiplication of dual matrix by standard vector/matrix from the right
157+ # multiplication of dual matrix by standard vector/matrix from the right
161158 @eval @inline function _matmul_serial! (
162159 _C:: $ (AbstractVectorOrMatrix){DualT},
163160 _A:: AbstractMatrix{DualT} ,
@@ -167,9 +164,9 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
167164 MKN
168165 ) where {T,DualT<: Hyper{T} }
169166 if Bool (ArrayInterface. is_dense (_C)) &&
170- Bool (ArrayInterface. is_column_major (_C)) &&
171- Bool (ArrayInterface. is_dense (_A)) &&
172- Bool (ArrayInterface. is_column_major (_A))
167+ Bool (ArrayInterface. is_column_major (_C)) &&
168+ Bool (ArrayInterface. is_dense (_A)) &&
169+ Bool (ArrayInterface. is_column_major (_A))
173170 # we can avoid the reshape and call the standard method
174171 A = reinterpret (T, _A)
175172 C = reinterpret (T, _C)
@@ -201,14 +198,14 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
201198 α,
202199 β,
203200 MKN
204- ) where {T, DualT<: Hyper{T} }
201+ ) where {T,DualT<: Hyper{T} }
205202 A = real_rep (_A)
206203 C = real_rep (_C)
207204 B = real_rep (_B)
208205 if Bool (ArrayInterface. is_dense (_C)) &&
209- Bool (ArrayInterface. is_column_major (_C)) &&
210- Bool (ArrayInterface. is_dense (_A)) &&
211- Bool (ArrayInterface. is_column_major (_A))
206+ Bool (ArrayInterface. is_column_major (_C)) &&
207+ Bool (ArrayInterface. is_dense (_A)) &&
208+ Bool (ArrayInterface. is_column_major (_A))
212209 # we can avoid the reshape and call the standard method
213210 Ar = reinterpret (T, _A)
214211 Cr = reinterpret (T, _C)
@@ -246,4 +243,4 @@ for AbstractVectorOrMatrix in (:AbstractVector, :AbstractMatrix)
246243 end
247244end # for
248245
249- end # module
246+ end # module
0 commit comments