Skip to content

Commit 249b660

Browse files
committed
Fix refix strides on adjoint vectors
1 parent fcbfc5f commit 249b660

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/stridelayout.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,8 @@ end
419419
@inline strides(A::AbstractArray) = _strides(A, Base.strides(A), contiguous_axis(A))
420420

421421
function strides(x::VecAdjTrans)
422-
p = parent(x)
423-
st = first(strides(p))
424-
return (static_length(p) * st, st)
422+
st = first(strides(parent(x)))
423+
return (st, st)
425424
end
426425

427426
@generated function _strides(A::AbstractArray{T,N}, s::NTuple{N}, ::StaticInt{C}) where {T,N,C}

test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ end
481481
@test @inferred(ArrayInterface.strides(Sp)) === (StaticInt(6), StaticInt(1), StaticInt(2))
482482
@test @inferred(ArrayInterface.strides(Sp2)) === (StaticInt(6), StaticInt(2), StaticInt(1))
483483

484-
@test @inferred(ArrayInterface.strides(view(Sp2, :, 1, 1)')) === (12, StaticInt(6))
484+
@test @inferred(ArrayInterface.strides(view(Sp2, :, 1, 1)')) === (StaticInt(6), StaticInt(6))
485485

486486
@test @inferred(ArrayInterface.stride(Sp2, StaticInt(1))) === StaticInt(6)
487487
@test @inferred(ArrayInterface.stride(Sp2, StaticInt(2))) === StaticInt(2)
@@ -505,6 +505,7 @@ end
505505
@test @inferred(ArrayInterface.known_strides(Sp2, StaticInt(1))) === 6
506506
@test @inferred(ArrayInterface.known_strides(Sp2, StaticInt(2))) === 2
507507
@test @inferred(ArrayInterface.known_strides(Sp2, StaticInt(3))) === 1
508+
@test @inferred(ArrayInterface.known_strides(view(Sp2, :, 1, 1)')) === (6, 6)
508509

509510
@test @inferred(ArrayInterface.known_strides(M)) === (1, 2, 6)
510511
@test @inferred(ArrayInterface.known_strides(Mp)) === (2, 6)

0 commit comments

Comments
 (0)