76
76
77
77
function clenshaw! (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: Number , ϕ₀:: Number , f:: AbstractVector )
78
78
size (c,2 ) == length (f) || throw (DimensionMismatch (" coeffients size and output length must match" ))
79
- for j in axes (c,2 )
79
+ @inbounds for j in axes (c,2 )
80
80
f[j] = ϕ₀ * clenshaw (view (c,:,j), A, B, C, x)
81
81
end
82
82
f
83
83
end
84
84
85
85
function clenshaw! (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: AbstractVector , ϕ₀:: AbstractVector , f:: AbstractMatrix )
86
86
(size (x,1 ),size (c,2 )) == size (f) || throw (DimensionMismatch (" coeffients size and output length must match" ))
87
- for j in axes (c,2 )
87
+ @inbounds for j in axes (c,2 )
88
88
clenshaw! (view (c,:,j), A, B, C, x, ϕ₀, view (f,:,j))
89
89
end
90
90
f
@@ -188,4 +188,22 @@ function clenshaw(c::AbstractVector, x::Number)
188
188
end
189
189
end
190
190
191
+ function clenshaw! (c:: AbstractMatrix , x:: Number , f:: AbstractVector )
192
+ size (c,2 ) == length (f) || throw (DimensionMismatch (" coeffients size and output length must match" ))
193
+ @inbounds for j in axes (c,2 )
194
+ f[j] = clenshaw (view (c,:,j), x)
195
+ end
196
+ f
197
+ end
198
+
199
+ function clenshaw! (c:: AbstractMatrix , x:: AbstractVector , f:: AbstractMatrix )
200
+ (size (x,1 ),size (c,2 )) == size (f) || throw (DimensionMismatch (" coeffients size and output length must match" ))
201
+ @inbounds for j in axes (c,2 )
202
+ clenshaw! (view (c,:,j), x, view (f,:,j))
203
+ end
204
+ f
205
+ end
206
+
191
207
clenshaw (c:: AbstractVector , x:: AbstractVector ) = clenshaw! (c, copy (x))
208
+ clenshaw (c:: AbstractMatrix , x:: Number ) = clenshaw! (c, x, Vector {promote_type(eltype(c),typeof(x))} (undef, size (c,2 )))
209
+ clenshaw (c:: AbstractMatrix , x:: AbstractVector ) = clenshaw! (c, x, Matrix {promote_type(eltype(c),eltype(x))} (undef, size (x,1 ), size (c,2 )))
0 commit comments