Skip to content

Add vector.random method to FreeModule for consistency with matrix.random #40344

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 5 commits into from

Conversation

eslteacher902010
Copy link

@eslteacher902010 eslteacher902010 commented Jun 30, 2025

Updated

This PR moves vector_random(R, n, *args, **kwargs) into the FreeModule_ambient class as a method and NOT a function:

random(self, *args, **kwargs) in src/sage/modules/free_module.py.

—Also, I did my best to eliminate verbosity and follow the project guidelines. I hope this satisfies.

I’m still new to contributing here, so I really appreciate your guidance and patience. Thank you!

Ps. I will probably be stepping away from this project. I feel a little in too deep. Thanks again.

paulkniaz added 2 commits June 30, 2025 12:16
Adds vector_random() as a wrapper for FreeModule(...).random_element(),
mirroring matrix.random() for API symmetry. Includes a basic test.
@eslteacher902010
Copy link
Author

Small note: The earlier commit mentions a test file, but that was just temporary while checking behavior. The final PR only includes doctests inside vector_random(), as discussed — no standalone test file added.

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.

  • As I said earlier, please reduce or avoid AI slop. It looks like everything including code, commit/PR message etc are AI generated. If you wish to do that, please do a self review of your own PR before proceeding to ask for review.
  • Fix PR title and avoid raising new PRs for each change, this loses history.
  • We already have random_vector function. Having another vector_random function is redundant. What is instead needed to have is a vector.random method akin to matrix.random method. Consider looking at the implementation of the same.
  • Both random_vector and vector.random should ideally share implementation as well.

@eslteacher902010 eslteacher902010 changed the title Move vector_random() to free_module.py with doctests Add vector.random method to FreeModule for consistency with matrix.random Jul 4, 2025
@user202729
Copy link
Contributor

the function should be accessible as vector.random(), not V.random() or whatever. I recommend trying out the existing functions to get a better understanding on why the proposal is consistent with the existing functions.

Since you're not working on this, I suppose I will just close the pull request.

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.

3 participants