Visitar URL original
Comparing master...refactor · rust-ndarray/ndarray · GitHub
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.
  • 4 commits
  • 16 files changed
  • 2 contributors

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

Commits on Oct 19, 2026

  1. chore: fix lints from newer clippy and nightly deprecations (#1622)

    CI on `refactor` is currently red because of newer toolchains, not code
    changes. Since CI runs with `-D warnings`, the following are now errors:
    
    - clippy 1.99 removed `clippy::from_iter_instead_of_collect`, so our
    `allow` for it in `lib.rs` now errors.
    - clippy 1.99 `question_mark` fires in `Indices` and the
    `Iter`/`IndexedIter` iterators.
    - clippy 1.99 `manual_checked_ops` fires in `into_scalar`.
    - Nightly (and stable in the weekly latest-deps job) now deprecates the
    legacy `std::f64` / `std::isize` modules and constants. These are used
    in `tests/numeric.rs` and in tests in `dimension/mod.rs` and `tri.rs`.
    
    No behavior change.
    
    Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
    akern40 and devin-ai-integration[bot] authored Oct 19, 2026
    Configuration menu
    Copy the full SHA
    643181c View commit details
    Browse the repository at this point in the history
  2. fix: export Ranked from the prelude (#1621)

    #1575 moved `ndim` off of `Dimension` and onto the new `Ranked`
    supertrait. Generic code with a `D: Dimension` bound still works, but
    calling `.ndim()` on a concrete dimension type now needs `Ranked` in
    scope, so this stopped compiling:
    
    ```rust
    use ndarray::prelude::*;
    Ix2(3, 4).ndim(); // E0599: trait `Ranked` is not in scope
    ```
    
    This exports `Ranked` from the prelude next to `Dimension`. Code that
    imports `ndarray::Dimension` directly, rather than going through the
    prelude, still has to import `ndarray::layout::ranked::Ranked` too.
    
    CI is red until #1622 lands. That PR fixes lints from newer toolchains
    that also fail on `refactor` itself.
    
    Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
    akern40 and devin-ai-integration[bot] authored Oct 19, 2026
    Configuration menu
    Copy the full SHA
    0745418 View commit details
    Browse the repository at this point in the history
Loading