@@ -3,10 +3,10 @@ struct Butterfly{T} <: Factorization{T}
3
3
factors:: Vector{Vector{IDPackedV{T}}}
4
4
permutations:: Vector{Vector{ColumnPermutation}}
5
5
indices:: Vector{Vector{Int}}
6
- temp1:: Vector {T}
7
- temp2:: Vector {T}
8
- temp3:: Vector {T}
9
- temp4:: Vector {T}
6
+ temp1:: ThreadSafeVector {T}
7
+ temp2:: ThreadSafeVector {T}
8
+ temp3:: ThreadSafeVector {T}
9
+ temp4:: ThreadSafeVector {T}
10
10
end
11
11
12
12
function size (B:: Butterfly , dim:: Integer )
@@ -106,7 +106,7 @@ function Butterfly{T}(A::AbstractMatrix{T}, L::Int; isorthogonal::Bool = false,
106
106
107
107
kk = sumkmax (indices)
108
108
109
- Butterfly (columns, factors, permutations, indices, zeros (T, kk), zeros (T, kk), zeros (T, kk), zeros (T, kk))
109
+ Butterfly (columns, factors, permutations, indices, threadedzeros (T, kk), threadedzeros (T, kk), threadedzeros (T, kk), threadedzeros (T, kk))
110
110
end
111
111
112
112
function sumkmax (indices:: Vector{Vector{Int}} )
119
119
120
120
# ### Helper
121
121
122
- function rowperm! (fwd:: Bool , x:: StridedVecOrMat , p:: Vector{Int} , jstart:: Int )
122
+ function rowperm! (fwd:: Bool , x:: AbstractVecOrMat , p:: Vector{Int} , jstart:: Int )
123
123
n = length (p)
124
124
jshift = jstart- 1
125
125
scale! (p, - 1 )
@@ -151,7 +151,7 @@ function rowperm!(fwd::Bool, x::StridedVecOrMat, p::Vector{Int}, jstart::Int)
151
151
x
152
152
end
153
153
154
- function rowperm! (fwd:: Bool , y:: StridedVector , x:: StridedVector , p:: Vector{Int} , jstart:: Int )
154
+ function rowperm! (fwd:: Bool , y:: AbstractVector , x:: AbstractVector , p:: Vector{Int} , jstart:: Int )
155
155
n = length (p)
156
156
jshift = jstart- 1
157
157
@inbounds if (fwd)
@@ -167,13 +167,13 @@ function rowperm!(fwd::Bool, y::StridedVector, x::StridedVector, p::Vector{Int},
167
167
end
168
168
169
169
# # ColumnPermutation
170
- A_mul_B! (A:: ColPerm , B:: StridedVecOrMat , jstart:: Int ) = rowperm! (false , B, A. p, jstart)
171
- At_mul_B! (A:: ColPerm , B:: StridedVecOrMat , jstart:: Int ) = rowperm! (true , B, A. p, jstart)
172
- Ac_mul_B! (A:: ColPerm , B:: StridedVecOrMat , jstart:: Int ) = At_mul_B! (A, B, jstart)
170
+ A_mul_B! (A:: ColPerm , B:: AbstractVecOrMat , jstart:: Int ) = rowperm! (false , B, A. p, jstart)
171
+ At_mul_B! (A:: ColPerm , B:: AbstractVecOrMat , jstart:: Int ) = rowperm! (true , B, A. p, jstart)
172
+ Ac_mul_B! (A:: ColPerm , B:: AbstractVecOrMat , jstart:: Int ) = At_mul_B! (A, B, jstart)
173
173
174
- A_mul_B! (y:: StridedVector , A:: ColPerm , x:: StridedVector , jstart:: Int ) = rowperm! (false , y, x, A. p, jstart)
175
- At_mul_B! (y:: StridedVector , A:: ColPerm , x:: StridedVector , jstart:: Int ) = rowperm! (true , y, x, A. p, jstart)
176
- Ac_mul_B! (y:: StridedVector , A:: ColPerm , x:: StridedVector , jstart:: Int ) = At_mul_B! (y, x, A, jstart)
174
+ A_mul_B! (y:: AbstractVector , A:: ColPerm , x:: AbstractVector , jstart:: Int ) = rowperm! (false , y, x, A. p, jstart)
175
+ At_mul_B! (y:: AbstractVector , A:: ColPerm , x:: AbstractVector , jstart:: Int ) = rowperm! (true , y, x, A. p, jstart)
176
+ Ac_mul_B! (y:: AbstractVector , A:: ColPerm , x:: AbstractVector , jstart:: Int ) = At_mul_B! (y, x, A, jstart)
177
177
178
178
# Fast A_mul_B!, At_mul_B!, and Ac_mul_B! for an ID. These overwrite the output.
179
179
@@ -339,7 +339,7 @@ for f! in (:At_mul_B!,:Ac_mul_B!)
339
339
end
340
340
end
341
341
342
- function addtemp3totemp2! (temp2:: Vector , temp3:: Vector , i1:: Int , i2:: Int )
342
+ function addtemp3totemp2! (temp2:: AbstractVector , temp3:: AbstractVector , i1:: Int , i2:: Int )
343
343
z = zero (eltype (temp3))
344
344
@inbounds @simd for i = i1: i2
345
345
temp2[i] += temp3[i]
0 commit comments