@@ -355,6 +355,19 @@ for PT in ParticleSymbols
355
355
end
356
356
Base.:\ (p:: Vector{<:$PT} , p2:: Vector{<:$PT} ) = Matrix (p)\ Matrix (p2) # Must be here to be most specific
357
357
358
+ function LinearAlgebra. eigvals (p:: Matrix{$PT{T,N}} ; kwargs... ) where {T,N} # Special case to propte types differently
359
+ individuals = map (1 : length (p[1 ])) do i
360
+ eigvals (getindex .(p,i); kwargs... )
361
+ end
362
+ PRT = Complex{$ PT{T,N}}
363
+ out = Vector {PRT} (undef, length (individuals[1 ]))
364
+ for i = eachindex (out)
365
+ c = getindex .(individuals,i)
366
+ out[i] = complex ($ PT {T,N} (real (c)),$ PT {T,N} (imag (c)))
367
+ end
368
+ out
369
+ end
370
+
358
371
end
359
372
360
373
# for XT in (:T, :($PT{T,N})), YT in (:T, :($PT{T,N})), ZT in (:T, :($PT{T,N}))
@@ -550,23 +563,6 @@ Base.exp(p::AbstractMatrix{<:AbstractParticles}) = ℝⁿ2ℝⁿ_function(exp, p
550
563
LinearAlgebra. lyap (p1:: Matrix{<:AbstractParticles} , p2:: Matrix{<:AbstractParticles} ) = ℝⁿ2ℝⁿ_function (lyap, p1, p2)
551
564
552
565
553
- # OBS: defining this was a very bad idea, eigvals jump around and get confused with each other etc.
554
- # function LinearAlgebra.eigvals(p::Matrix{$PT{T,N}}) where {T,N} # Special case to propte types differently
555
- # individuals = map(1:length(p[1])) do i
556
- # eigvals(getindex.(p,i))
557
- # end
558
- #
559
- # PRT = Complex{$PT{T,N}}
560
- # out = Vector{PRT}(undef, length(individuals[1]))
561
- # for i = eachindex(out)
562
- # c = getindex.(individuals,i)
563
- # out[i] = complex($PT{T,N}(real(c)),$PT{T,N}(imag(c)))
564
- # end
565
- # out
566
- # end
567
-
568
-
569
-
570
566
# # Particle BLAS
571
567
572
568
# pgemv is up to twice as fast as the naive way already for A(2,2)-A(20,20)
0 commit comments