Skip to content

eigen(TensorValue) returning wrong values #1156

@miguelmaso

Description

@miguelmaso

Consider the following example:

using Gridap
using LinearAlgebra
A = TensorValue{2,2,Float64}(1,2,3,4)

When trying to perform an eigen decomposition, it is giving wrong results:

julia> eigen(A)
Eigen{TensorValue{2, 2, Float64, 4}, TensorValue{2, 2, Float64, 4}, Matrix{TensorValue{2, 2, Float64, 4}}, Vector{TensorValue{2, 2, Float64, 4}}}
values:
1-element Vector{TensorValue{2, 2, Float64, 4}}:
 TensorValue{2, 2, Float64, 4}(1.0, 2.0, 3.0, 4.0)
vectors:
1×1 Matrix{TensorValue{2, 2, Float64, 4}}:
 TensorValue{2, 2, Float64, 4}(1.0, 0.0, 0.0, 1.0)
julia> eigen(get_array(A))
Eigen{Float64, Float64, StaticArraysCore.SMatrix{2, 2, Float64, 4}, StaticArraysCore.SVector{2, Float64}}
values:
2-element StaticArraysCore.SVector{2, Float64} with indices SOneTo(2):
 -0.3722813232690143
  5.372281323269014
vectors:
2×2 StaticArraysCore.SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
 -0.909377  -0.565767
  0.415974  -0.824565

It seems that TensorValue is missing an interface in order to be compatible with LinearAlgebra. Any clue how to fix this?

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