Repository navigation
Return an empty vector from linspace with zero samples - #949
Merged
Merged
Conversation
tomwhite
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
xp.linspace(2, 8, 0)currently returns a scalar0.0with shape()rather than an empty array of shape(0,). This also affects explicit float32 output: the empty result must preserve the requested dtype.Change
Return an empty one-dimensional array using the existing
emptycreation function, retaining the normalized chunks, dtype and spec. Add regression coverage for both endpoint settings and float32/float64, checking the public shape, computed shape, dtype and values.Validation
Python 3.12, NumPy backend, local single-threaded executor:
CUBED_SPEC__EXECUTOR_NAME=single-threaded uv run pytest cubed/tests/test_array_api.py cubed/tests/test_indexing.py cubed/tests/test_ops.py cubed/tests/test_store.py -q: 292 passed, 2 skipped.git diff --check: passed.Broader core/optimization testing was attempted but is not green in this environment: Graphviz's
dotexecutable is unavailable, and tests explicitly selecting the threaded executor can exceed the configured aggregate memory budget on this machine. No cloud or optional backend testing was performed.