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

Refactored src/ and tests/ files to be compliant to rustfmt #55

Merged
merged 4 commits into from
Aug 1, 2022

Conversation

meliurwen
Copy link
Collaborator

@meliurwen meliurwen commented Jul 30, 2022

Description

See the issue related, what is done in the commits and in the changelog below.

Issues related

Merge into Dev Checklist

  • Tests for the new code
  • Acceptance Testing

Changelog

  • Refactored src/ files to be compliant to rustfmt
  • Refactored tests/ files to be compliant to rustfmt
  • Disabled tests/ folder for rustfmt

(Optional) Extra info

None

@meliurwen meliurwen added the refactor Change in the structure label Jul 30, 2022
@meliurwen meliurwen self-assigned this Jul 30, 2022
@meliurwen meliurwen linked an issue Jul 30, 2022 that may be closed by this pull request
2 tasks
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
tests/structure_learning.rs Outdated Show resolved Hide resolved
@meliurwen
Copy link
Collaborator Author

On the official rustfmt repo I've found that there's an ongoing issue open about the matrices topic.

At the moment probably an acceptable workaround could be to set rustfmt to skip all the files in tests/ folder and revert all the matrices.

@AlessandroBregoli

@meliurwen
Copy link
Collaborator Author

I've spotted 3 different kinds of notations used for rank-3 tensors; I would suggest to use the same notation for clarity and consistency.

Here the 3 notations spotted, personally I find the notation number 2 the more clean:

[
    [[ 0,  2,  3],
     [ 4,  0,  6],
     [ 7,  8,  0]],
    [[0, 12,  90],
     [ 3, 0,  40],
     [ 6, 40,  0]],
    [[ 0,  2,  3],
     [ 4,  0,  6],
     [ 44, 66, 0]]
]
[
    [
        [ 0,  2,  3],
        [ 4,  0,  6],
        [ 7,  8,  0]
    ],
    [
        [0, 12,  90],
        [ 3, 0,  40],
        [ 6, 40,  0]
    ],
    [
        [ 0,  2,  3],
        [ 4,  0,  6],
        [ 44, 66, 0]
    ],
]
[
    [[-1.0, 0.5, 0.5], [3.0, -4.0, 1.0], [0.9, 0.1, -1.0]],
    [[-6.0, 2.0, 4.0], [1.5, -2.0, 0.5], [3.0, 1.0, -4.0]],
    [[-1.0, 0.1, 0.9], [2.0, -2.5, 0.5], [0.9, 0.1, -1.0]],
]

If you agree @AlessandroBregoli I would also proceed to conform all the rank-3 tensors in tests/ to the notation number 2 listed above.

@meliurwen
Copy link
Collaborator Author

We can't use ignore option into rustfmt.toml because it is not stable yet;

on the official rustfmt repo and its issues is suggested to use the inner attribute #![rustfmt::skip] instead, which is suboptimal for this use case and is also unstable on Rust, so we can't use this neither...

At this point I would give up and use cargo +nightly fmt with only ignore enabled as a non-stable option.

@meliurwen meliurwen merged commit a5b24e9 into dev Aug 1, 2022
@meliurwen meliurwen deleted the 54-refactor-make-the-code-compliant-to-rustfmt branch August 1, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Change in the structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] Make the code compliant to rustfmt
2 participants