Skip to content

Testing weak Popov form fails on some corner cases #35698

@vneiger

Description

@vneiger

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Did you read the documentation and troubleshoot guide?

  • I have read the documentation and troubleshoot guide

Environment

- **OS**: Ubuntu 22.04
- **Sage Version**: 10.1.beta1

Steps To Reproduce

sage: pring.<x> = GF(97)[]
sage: M = Matrix(pring, [[1], [1], [1]])
sage: M.is_weak_popov(row_wise=False,include_zero_vectors=False)
False

Expected Behavior

This should return True, as the matrix is simply a constant nonzero column vector.

Actual Behavior

This returns False.

Additional Information

For a simple nonzero (constant) column vector, the above code snippet does not provide the correct result. This is due to the code being written and correct for row-wise case, but not adapted to some specific instances in the column-wise case (essentially due to the comparisons to self.ncols()).

The failing piece of code is due to the lines in the is_weak_popov method:

        if leading_positions[-1] > self.ncols() and not include_zero_vectors:
            return False

in the code. The leading position here is 2, which is greater than the number of columns which is 1. With include_zero_vectors set to False, this returns False, which is wrong (and, in fact, there is no zero vector here, so this optional argument should not matter in the result).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions