SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.09926 · ICML · 2024

Metric Learning for Clifford Group Equivariant Neural Networks

Pietro Liò, Haitz Sáez De Ocáriz Borde, Riccardo Ali, Paulina Kulytė

arXiv · PDF · Open in the Atlas

Code that ran

19 of 26 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 6 honoured the contract we drafted, 2 violated it and 1 has no contract verdict; 10 failures of our instrument; 7 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2407.09926.json · badge: /api/ran/2407.09926.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
rick-ali/metric-learning-for-cgenns canonical (classifier label)
classifier basis: classifier_2025
12 ran · 7 no recorded run
rick-ali/Metric-Learning-for-CGENNs canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
MVLinear Ran
ran on a synthesized input · constructed an object; no result was computed
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("eacc9335cde1d246")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MVLinear: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

# Create a minimal algebra class that satisfies the required interface
class MinimalAlgebra:
    def __init__(self):
        self.n_subspaces = 3
        self.subspaces = 2
    
    def embed(self, bias, b_dims):
        # The embed method is called with bias and b_dims
        # It should return a tensor compatible with the result
        # Based on usage: bias shape is (1, out_features, 1)
        # We'll return it as-is since it's used in unsqueeze_like
        return bias

# Instantiate the algebra
algebra = MinimalAlgebra()

# Define arguments for MVLinear
ARGS = {
    'algebra': algebra,
    'in_features': 4,
    'out_features': 5,
    'subspaces': True,
    'bias': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MVLinear — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MVLinear output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_smooth_abs_sqrt Ran
ran, honoured the contract we drafted
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("12d00178b3ee0e76")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function _smooth_abs_sqrt takes:
# - input: a tensor that will be squared, added to eps, and raised to 0.25
# - eps: a small float for numerical stability (default 1e-16)

# Create a small input tensor
input_tensor = torch.randn(2, 4)

ARGS = {
    "input": input_tensor,
    "eps": 1e-16
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_norm Ran
ran; our contract draft was wrong, not the code
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("4fd600fe4428ec1d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockBBO:
    def __init__(self, n_blades=4):
        self.n_blades = n_blades
        # Create bitmap mappings for 4 blades
        self.index_to_bitmap = torch.tensor([1, 2, 4, 8], dtype=torch.int64)
        bitmap_to_index_dict = {1: 0, 2: 1, 4: 2, 8: 3}
        self.bitmap_to_index = torch.zeros(16, dtype=torch.int64)
        for bitmap, idx in bitmap_to_index_dict.items():
            self.bitmap_to_index[bitmap] = idx

class MockAlgebra:
    def __init__(self, n_blades=4):
        self.n_blades = n_blades
        self.bbo = MockBBO(n_blades)
        # Beta signs for each blade
        self._beta_signs = torch.tensor([1.0, -1.0, 1.0, -1.0], dtype=torch.float32)

# Create a multivector as a tensor
# batch_size=2, n_blades=4
mv = torch.randn(2, 4, dtype=torch.float32)

# Create metric (signature for geometric algebra)
# For 4D space, we can use Euclidean-like signature
metric = torch.tensor([1.0, 1.0, 1.0, 1.0], dtype=torch.float32)

# Create algebra
algebra = MockAlgebra(n_blades=4)

ARGS = {
    "algebra": algebra,
    "metric": metric,
    "mv": mv,
    "blades": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_norms Ran
ran; our contract draft was wrong, not the code
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("378003362f195653")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal algebra object that satisfies the function's needs
class MinimalBladeIndexObject:
    def __init__(self):
        # For a 2D algebra, we have 4 blades: scalar, e1, e2, e1e2
        self.index_to_bitmap = torch.tensor([0b0000, 0b0001, 0b0010, 0b0011], dtype=torch.int64)
        self.bitmap_to_index = torch.tensor([0, 1, 2, 3], dtype=torch.int64)

class MinimalAlgebra:
    def __init__(self):
        self.n_blades = 4
        self.bbo = MinimalBladeIndexObject()
        self.grades = [0, 1, 2]
        # Beta signs for each blade (used in the beta function)
        self._beta_signs = torch.tensor([1.0, 1.0, 1.0, -1.0])
        # Maps grade to blade indices
        self.grade_to_index = {
            0: torch.tensor([0]),           # scalar
            1: torch.tensor([1, 2]),        # e1, e2
            2: torch.tensor([3]),           # e1e2
        }
    
    def get_grade(self, mv, grade):
        """Extract the part of mv corresponding to a given grade"""
        indices = self.grade_to_index[grade]
        if mv.dim() == 1:
            return mv[indices]
        else:
            return mv[..., indices]

# Create algebra and metric
algebra = MinimalAlgebra()
metric = torch.tensor([1.0, 1.0, 1.0])  # Euclidean 2D metric

# Create a multivector (batch of 2, with 4 blade components)
mv = torch.randn(2, 4)

ARGS = {
    "algebra": algebra,
    "metric": metric,
    "mv": mv,
    "grades": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 3, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_reordering_sign Ran
ran, violated the contract we drafted
rick-ali/metric-learning-for-cgenns/algebra/metric.py
code served (permissive licence) · get_code("c267455507445bf8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function signature and body:
# canonical_reordering_sign(bitmap_a, bitmap_b, metric)
# - bitmap_a: int, used with bitwise operations
# - bitmap_b: int, used with bitwise operations
# - metric: list/array, indexed by integer i, values multiplied with output_sign

# Create valid arguments
bitmap_a = 0b1101  # 13 in decimal, has bits set at positions 0, 2, 3
bitmap_b = 0b1011  # 11 in decimal, has bits set at positions 0, 1, 3

# metric needs to be indexable and contain numeric values
# The function iterates through bit positions and indexes metric[i]
# We need at least 4 elements (since max bit position in our bitmaps is 3)
metric = [1, -1, 1, -1, 1]

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
    "metric": metric,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_reordering_sign Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("eb3217cce9b27f2c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

def count_set_bits(bitmap: int) -> int:
    """Counts the number of bits set to 1 in bitmap"""
    count = 0
    for i in set_bit_indices(bitmap):
        count += 1
    return count

def set_bit_indices(x: int):
    """Iterate over the indices of bits set to 1 in `x`, in ascending order"""
    n = 0
    while x > 0:
        if x & 1:
            yield n
        x = x >> 1
        n = n + 1

def canonical_reordering_sign_euclidean(bitmap_a, bitmap_b):
    """
    Computes the sign for the product of bitmap_a and bitmap_b
    assuming a euclidean metric
    """
    a = bitmap_a >> 1
    sum_value = 0
    while a != 0:
        sum_value = sum_value + count_set_bits(a & bitmap_b)
        a = a >> 1
    if sum_value & 1 == 0:
        return 1
    else:
        return -1

def canonical_reordering_sign(bitmap_a, bitmap_b, metric):
    """
    Computes the sign for the product of bitmap_a and bitmap_b
    given the supplied metric
    """
    bitmap = bitmap_a & bitmap_b
    output_sign = canonical_reordering_sign_euclidean(bitmap_a, bitmap_b)
    i = 0
    while bitmap != 0:
        if bitmap & 1 != 0:
            output_sign *= metric[i]
        i = i + 1
        bitmap = bitmap >> 1
    return output_sign

# Setup test arguments
bitmap_a = 0b1010  # 10 in decimal
bitmap_b = 0b1100  # 12 in decimal
metric = [1, -1, 1, -1, 1]  # metric with signed entries

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
    "metric": metric
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_reordering_sign Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rick-ali/Metric-Learning-for-CGENNs/algebra/metric.py
code served (permissive licence) · get_code("2354e2c3c7b22d3c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Analyze the function signature:
# canonical_reordering_sign(bitmap_a, bitmap_b, metric)
# 
# Parameters:
# - bitmap_a: int, used as a bitmap (bit operations)
# - bitmap_b: int, used as a bitmap (bit operations)
# - metric: indexable sequence, accessed by index i in a while loop
#   The metric is indexed up to the number of bits in bitmap_a and bitmap_b
#   Each metric[i] is multiplied into output_sign, so should be numeric

# Looking at the function body:
# - bitmap_a and bitmap_b are used with bitwise operations (>>, &, !=)
# - metric is indexed and values are multiplied (metric[i])
# - The function accesses metric indices based on bit positions

# Create small example bitmaps and a metric list
import torch

torch.manual_seed(0)

# bitmap_a and bitmap_b: small positive integers with some bits set
# Let's use 5 (binary 0101) and 3 (binary 0011) as examples
bitmap_a = 5  # binary: 0101
bitmap_b = 3  # binary: 0011

# metric: a list of numeric values, one for each possible bit position
# We need enough elements to cover the bits we're checking
# The maximum bit position we'll access is determined by bitmap_a and bitmap_b
# Let's create a metric with 8 elements (covers up to 8 bit positions)
metric = [1, -1, 1, -1, 1, -1, 1, -1]

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
    "metric": metric,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_reordering_sign_euclidean Ran
ran, honoured the contract we drafted
rick-ali/metric-learning-for-cgenns/algebra/metric.py
code served (permissive licence) · get_code("cffd0c2ee938ffee")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function: canonical_reordering_sign_euclidean takes two parameters:
# - bitmap_a: int
# - bitmap_b: int
# The function performs bitwise operations on these integers

# Create valid test cases with small integer bitmaps
bitmap_a = 0b1010  # 10 in decimal, has bits set at positions 1 and 3
bitmap_b = 0b1100  # 12 in decimal, has bits set at positions 2 and 3

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_reordering_sign_euclidean Ran
ran, honoured the contract we drafted
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("4c1b710580c8b7cf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Read the function body to understand what parameters are needed
# canonical_reordering_sign_euclidean takes bitmap_a and bitmap_b
# Both are used as integers in bitwise operations

# These should be small positive integers that represent bitmaps
bitmap_a = 0b1010  # binary: 1010 (decimal: 10)
bitmap_b = 0b1100  # binary: 1100 (decimal: 12)

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_reordering_sign_euclidean Ran
ran, honoured the contract we drafted
rick-ali/Metric-Learning-for-CGENNs/algebra/metric.py
code served (permissive licence) · get_code("d5c05c34d2e55a48")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Setup code for canonical_reordering_sign_euclidean

# Analyze the function:
# - bitmap_a: int - used with bitwise operations (>> 1)
# - bitmap_b: int - used with bitwise operations (& with a)
# Both parameters are integers representing bitmaps

# Create simple test cases with small integer bitmaps
bitmap_a = 0b1010  # binary: 1010 (decimal 10)
bitmap_b = 0b1100  # binary: 1100 (decimal 12)

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
construct_gmt Ran
ran; our contract draft was wrong, not the code
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("8c0324f3633ef2c8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# For a geometric algebra with 3 basis vectors, we need bitmaps from 0 to 7 (2^3 - 1)
# Each bitmap represents a basis blade

# index_to_bitmap: maps index to bitmap representation
# For 3D: index 0->bitmap 0 (scalar), index 1->bitmap 1 (e1), index 2->bitmap 2 (e2), etc.
index_to_bitmap = [0, 1, 2, 4, 3, 5, 6, 7]  # 8 blades for 3D geometric algebra

# bitmap_to_index: inverse mapping
bitmap_to_index = {0: 0, 1: 1, 2: 2, 4: 3, 3: 4, 5: 5, 6: 6, 7: 7}

# signature: metric signature for each basis vector
# For Euclidean 3D space: [1, 1, 1]
signature = [1.0, 1.0, 1.0]

ARGS = {
    "index_to_bitmap": index_to_bitmap,
    "bitmap_to_index": bitmap_to_index,
    "signature": signature,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, shape (8, 8, 8) — shape (8, 8, 8) as a later run recorded it
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
count_set_bits Ran
ran, honoured the contract we drafted
rick-ali/metric-learning-for-cgenns/algebra/metric.py
code served (permissive licence) · get_code("24a3800851807b8e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def set_bit_indices(x: int):
    """Iterate over the indices of bits set to 1 in `x`, in ascending order"""
    n = 0
    while x > 0:
        if x & 1:
            yield n
        x = x >> 1
        n = n + 1

def count_set_bits(bitmap: int) -> int:
    """Counts the number of bits set to 1 in bitmap"""
    count = 0
    for i in set_bit_indices(bitmap):
        count += 1
    return count

# Test cases with different bitmaps
# 0b1010 = 10 in decimal, has 2 bits set
# 0b1111 = 15 in decimal, has 4 bits set
# 0b0001 = 1 in decimal, has 1 bit set
# 0b0000 = 0 in decimal, has 0 bits set

ARGS = {
    "bitmap": 10  # 0b1010 - has 2 bits set at positions 1 and 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
count_set_bits Ran
ran, honoured the contract we drafted
rick-ali/Metric-Learning-for-CGENNs/algebra/metric.py
code served (permissive licence) · get_code("a660d9bd93058229")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def set_bit_indices(x: int):
    """Iterate over the indices of bits set to 1 in `x`, in ascending order"""
    n = 0
    while x > 0:
        if x & 1:
            yield n
        x = x >> 1
        n = n + 1

def count_set_bits(bitmap: int) -> int:
    """Counts the number of bits set to 1 in bitmap"""
    count = 0
    for i in set_bit_indices(bitmap):
        count += 1
    return count

# Test with a few different bitmap values
# Binary: 0b1010 = 10 (bits at indices 1 and 3 are set)
# Binary: 0b1111 = 15 (bits at indices 0, 1, 2, 3 are set)
# Binary: 0b10101 = 21 (bits at indices 0, 2, 4 are set)

ARGS = {
    "bitmap": 21
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_invariants Ran
ran; our contract draft was wrong, not the code
rick-ali/Metric-Learning-for-CGENNs/models/lorentz_cggnn.py
code served (permissive licence) · get_code("02b4e625d513ec06")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockAlgebra(nn.Module):
    def __init__(self):
        super().__init__()
        self.grades = [0, 1, 2]
    
    def qs(self, input, grades):
        """
        Mock implementation that returns a list of norms for each grade.
        Returns list of tensors with shapes matching input batch dimension.
        """
        norms = []
        for grade in grades:
            # Return a tensor with shape (batch_size, 1) for each grade
            norm = torch.randn(input.shape[0], 1)
            norms.append(norm)
        return norms

algebra = MockAlgebra()

# Create input tensor: batch size 2, feature dim 4
input_tensor = torch.randn(2, 4)

ARGS = {
    "algebra": algebra,
    "input": input_tensor,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gmt_element Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("1ca665edea3adf3f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Helper functions are already defined in the problem, so we just need to
# construct valid arguments for gmt_element(bitmap_a, bitmap_b, sig_array)

# bitmap_a and bitmap_b are integers representing bitmaps (blade basis elements)
# sig_array is a list/array of metric signature values (typically +1 or -1)

# Create simple test arguments
bitmap_a = 0b0101  # binary: 5 (represents basis elements at positions 0 and 2)
bitmap_b = 0b0011  # binary: 3 (represents basis elements at positions 0 and 1)
sig_array = [1, 1, 1, 1]  # Euclidean metric signature (all positive)

ARGS = {
    "bitmap_a": bitmap_a,
    "bitmap_b": bitmap_b,
    "sig_array": sig_array,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
psi Ran
ran; our contract draft was wrong, not the code
rick-ali/Metric-Learning-for-CGENNs/models/lorentz_cggnn.py
code served (permissive licence) · get_code("eb8ab1e8e209f7b1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function psi takes a parameter p and applies:
# torch.sign(p) * torch.log(torch.abs(p) + 1)
# So p should be a tensor (any shape, any values)

p = torch.randn(2, 4)

ARGS = {
    "p": p
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
unsorted_segment_mean Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rick-ali/Metric-Learning-for-CGENNs/models/nbody_cggnn.py
code served (permissive licence) · get_code("bc66f19be57720e7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create sample data tensor with shape (batch_size, feature_dim)
# Using distinct sizes: 2 for batch, 4 for features
data = torch.randn(2, 4)

# Create segment_ids tensor that maps each data point to a segment
# Values should be in range [0, num_segments)
segment_ids = torch.tensor([0, 1])

# Number of segments to aggregate into
num_segments = 2

ARGS = {
    "data": data,
    "segment_ids": segment_ids,
    "num_segments": num_segments,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
unsorted_segment_sum Ran
ran; our contract draft was wrong, not the code
rick-ali/Metric-Learning-for-CGENNs/models/lorentz_cggnn.py
code served (permissive licence) · get_code("f1e6153da7a4214f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - data: tensor with shape (batch_size, feature_dim), used with .new_zeros() and .size(1)
# - segment_ids: 1D tensor of segment indices, used with index_add_
# - num_segments: int, number of output segments

# Create small tensors with distinct dimensions
data = torch.randn(2, 4)  # batch_size=2, feature_dim=4
segment_ids = torch.tensor([0, 1], dtype=torch.long)  # 2 segment IDs
num_segments = 2  # matches max segment_id + 1

ARGS = {
    "data": data,
    "segment_ids": segment_ids,
    "num_segments": num_segments,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
unsqueeze_like Ran
ran, violated the contract we drafted
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("f6c0971a1cd07155")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (1, 1, 2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create two tensors with different numbers of dimensions
# tensor has fewer dimensions than like, so unsqueeze will add dimensions
tensor = torch.randn(2, 4)  # 2D tensor: shape (2, 4)
like = torch.randn(2, 3, 4, 5)  # 4D tensor: shape (2, 3, 4, 5)

# dim parameter controls where unsqueezing starts
dim = 0

ARGS = {
    "tensor": tensor,
    "like": like,
    "dim": dim
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (1, 1, 2, 4) — shape (1, 1, 2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FullyConnectedSteerableGeometricProductLayer Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("af68a09b089926e0")
How it ran

no invocation recorded.

NormalizationLayer Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("80acaf82da83dc26")
How it ran

no invocation recorded.

b Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("158aefe877c35425")
How it ran

no invocation recorded.

beta Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("9a6fb42786449575")
How it ran

no invocation recorded.

cayley Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("54e377e3d53dcda9")
How it ran

no invocation recorded.

geometric_product Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("a1a30d9532aee437")
How it ran

no invocation recorded.

q Not yet run
unverified (harvested, no recorded run)
rick-ali/metric-learning-for-cgenns/models/modules/fcgp.py
code served (permissive licence) · get_code("dcba8eaf7d6bbc97")
How it ran

no invocation recorded.

Also present in other papers' code

Of 26 samples lifted from this paper's linked repositories, 26 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 5 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 5 later) and 16 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
unsorted_segment_mean 20 other papers
16 dated earlier, 4 later · 1 only as an assembly brick
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
2102.09844 (2021-02)
E(n) Equivariant Graph Neural Networks
2110.14811 (2021-10)
SE(3) Equivariant Graph Neural Networks with Complete Local Frames
and 17 more not named here
unsqueeze_like
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later
2402.10011 (2024-02)
Clifford Group Equivariant Simplicial Message Passing Networks
2506.09625 (2025-06)
GLGENN: A Novel Parameter-Light Equivariant Neural Networks Architecture Based on Clifford Geometric Algebras
canonical_reordering_sign
brick of this paper's assembly: helper
1 other paper
1 later
2506.09625 (2025-06)
GLGENN: A Novel Parameter-Light Equivariant Neural Networks Architecture Based on Clifford Geometric Algebras
canonical_reordering_sign_euclidean
brick of this paper's assembly: helper
1 other paper
1 later
2506.09625 (2025-06)
GLGENN: A Novel Parameter-Light Equivariant Neural Networks Architecture Based on Clifford Geometric Algebras
count_set_bits 1 other paper
1 later
2506.09625 (2025-06)
GLGENN: A Novel Parameter-Light Equivariant Neural Networks Architecture Based on Clifford Geometric Algebras

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Clifford Group Equivariant Neural Networks (CGENNs) leverage Clifford algebras and multivectors as an alternative approach to incorporating group equivariance to ensure symmetry constraints in neural representations. In principle, this formulation generalizes to orthogonal groups and preserves equivariance regardless of the metric signature. However, previous works have restricted internal network representations to Euclidean or Minkowski (pseudo-)metrics, handpicked depending on the problem at hand. In this work, we propose an alternative method that enables the metric to be learned in a data-driven fashion, allowing the CGENN network to learn more flexible representations. Specifically, we populate metric matrices fully, ensuring they are symmetric by construction, and leverage eigenvalue decomposition to integrate this additional learnable component into the original CGENN formulation in a principled manner. Additionally, we motivate our method using insights from category theory, which enables us to explain Clifford algebras as a categorical construction and guarantee the mathematical soundness of our approach. We validate our method in various tasks and showcase the advantages of learning more flexible latent metric representations. The code and data are available at https://github.com/rick-ali/Metric-Learning-for-CGENNs

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2407.09926")
get_code_for_paper("2407.09926")
have("2407.09926")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2407.09926.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2407.09926.svg)](https://syntology.ai/paper/2407.09926)

Connect an agent — have() is free.