Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterator for minors of a matrix #4169

Closed
oskarhenriksson opened this issue Oct 1, 2024 · 1 comment · Fixed by Nemocas/AbstractAlgebra.jl#1821
Closed

Iterator for minors of a matrix #4169

oskarhenriksson opened this issue Oct 1, 2024 · 1 comment · Fixed by Nemocas/AbstractAlgebra.jl#1821
Labels
enhancement New feature or request

Comments

@oskarhenriksson
Copy link

oskarhenriksson commented Oct 1, 2024

I quite often find myself needing to go through the minors of large symbolic matrices for search for one minor that has a certain property. In this scenario, it's usually not a great idea to use the minors command, since this computes a vector of all minors, which can take up a lot of time and memory.

Instead, I usually construct an own iterator in the following way:

function minors_iterator(M::MatElem, k::Int)
    row_indices = AbstractAlgebra.combinations(nrows(M), k)
    col_indices = AbstractAlgebra.combinations(ncols(M), k)
    return ( det(M[rows,cols]) for rows in row_indices for cols in col_indices )
end

Is there a built-in way of doing this?

If not, could it make sense to add something like the function above in AbtractAlgebra.jl?

@oskarhenriksson oskarhenriksson added the enhancement New feature or request label Oct 1, 2024
@lgoettgens
Copy link
Member

I cannot see any reason why this shouldn't be useful, so please go ahead, thanks!
You could then even replace the existing minors function in AA by collect(minors_iteraotr(A, k))

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 a pull request may close this issue.

2 participants