Skip to content

Commit 0dd833c

Browse files
committed
Add test for now fixed-issues #116 and #117.
1 parent 766b34d commit 0dd833c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/special.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,25 @@
285285
end
286286
y
287287
end
288+
289+
function transposedvectoraccess(x::AbstractVector{T}) where T
290+
N = length(x)
291+
ent = zeros(T, N)
292+
x isa AbstractVector && (x = x')
293+
for i = 1:N, j = 1:size(x,1)
294+
ent[i] += x[j,i]*log(x[j,i])
295+
end
296+
ent
297+
end
298+
function transposedvectoraccessavx(x::AbstractVector{T}) where T
299+
N = length(x)
300+
ent = zeros(T, N)
301+
x isa AbstractVector && (x = x')
302+
@avx for i = 1:N, j = 1:size(x,1)
303+
ent[i] += x[j,i]*log(x[j,i])
304+
end
305+
ent
306+
end
288307

289308
for T (Float32, Float64)
290309
@show T, @__LINE__
@@ -327,6 +346,8 @@
327346
fill!(r2, NaN); calc_sins_avx!(r2)
328347
@test r1 r2
329348

349+
@test transposedvectoraccessavx(a) transposedvectoraccess(a)
350+
330351
N,M = 47,53
331352
B = reshape(cumsum(ones(T, 3N)),N,:)
332353
A1 = zeros(T, N, M)
@@ -356,5 +377,7 @@
356377
X = rand(T, N, M); Z = rand(T, N, M);
357378
Y1 = similar(X); Y2 = similar(Y1);
358379
@test csetanh!(Y1, X, Z) csetanhavx!(Y2, X, Z)
380+
381+
359382
end
360383
end

0 commit comments

Comments
 (0)