Skip to content

Unintuitive ncon result when scalar #152

@lkdvos

Description

@lkdvos

Noted by @leburgel:

When contracting a network that results in a scalar, currently ncon does not insert a final call to tensorscalar. As such the following (unintuitive) behaviour is happening:

julia> using TensorOperations
julia> A = rand(2,2);
julia> ncon([A, A], [[1, 2], [1, 2]])
0-dimensional Array{Float64, 0}:
1.42602

It is probably easier to just catch this and wrap the result in tensorscalar, as ncon is inherently type-unstable anyways, this should not make a huge difference.

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