elodin-sys / elodin

Physics simulation software for space + aerospace
https://elodin.systems
417 stars 13 forks source link

Added doc-comments to tensor.rs #12

Closed nestordemeure closed 7 months ago

nestordemeure commented 7 months ago

Following the discussion in issue11, here is a PR adding doc comments to tensor.rs. This is a first test in introducing AI-generated comments to document the library faster, making it easier to pick up by new users.

Here is a preview of what it looks like in conditions (cargo doc --open --no-deps --all-features):

image image

This is a test to think about the viability of this approach. Do feel free to comment and criticize (things can definitely be streamlined by hand, this PR had no manual tweak of the comments so far)!

For archival purposes, here is the prompt used to generate the comments (with GPT-4):

You will be given code from `nox`, a Rust implementation of JAX. Your goal is to doc-comment the code:
* adding a top-level doc comment (describing the current file's function),
* doc comment the functions (helping users understand the arguments and outputs of the function),
* doc comment types and traits.

Your output should be only the doc comments and headers, no need to include the rest of the code.

Also, keep your comments short and useful. No point in stating the obvious or writing a long sentence where a short one would do. Those comments should be there to help a new user understand how to use the library from a quick look.
akhilles commented 7 months ago

The commit message has a typo btw

nestordemeure commented 7 months ago

Thanks, I have fixed the commit text and removed inner comments.