@@ -53,6 +53,13 @@ overwriting `x` with the results.
53
53
clenshaw! (c:: AbstractVector , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: AbstractVector ) =
54
54
clenshaw! (c, A, B, C, x, Ones {eltype(x)} (length (x)), x)
55
55
56
+ clenshaw! (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: Number , f:: AbstractVector ) =
57
+ clenshaw! (c, A, B, C, x, one (eltype (x)), f)
58
+
59
+
60
+ clenshaw! (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: AbstractVector , f:: AbstractMatrix ) =
61
+ clenshaw! (c, A, B, C, x, Ones {eltype(x)} (length (x)), f)
62
+
56
63
57
64
"""
58
65
clenshaw!(c, A, B, C, x, ϕ₀, f)
@@ -67,6 +74,22 @@ function clenshaw!(c::AbstractVector, A::AbstractVector, B::AbstractVector, C::A
67
74
end
68
75
69
76
77
+ function clenshaw! (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: Number , ϕ₀:: Number , f:: AbstractVector )
78
+ size (c,2 ) == length (f) || throw (DimensionMismatch (" coeffients size and output length must match" ))
79
+ for j in axes (c,2 )
80
+ f[j] = ϕ₀ * clenshaw (view (c,:,j), A, B, C, x)
81
+ end
82
+ f
83
+ end
84
+
85
+ function clenshaw! (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: AbstractVector , ϕ₀:: AbstractVector , f:: AbstractMatrix )
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 )
88
+ clenshaw! (view (c,:,j), A, B, C, x, ϕ₀, view (f,:,j))
89
+ end
90
+ f
91
+ end
92
+
70
93
Base. @propagate_inbounds _clenshaw_next (n, A, B, C, x, c, bn1, bn2) = muladd (muladd (A[n],x,B[n]), bn1, muladd (- C[n+ 1 ],bn2,c[n]))
71
94
Base. @propagate_inbounds _clenshaw_next (n, A, :: Zeros , C, x, c, bn1, bn2) = muladd (A[n]* x, bn1, muladd (- C[n+ 1 ],bn2,c[n]))
72
95
# Chebyshev U
106
129
clenshaw (c:: AbstractVector , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: AbstractVector ) =
107
130
clenshaw! (c, A, B, C, copy (x))
108
131
132
+ function clenshaw (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: Number )
133
+ T = promote_type (eltype (c),eltype (A),eltype (B),eltype (C),typeof (x))
134
+ clenshaw! (c, A, B, C, x, Vector {T} (undef, size (c,2 )))
135
+ end
136
+
137
+ function clenshaw (c:: AbstractMatrix , A:: AbstractVector , B:: AbstractVector , C:: AbstractVector , x:: AbstractVector )
138
+ T = promote_type (eltype (c),eltype (A),eltype (B),eltype (C),typeof (x))
139
+ clenshaw! (c, A, B, C, x, Matrix {T} (undef, size (x,1 ), size (c,2 )))
140
+ end
141
+
109
142
# ##
110
143
# Chebyshev T special cases
111
144
# ##
0 commit comments