Macaulay2 / Macaulay2/M2

There is no way to construct an empty vector

Open
#4,524 0 comments 0 reactions 0 assignees View on GitHub
bugs directory Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

This issue was triaged from [`bugs/dan/0-vector-empty-list`](https://github.com/Macaulay2/M2/blob/388c1ff0ce30d83751dea7bc7eac77fdc1305dd7/bugs/dan/0-vector-empty-list), one of the 857 files removed from the pre-GitHub `bugs/` tree by [`d2c8d27826`](https://github.com/Macaulay2/M2/commit/d2c8d27826) and catalogued in [#36](https://github.com/Macaulay2/M2/issues/36). **The commentary below was written by Claude (Claude Opus 5, via Claude Code)**, not by @d-torrance, whose account posted it -- please weigh it accordingly.

### The original file, verbatim

```text

i55 : vector {}
/Applications/Macaulay2-1.4/share/Macaulay2/Core/matrix1.m2:276:23:(1):[4]: error: expected nonempty list
/Applications/Macaulay2-1.4/share/Macaulay2/Core/matrix1.m2:276:23:(1):[4]: --entering debugger (type help to see debugger commands)
/Applications/Macaulay2-1.4/share/Macaulay2/Core/matrix1.m2:276:23-276:23: --source code:
if #m === 0 then error "expected nonempty list";
```

### Where it stands today

Still no empty vector, and the message has got **worse** since the file was written.

The file records `vector {}` failing with "expected nonempty list" from `matrix1.m2:276`. Today it dies
further in, inside `vector Matrix`:

```m2
i1 : vector {}
error: expected source to be free with rank 1 -- Core/modules.m2:70
```

and the two forms that would let you name the ring or the module fail the same way:

```m2
i2 : vector(R, {})
i3 : vector(R^0, {})
```

So a user with an empty list has no way to obtain the zero vector of a module, and the diagnosis now
talks about the rank of a source rather than about the empty input.

### Notes for whoever picks this up

Two separable things: whether `vector {}` should work at all (it needs a ring, so probably not — compare
**#3328**, where defaulting a missing ring to `ZZ` was declined as a source of hard-to-find bugs), and
whether `vector(R, {})` and `vector(R^0, {})` should work (they name a ring or a module, so there is no
ambiguity to resolve). The second pair looks like the real gap.

`open` · disposition `issue` · source of truth: [`bug-triage/catalog.tsv`](https://github.com/d-torrance/M2/blob/bug-triage/bug-triage/catalog.tsv)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing vector {}, vector(R, {}), and vector(R^0, {}) in the Macaulay2 environment. Read the relevant paths in Core/matrix1.m2 around line 276 and Core/modules.m2 around line 70, then inspect nearby vector construction behavior. Done means the explicitly ring- or module-qualified empty-vector forms have a clear, tested result; the unqualified form remains a separate decision.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.