Skip to content

Fix monomial_coefficients for submodules of free modules from sage.modules #34455

@mkoeppe

Description

@mkoeppe

Bug:

sage: V = ZZ^3
sage: U = V.submodule([[1, 2, 3], [1, 1, 1]])
sage: U
sage: u = U([2, 3, 4])
sage: u.monomial_coefficients()
{0: 2, 1: 3, 2: 4}

This is incorrect - by definition of monomial_coefficients, basis indices are mapped to coefficients; but

sage: u.parent().basis()
[
(1, 0, -1),
(0, 1, 2)
]

We also add a method _test_monomial_coefficients to run some tests on this and related methods of ModulesWithBasis.

Part of #30309

CC: @tscrim @mmasdeu

Component: linear algebra

Author: Matthias Koeppe, ...

Issue created by migration from https://trac.sagemath.org/ticket/34455

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions