Skip to content

ERROR: MethodError: no method matching Strided.UnsafeStridedView(::Hermitian{Float64,Array{Float64,2}}) #102

Open
@schneiderfelipe

Description

@schneiderfelipe

I'm having trouble using Hermitian or Symmetric matrices (defined in the LinearAlgebra package). Here is an MWE:

using LinearAlgebra
using TensorOperations

function g(F)
    return @tensor F[i, j] * F[i, j]
end

A = rand(7, 7)

g(A)
# => works great

H = Hermitian(A)
g(H)
# => ERROR: MethodError: no method matching Strided.UnsafeStridedView(::Hermitian{Float64,Array{Float64,2}})

A similar error (ERROR: MethodError: no method matching Strided.UnsafeStridedView(::Symmetric{Float64,Array{Float64,2}})) is thrown for Symmetric matrices.

Of course, it works with H.data, which points to the original matrix, but then we are not using any symmetry:

g(H.data)
# => works fine, but that's not the same thing

Hermitian/Symmetric are simple wrappers, basically, and there are some challenges concerning supporting them:

pointer(H)
# => ERROR: conversion to pointer not defined for Hermitian{Float64,Array{Float64,2}}

strides(H)
# => ERROR: MethodError: no method matching strides(::Hermitian{Float64,Array{Float64,2}})

How could Hermitian/Symmetric be supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions