@@ -3,10 +3,10 @@ struct Butterfly{T} <: Factorization{T}
33 factors:: Vector{Vector{IDPackedV{T}}}
44 permutations:: Vector{Vector{ColumnPermutation}}
55 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}
1010end
1111
1212function size (B:: Butterfly , dim:: Integer )
@@ -106,7 +106,7 @@ function Butterfly{T}(A::AbstractMatrix{T}, L::Int; isorthogonal::Bool = false,
106106
107107 kk = sumkmax (indices)
108108
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))
110110end
111111
112112function sumkmax (indices:: Vector{Vector{Int}} )
119119
120120# ### Helper
121121
122- function rowperm! (fwd:: Bool , x:: StridedVecOrMat , p:: Vector{Int} , jstart:: Int )
122+ function rowperm! (fwd:: Bool , x:: AbstractVecOrMat , p:: Vector{Int} , jstart:: Int )
123123 n = length (p)
124124 jshift = jstart- 1
125125 scale! (p, - 1 )
@@ -151,7 +151,7 @@ function rowperm!(fwd::Bool, x::StridedVecOrMat, p::Vector{Int}, jstart::Int)
151151 x
152152end
153153
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 )
155155 n = length (p)
156156 jshift = jstart- 1
157157 @inbounds if (fwd)
@@ -167,13 +167,13 @@ function rowperm!(fwd::Bool, y::StridedVector, x::StridedVector, p::Vector{Int},
167167end
168168
169169# # 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)
173173
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)
177177
178178# Fast A_mul_B!, At_mul_B!, and Ac_mul_B! for an ID. These overwrite the output.
179179
@@ -339,7 +339,7 @@ for f! in (:At_mul_B!,:Ac_mul_B!)
339339 end
340340end
341341
342- function addtemp3totemp2! (temp2:: Vector , temp3:: Vector , i1:: Int , i2:: Int )
342+ function addtemp3totemp2! (temp2:: AbstractVector , temp3:: AbstractVector , i1:: Int , i2:: Int )
343343 z = zero (eltype (temp3))
344344 @inbounds @simd for i = i1: i2
345345 temp2[i] += temp3[i]
0 commit comments