Skip to content

Conversation

@nathanielpritchard
Copy link
Contributor

@nathanielpritchard nathanielpritchard commented Jan 30, 2026

Description

This pull request creates the CUR approximator feature requrested in https://github.com/numlinalg/RLinearAlgebra.jl/issues/147. It contains implementation for the CUR
approximator and the CURCore structures. The CUR approximator is a global structure which is implemented to allow matrix multiplications and eventually back solve operations, the CURCore is how the CUR is fine tuned.

As an example of how this differentiation is necessary, for a selection of rows and columns the core matrix can be formed in at least two different ways. One is the optimal way where if $C$ is the select columns and $R$ is the selected rows from $A$ the core matrix $U = $C^\dagger A R^\dagger$. As this core requires additional accesses to the matrix, that are suboptimal we can also define $U = A[I, J]$ where $I$ are the row indices that make up $R$ and $J$ are the row indices that make up $C$.

This PR features three new files

  • cur.jl which includes the structures for the cur decomposition and the functions complete_approximator and mul!.
  • CURCore.jl defines abstract types corresponding to the CUR core matrix, as well as a CURCoreAdjoint structure. The functions include basic mul! functionality similar to Compressors.jl, the size function, as well as the revenant completion and update functions (although for compilation reasons these functions are actually placed in cur.jl.
  • cross_approximation.jl, features the implementation of the cross approximation CUR core, as well as the complete function and the rapproximate! function. rapproximate is implemented to correspond to the CURCore and not the CUR because the ordering of selection varies based on the CURCore that is used. So it makes sense that the implementation would align with that and not the CUR data structure.

How has this been tested

] activate .
test

Types of changes

  • CI
  • Docs
  • Feature
  • Fix
  • Performance
  • Refactor
  • Style
  • Test
  • Other (use sparingly):

Checklists:

Code and Comments
If this PR includes modification to the code base, please select all that apply.

  • My code follows the code style of this project.
  • I have updated all package dependencies (if any).
  • I have included all relevant files to realize the functionality of the PR.
  • I have exported relevant functionality (if any).

API Documentation

  • For every exported function (if any), I have included a detailed docstring.
  • I have checked the spelling and grammar of all docstring updates through an external tool.
  • I have checked that the docstring's function signature is correctly formatted and has all arguments.
  • I have checked that the docstring's list of arguments, fields, or return values match the function.
  • I have compiled the docs locally and read through all docstring updates to check for errors.

Manual Documentation

  • I have checked the spelling and grammar of all manual updates through an external tool.
  • Any code included in the docstring is tested using doc tests to ensure consistency.
  • I have compiled the docs locally and read through all manual updates to check for errors.

Testing

  • I have added unit tests to cover my changes. (For Macros, be sure to check
    @code_lowered and
    @code_typed)
  • All new and existing tests passed.
  • I have achieved sufficient code coverage.

@nathanielpritchard nathanielpritchard self-assigned this Jan 30, 2026
@nathanielpritchard nathanielpritchard added the enhancement New feature or request label Jan 30, 2026
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@dmaldona dmaldona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants