Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-ndarray/ndarray
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: rust-ndarray/ndarray
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: refactor
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 10 files changed
  • 1 contributor

Commits on Jan 10, 2026

  1. Add traits and types to capture dimensionality (#1568)

    ndarray has a history of encoding arrays’ dimensionality in the type system; this turns out to be useful both for debugging and for writing complex array libraries. However, some arrays don’t (or can’t) have their dimensionality known at compile time. One good example of this is the output of ArrayBase::squeeze: even if the array’s dimensionality is known before the operation, the dimensionality of the output depends on how many axes have length one.
    
    The Dimensionality trait is intended to unify both the known- and unknown-dimensionality cases. Compile-time dimensionalities are represented using NDim, while cases where the dimensionality cannot be known at compile time are represented using DDyn.
    
    A key design choice is that there is no way to recover the number of dimensions as a runtime value from a type implementing Dimensionality. A dynamic dimensionality here does not mean “known at runtime”, but rather “cannot be known at compile time”. The actual number of axes is always taken from the array’s shape, which avoids having two separate sources of truth.
    akern40 authored Jan 10, 2026
    Configuration menu
    Copy the full SHA
    5056ef8 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2026

  1. Add a trait to tie together compile-time and runtime number of dimens…

    …ions (#1575)
    
    This is the next PR to address #1506. In the previous PR (#1568) we
    established a trait for capturing the "dimensionality" or "rank" of an
    array at the type level. This PR is focused on providing a bridge from
    type-level dimensionality to runtime dimensionality, which we do through
    the new `Ranked` trait.
    
    The `Ranked` trait is pretty simple: require an associated type (`NDim`)
    that carries compile-time dimensionality, and a function `fn ndim(&self)
    -> usize` that tells the user runtime dimensionality. The
    `src/layout/ranked.rs` file contains the definition, implementations,
    and blanket implementations.
    
    This commit also does some moves and renames of the existing
    `Dimensionality` trait, renaming it to `Rank`, as well as many of
    the types in that file.
    akern40 authored Feb 8, 2026
    Configuration menu
    Copy the full SHA
    81756e6 View commit details
    Browse the repository at this point in the history
Loading