File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 7676Base. IndexStyle (:: Type{<:IdentityMultiple} ) = IndexLinear ()
7777Base. size (𝐼:: IdentityMultiple ) = (𝐼. n, 𝐼. n)
7878
79- function Base. getindex (𝐼:: IdentityMultiple , inds... )
79+ function Base. getindex (𝐼:: IdentityMultiple , inds:: Integer ... )
8080 any (idx -> idx > 𝐼. n, inds) && throw (BoundsError (𝐼, inds))
8181 return getindex (𝐼. M, inds... )
8282end
8383
84- function Base. getindex (𝐼:: IdentityMultiple{T} , ind) where {T}
84+ function Base. getindex (𝐼:: IdentityMultiple{T} , ind:: Integer ) where {T}
8585 if 1 ≤ ind ≤ 𝐼. n^ 2
8686 return rem (ind - 1 , 𝐼. n + 1 ) == 0 ? 𝐼. M. λ : zero (T)
8787 else
Original file line number Diff line number Diff line change 7676end
7777
7878@testset " Specific methods for IdentityMultiple" begin
79+ @test Diagonal (Id (2 )) == Diagonal ([1.0 , 1 ])
7980 @test Hermitian (Id (2 )) == Hermitian ([1.0 0 ; 0 1 ])
8081 @test exp (Id (3 , 1 )) == Id (3 , exp (1 ))
8182end
You can’t perform that action at this time.
0 commit comments