Skip to content

sqrtm is not type-stable #21

@johnmyleswhite

Description

@johnmyleswhite

Maybe we should change sqrtm so that it always returns a complex array?

julia> X = sqrtm([1.0 -0.9; -0.9 1.0])
2x2 Float64 Array:
  0.847316  -0.531089
 -0.531089   0.847316

julia> X * X
2x2 Float64 Array:
  1.0  -0.9
 -0.9   1.0

julia> X = sqrtm([1.0 -0.9; 0.9 1.0])
2x2 Complex{Float64} Array:
   1.0829+0.0im  -0.415549+1.11022e-16im
 0.415549+0.0im     1.0829+1.38778e-16im

julia> X * X
2x2 Complex{Float64} Array:
 1.0+4.61352e-17im  -0.9+1.82784e-16im
  0.9+5.7669e-17im   1.0+3.46701e-16im

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions