Skip to content

Bug: Incorrect projections when num_dirs equals embedding dimension #90

@raphaelreinauer

Description

@raphaelreinauer

In src/ect/ect.py:140:

H = X @ V if V.shape[0] == X.shape[1] else X @ V.T

the shape heuristic fails when num_dirs == dim, e.g.,

from ect import EmbeddedComplex
from ect.directions import Directions
import numpy as np

G = EmbeddedComplex()
G.add_node('a', [0.0, 0.0])
G.add_node('b', [1.0, 0.0])
G.add_node('c', [0.5, 0.8])

directions = Directions(num_dirs=2, dim=2)
V = directions.vectors
X = G.coord_matrix

H_current = X @ V if V.shape[0] == X.shape[1] else X @ V.T
H_correct = X @ V.T  # matches _compute_simplex_projections (line 157)

print(np.allclose(H_current, H_correct))  # False

Part of this JOSS review.

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