From d460a817902c8bce5c63602ce55334b965985a82 Mon Sep 17 00:00:00 2001 From: Karl Pierce Date: Tue, 9 Jul 2024 19:06:29 +0200 Subject: [PATCH] Fix diag issue --- NDTensors/src/diag/diagtensor.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NDTensors/src/diag/diagtensor.jl b/NDTensors/src/diag/diagtensor.jl index af0c294a0a..852fefa466 100644 --- a/NDTensors/src/diag/diagtensor.jl +++ b/NDTensors/src/diag/diagtensor.jl @@ -82,7 +82,8 @@ setdiag(T::UniformDiagTensor, val) = tensor(Diag(val), inds(T)) end end @propagate_inbounds getindex(T::DiagTensor{<:Number,1}, ind::Int) = storage(T)[ind] -@propagate_inbounds getindex(T::DiagTensor{<:Number,0}) = storage(T)[1] +using NDTensors.Expose: expose +@propagate_inbounds getindex(T::DiagTensor{<:Number,0}) = getindex(expose(storage(T))) # Set diagonal elements # Throw error for off-diagonal