Skip to content

Type instability for output of matrix exponential #1309

Open
@kshyatt

Description

@kshyatt
julia> using StaticArrays

julia> a = rand(ComplexF64, 4, 4);

julia> sa = SMatrix{4, 4, ComplexF64}(a);

julia> sa^0.24
4×4 Matrix{ComplexF64}:
   0.874908+0.15603im     0.151727+0.0339536im  0.237417+0.0719561im   0.138797-0.157633im
 -0.0531973-0.0687887im   0.840276+0.273785im   0.279529-0.138501im    0.180715-0.042755im
   0.289622+0.114242im   0.0899188-0.226646im    0.85235+0.186083im   0.0758456+0.333684im
   0.139949-0.0276479im  0.0144155-0.0357819im  0.106669+0.0762763im   0.927468+0.233238im

julia> sa^2.0
4×4 SMatrix{4, 4, ComplexF64, 16} with indices SOneTo(4)×SOneTo(4):
 0.229298+3.53602im  0.0232097+2.07716im    -2.15183+2.7979im   -0.885066+2.19474im
 0.629551+2.70017im   0.228516+1.496im      -1.28589+2.23414im  -0.544305+1.95987im
  1.62283+2.20926im   0.673849+1.56577im    0.228108+2.75801im   0.672545+2.01049im
 0.715161+1.50804im   0.143538+0.958167im  -0.334129+1.70432im   0.461188+1.14152im

Presumably the first one is falling back to LinearAlgebra.jl, but not having stable output here is kind of annoying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraysAbstractArray interface and array operationslinear-algebra

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions