Commit Graph

27 Commits

Author SHA1 Message Date
wuyudi
367f8ceddd
enhance the ability of add (#2178)
* enhance the ability of add

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix/matrix_operation.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-07 00:22:44 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
vinayak
70cf565387
black (#2166)
* black

* Update matrix/matrix_operation.py

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

* Update matrix/matrix_operation.py

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

* Update matrix/matrix_operation.py

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

* Update matrix/matrix_operation.py

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

* flake8 error fix

* Remove unreachable code

* union

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-04 13:22:21 +05:30
wuyudi
f70a0a2980
Update matrix_operation.py (#2159)
* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* use yapf to format the code

* recover the error check

* add typing hint

* Update matrix/matrix_operation.py

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

* Update matrix/matrix_operation.py

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

* Update matrix/matrix_operation.py

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

* Update matrix/matrix_operation.py

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

* add float doctest

* black formated

* Update searching_in_sorted_matrix.py

* recover this file

* f-string, typing hint , doctest

* Update matrix_operation.py

* Update searching_in_sorted_matrix.py

* Update matrix_operation.py

* Update matrix/matrix_operation.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: vinayak <itssvinayak@gmail.com>
2020-07-04 00:58:16 +05:30
Muhammadrasul
4a2d457747
Count (#2084)
* Add files via upload

* Update and rename count_islands.py to count_islands_in_matrix.py

* Update matrix/count_islands_in_matrix.py

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

* Update matrix/count_islands_in_matrix.py

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

* Update matrix/count_islands_in_matrix.py

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

* Reformat count islands.py

* Indent Python code with 4 spaces, not tabs

* Update count_islands_in_matrix.py

* Add type hints for return values

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 14:36:09 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
onlinejudge95
7b7c1a0135
Fixes unused variable errors in LGTM (#1746)
* Fixes unsed variable errors in LGTM

* Fixes integer check

* Fixes failing tests
2020-02-11 13:59:09 +05:30
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Christian Clauss
28419cf839 pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
2020-01-03 22:25:36 +08:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Christian Clauss
030600f9b3
Update matrix_class.py (#1175) 2019-09-10 07:49:07 +02:00
Jasper
5b483be73b Added OOP approach to matrices (#1165)
* Added OOP aproach to matrices

* created methods for minors, cofactors, and determinants and added corresponding doctests

* Added methods for adjugate, inverse, and identity (along with corresponding doctests) to matrix_class.py
A small bug persists that causes the doctest to fail.
After a couple Matrix objects are printed, the next one is printed in a different format.

* formatted matrix_class.py with python/black

* implemented negation and exponentiation as well as corresponding doctests in matrix_class.py.  Also implemented eq and ne comparison operations

* changed __str__ method in matrix_class.py to align with numpy standard and fixed bug in cofactors method

* removed property decorators from several methods in matrix_class.py
2019-09-08 07:07:14 +02:00
McDic
9492e7af7c Created Sherman Morrison method (#1162)
* Created Sherman Morrison

* Added docstring for class

* Updated Sherman morrison

1. Added docstring tests
2. Tweaked __str__() using join
3. Added __repr__()
4. Changed index validation to be independent method

* Applied cclauss's point

1. Reduced line length for __str__()
2. Removed parens for assert
2019-09-03 09:02:53 +02:00
Christian Clauss
47a9ea2b0b
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python

* sort() --> sorted()
2019-08-19 15:37:49 +02:00
Christian Clauss
b2ed8d443c
rotate_matrix.py: Add type hints for return values (#1023)
* rotate_matrix.py: Add type hints for return values

@obelisk0114 Your review please?

* Fix typo

* Run the code thru python/black

https://github.com/python/black

* Fix 270 comment

* Simplify with get_data() and test the alternatives

* ) * 3

* Update rotate_matrix.py

* Update rotate_matrix.py
2019-07-23 00:07:09 +02:00
Stephen Gemin
4e0717c3cf Add error & test checks for matrix_operations.py (#925)
* Update matrix_operation.py

1. Adding error checks for integer inputs
2. Adding error checks for matrix operations where size requirements do not match up
3. Added matrix subtraction function
4. included error check so only integer is passed into identity function

* Create test_matrix_operation.py

* Update matrix_ops and Add Test Cases

1. Included error checks in matrix operation.  There were some cases where the functions would not work correctly.

2. PEP8 changes to matrix_operations.py

3. added test cases for matrix operations using pytest.

* Update pytest.ini

Add carriage return to end of file
2019-07-20 05:06:29 +02:00
cclauss
dc1de946ea Use correct function names in nth_fibonacci_using_matrix_exponentiation.py (#1045)
@AnupKumarPanwar @ParthS007 @poyea Could I please get a quick review on this one because I made a mistake here that breaks the build for new pull requests.
2019-07-19 16:55:45 +08:00
Md. Mahbubur Rahman
60c608d85a Added matrix exponentiation approach for finding fibonacci number. (#1042)
* Added matrix exponentiation approach for finding fibonacci number.

* Implemented the way of finding nth fibonacci.
* Complexity is about O(log(n)*8)

* Updated the matrix exponentiation approach of finding nth fibonacci.

- Removed some extra spaces    
- Added the complexity of bruteforce algorithm  
- Removed unused function called zerro()  
- Added some docktest based on request

* Updated the matrix exponentiation approach of finding nth fibonacci.

- Removed some extra spaces
- Added the complexity of bruteforce algorithm
- Removed unused function called zerro()
- Added some docktest based on request

* Tighten up main() and add comments on performance
2019-07-19 09:41:37 +02:00
obelisk0114
3b2738ed89 Add rotate matrix problem (#1021)
* Add rotate matrix problem

* Fix doctest

* Adding return matrix to enable doctest
2019-07-15 08:48:35 +02:00
Anup Kumar Panwar
4e413c0183 Updated README 2019-07-06 11:11:20 +05:30
brajesh-rit
be4150c720 Create spiralPrint.py (#844)
* Create spiralPrint.py

* Update spiralPrint.py
2019-06-26 23:57:08 +08:00
Hector S
05e5172093 .vs/ directory, matrix_multiplication_addition file and binary tree directory (#894)
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per #893

* Rename matrix_multiplication_addition.py to matrix_operation.py
2019-06-11 19:24:53 +08:00
RayCurse
441b82a95f More matrix algorithms (#745)
* added matrix minor

* added matrix determinant

* added inverse,scalar multiply, identity, transpose
2019-03-28 01:50:43 +08:00
Ishani
d27968b78d Create Searching in sorted matrix (#738)
* Create Searching in sorted matrix

* Rename Searching in sorted matrix to searching_in_sorted_matrix.py
2019-03-20 23:59:35 +08:00
Shivam Arora
506172279a Addition and multiplication algorithm of two square matrix 2018-10-31 15:17:11 +05:30