Skip to content

Add vector_random.py to support vector.random (#40316) #40319

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

Closed
wants to merge 1 commit into from

Conversation

eslteacher902010
Copy link

Adds a helper function vector_random(R, n, *args, **kwargs) in a new file src/sage/modules/vector_random.py.

This mirrors matrix.random() for API consistency and calls FreeModule(R, n).random_element(...) internally.

This change avoids modifying core files directly and supports the enhancement in issue #40316.

Adds a helper function `vector_random(R, n, *args, **kwargs)` in a new file `src/sage/modules/vector_random.py`.

This mirrors `matrix.random()` for API consistency and calls `FreeModule(R, n).random_element(...)` internally.

This change avoids modifying core files directly and supports the enhancement in issue sagemath#40316.
@eslteacher902010
Copy link
Author

Hi, I opened PR #40319 to support vector.random() as discussed. It avoids core edits and mirrors matrix.random().

Copy link

@whoami730 whoami730 left a comment

Choose a reason for hiding this comment

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

@eslteacher902010 Few comments:

@eslteacher902010
Copy link
Author

@eslteacher902010 Few comments:

Hey, and thanks for the feedback!

I've moved vector_random() into free_module.py as suggested and removed the standalone file.
The function now includes doctests covering ZZ, QQ, and GF(7) for basic usage.
Let me know if anything else should be adjusted!

@whoami730
Copy link

No changes made...

@eslteacher902010
Copy link
Author

Whoops — I didn’t realize those changes hadn’t been pushed!

I’ve NOW moved vector_random() into free_module.py, removed the standalone file, and added doctests with ZZ, QQ, and GF(7) examples.

The updated version is in PR #40344. Thanks again and please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants