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

Added rank of matrix in linear algebra #8687

Merged
merged 21 commits into from
May 31, 2023
Merged

Conversation

rudransh61
Copy link
Contributor

Hi i am rudransh ,
I added a python file to find rank of matrix because i cannot find it anywhere in code base .
So, i thought that "lets contribute ".
Please try to pull this so that the set of algorithm will be completed.
If there is any error , inform me i will try to correct this.
AND AT LAST I WOULD LIKE TO SAY PLEASE SET IT UP IN A VIRTUAL ENVIRONMENT SO THAT NEW VERSIONS OF REQUIREMENT AND PYTHON WILL NOT AFFECT ANYONE..
THANK YOU FOR READING THIS
A PROGRAMMER
RUDRANSH BHARDWAJ

@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Apr 24, 2023
""" BY - RUDRANSH BHARDWAJ"""


def swapRows(a, row1, row2):
Copy link
Contributor

Choose a reason for hiding this comment

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

To resolve ruff errors, you should rename these functions to use lowercase letters. For example, you could rename "swapRows" to "swap_rows", "Row_Transformation" to "row_transformation", and "MatrixRank" to "matrix_rank".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok let me try

Copy link
Contributor

@rohan472000 rohan472000 left a comment

Choose a reason for hiding this comment

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

The error message you received in pre-commit indicates that the file "Rank_of_Matrix.py" contains uppercase characters in its filename, which violates a common naming convention for Python files.

To resolve this error, you should rename the file to use lowercase letters instead. For example, you could rename it to "rank_of_matrix.py" instead.

@algorithms-keeper algorithms-keeper bot added require descriptive names This PR needs descriptive function and/or variable names require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Apr 25, 2023
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

""" BY - RUDRANSH BHARDWAJ"""


def swap_rows(a, row1, row2):

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file linear_algebra/src/Rank_of_Matrix.py, please provide doctest for the function swap_rows

Please provide return type hint for the function: swap_rows. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide descriptive name for the parameter: a

Please provide type hint for the parameter: a

Please provide type hint for the parameter: row1

Please provide type hint for the parameter: row2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok i will try
Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done👌

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bot, so no need to reply...just do as it suggests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

return a


def Row_Transformation(a, x, row1, row2):

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file linear_algebra/src/Rank_of_Matrix.py, please provide doctest for the function Row_Transformation

Please provide return type hint for the function: Row_Transformation. If the function does not return a value, please provide the type hint as: def function() -> None:

Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: Row_Transformation

Please provide descriptive name for the parameter: a

Please provide type hint for the parameter: a

Please provide descriptive name for the parameter: x

Please provide type hint for the parameter: x

Please provide type hint for the parameter: row1

Please provide type hint for the parameter: row2

return a


def MatrixRank(a):

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file linear_algebra/src/Rank_of_Matrix.py, please provide doctest for the function MatrixRank

Please provide return type hint for the function: MatrixRank. If the function does not return a value, please provide the type hint as: def function() -> None:

Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: MatrixRank

Please provide descriptive name for the parameter: a

Please provide type hint for the parameter: a

Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

""" BY - RUDRANSH BHARDWAJ"""


def swap_rows(a, row1, row2):

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file linear_algebra/src/Rank_of_Matrix.py, please provide doctest for the function swap_rows

Please provide return type hint for the function: swap_rows. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide descriptive name for the parameter: a

Please provide type hint for the parameter: a

Please provide type hint for the parameter: row1

Please provide type hint for the parameter: row2

return a


def row_transformation(a, x, row1, row2):

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file linear_algebra/src/Rank_of_Matrix.py, please provide doctest for the function row_transformation

Please provide return type hint for the function: row_transformation. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide descriptive name for the parameter: a

Please provide type hint for the parameter: a

Please provide descriptive name for the parameter: x

Please provide type hint for the parameter: x

Please provide type hint for the parameter: row1

Please provide type hint for the parameter: row2

return a


def matrix_rank(a):

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file linear_algebra/src/Rank_of_Matrix.py, please provide doctest for the function matrix_rank

Please provide return type hint for the function: matrix_rank. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide descriptive name for the parameter: a

Please provide type hint for the parameter: a

Copy link
Contributor

@rohan472000 rohan472000 left a comment

Choose a reason for hiding this comment

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

Kindly rename as I have suggested

@rudransh61
Copy link
Contributor Author

I want 1 week because i had found some bugs in file
so after some time it will ready for production

@rudransh61
Copy link
Contributor Author

i had completed all but failing in changing the file name
i you can then please help me to change the name
before pushing it on repository the name was "rank_of_matrix" but after i pushed it into repository idk why it changed into "Rank_of_Matrix" ???

@rudransh61
Copy link
Contributor Author

now all the errors and naming patterns are corrected except the name

Copy link
Contributor

@rohan472000 rohan472000 left a comment

Choose a reason for hiding this comment

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

it should be rank_of_matrix.py because it is a standard practice to write file name in lowercase.

@algorithms-keeper algorithms-keeper bot removed require descriptive names This PR needs descriptive function and/or variable names require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Apr 26, 2023
@rudransh61
Copy link
Contributor Author

finnally after trying for 2hrs i renamed the file

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Apr 26, 2023
@rudransh61
Copy link
Contributor Author

doneee

@rudransh61
Copy link
Contributor Author

and thank you for your feedbacks

@rudransh61
Copy link
Contributor Author

....is it ok to merge pull request or it is not okay

@rudransh61
Copy link
Contributor Author

.....can you merge this fork

@rohan472000
Copy link
Contributor

rohan472000 commented Apr 28, 2023

I'm just a contributor, I don't have write access.
Kindly ask @cclauss for a review.

@rudransh61
Copy link
Contributor Author

how can i ask him for review??

>>> rank_of_matrix([[3,2,1],
... [-6,-4,-2]])
1
>>> rank_of_matrix([[],[]])
Copy link
Member

Choose a reason for hiding this comment

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

Please add: >>> rank_of_matrix([[]])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok sir

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your suggestions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope this is ready to merge
and thanks to @rohan472000 and @cclauss for their feedbacks and suggestions

rudransh61 and others added 4 commits April 30, 2023 14:30
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
@rudransh61 rudransh61 requested a review from cclauss April 30, 2023 09:03
@rudransh61
Copy link
Contributor Author

@cclauss please review and merge this (if it is ready)

@rudransh61
Copy link
Contributor Author

I think now this is okk/?

@cclauss
Copy link
Member

cclauss commented May 22, 2023

mypy.....................................................................Failed

  • hook id: mypy
  • exit code: 1

linear_algebra/src/rank_of_matrix.py:66: error: No overload variant of "setitem" of "list" matches argument types "int", "float" [call-overload]
linear_algebra/src/rank_of_matrix.py:66: note: Possible overload variants:
linear_algebra/src/rank_of_matrix.py:66: note: def setitem(self, SupportsIndex, int, /) -> None
linear_algebra/src/rank_of_matrix.py:66: note: def setitem(self, slice, Iterable[int], /) -> None
Found 1 error in 1 file (checked 1186 source files)

@rudransh61
Copy link
Contributor Author

i didnt understand ??? is there any error in code or something else???
I think there is some error while merging ???
or this is something strange ???
please tell me what is this , and what is hook id .....

I dont understand "mypy"

sorry sir for disturbing you but please help meeeeeee??

Copy link
Contributor

@CaedenPH CaedenPH left a comment

Choose a reason for hiding this comment

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

@rudransh61 Merge my commit and the checks will pass

cclauss and others added 2 commits May 30, 2023 15:06
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Copy link
Contributor Author

@rudransh61 rudransh61 left a comment

Choose a reason for hiding this comment

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

nice
checks are not showing error

@rudransh61
Copy link
Contributor Author

oooooooooooo Thankakanakankankaaaasssss brooooo

FOR HELPING MEEEEEEEEEEEEEE
NOW 2 CHECKS ARE COMPLETED

you r genius ???? you are pro coderrr @CaedenPH
THANKSSS

@rudransh61
Copy link
Contributor Author

broooo you aree god

@rudransh61
Copy link
Contributor Author

I think now it is ready to deploy??

@rudransh61
Copy link
Contributor Author

Thanks to all reviews and other developers to help mee

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Let's do this!

@cclauss cclauss merged commit e871540 into TheAlgorithms:master May 31, 2023
sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* Added rank of matrix in linear algebra

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Corrected name of function

* Corrected Rank_of_Matrix.py

* Completed rank_of_matrix.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* delete to rename Rank_of_Matrix.py

* created rank_of_matrix

* added more doctests in rank_of_matrix.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed some issues in rank_of_matrix.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added moreeee doctestsss in rank_of_mtrix.py and fixed some bugss

* Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update rank_of_matrix.py

* Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants