Skip to content

Fix type error in divide_and_conquer/strassen_matrix_multiplication.py #8743

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 103 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
f7ba9da
updating DIRECTORY.md
Jan 2, 2023
8b44f10
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Jan 2, 2023
200fc0d
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Jan 7, 2023
3ff65ba
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Jan 12, 2023
9d1971b
updating DIRECTORY.md
Jan 12, 2023
f2e8fbd
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Jan 26, 2023
5f404b4
updating DIRECTORY.md
Jan 26, 2023
1b93899
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Feb 5, 2023
30ee318
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Mar 26, 2023
8b8a006
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Mar 26, 2023
27c2114
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Apr 1, 2023
f70ee93
updating DIRECTORY.md
Apr 1, 2023
0fd0583
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Apr 1, 2023
00857b7
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 Apr 1, 2023
7a762ea
updating DIRECTORY.md
Apr 1, 2023
af214d7
updating DIRECTORY.md
Apr 3, 2023
4065b33
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 May 10, 2023
0b2b7db
updating DIRECTORY.md
May 10, 2023
e55d7c0
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 May 15, 2023
8bf3b06
Merge branch 'TheAlgorithms:master' into master
tianyizheng02 May 16, 2023
75a94d2
Merge branch 'master' of github.com:tianyizheng02/Python
tianyizheng02 May 16, 2023
7065489
Fix strassen_matrix_multiplication.py type error
tianyizheng02 May 16, 2023
d09855b
updating DIRECTORY.md
May 16, 2023
5515b7f
Merge branch 'TheAlgorithms:master' into fix-strassen
tianyizheng02 May 17, 2023
b3ba57e
updating DIRECTORY.md
May 17, 2023
257c4a9
Fix ruff error in guess_the_number_search.py
tianyizheng02 May 17, 2023
5a32fb0
Merge branch 'master' into fix-strassen
tianyizheng02 May 18, 2023
0bf515e
Merge branch 'TheAlgorithms:master' into fix-strassen
tianyizheng02 May 29, 2023
78dafd8
New gitter link added or replaced (#8551)
KaixLina Mar 26, 2023
9cbe86a
Fix broken links to Gitter Community (Fixes: #8197) (#8546)
ChVeen Mar 26, 2023
40fed65
Reduce the complexity of graphs/bi_directional_dijkstra.py (#8165)
MaximSmolskiy Mar 28, 2023
e61c6e2
Update cnn_classification.py (#8570)
rohan472000 Mar 30, 2023
58cb9a1
added a problem on kadane's algo and its solution. (#8569)
rohan472000 Mar 31, 2023
8dfc81d
Update receive_file.py (#8541)
nikitapandeyy Mar 31, 2023
3c2ee83
Fix `mypy` errors in `lu_decomposition.py` (attempt 2) (#8100)
tianyizheng02 Apr 1, 2023
74d105d
updating DIRECTORY.md
Apr 1, 2023
e1de317
Add Project Euler problem 187 solution 1 (#8182)
MaximSmolskiy Apr 1, 2023
3c50847
change space complexity of linked list's __len__ from O(n) to O(1) (#…
amirsoroush Apr 1, 2023
70e96f3
chore: additional Project Euler solution hash (#8593)
dhruvmanila Apr 1, 2023
02e593d
Add Project Euler problem 800 solution 1 (#8567)
MaximSmolskiy Apr 1, 2023
63deae6
Add Project Euler problem 94 solution 1 (#8599)
MaximSmolskiy Apr 1, 2023
d9bc5c3
Remove extra `len` calls in doubly-linked-list's methods (#8600)
amirsoroush Apr 1, 2023
4991ef3
Reduce the complexity of digital_image_processing/edge detection/cann…
MaximSmolskiy Apr 1, 2023
6a500cd
Fix `mypy` errors in `dilation_operation.py` (#8595)
tianyizheng02 Apr 1, 2023
a4e31a0
Graham's Law (#8162)
ApolloEagle Apr 1, 2023
9713a98
updating DIRECTORY.md
Apr 1, 2023
2c957e7
Reenable files when TensorFlow supports the current Python (#8602)
MaximSmolskiy Apr 1, 2023
803c041
Revamp `md5.py` (#8065)
tianyizheng02 Apr 1, 2023
03c0e28
Rename quantum_random.py.DISABLED.txt to quantum_random.py (#8601)
cclauss Apr 2, 2023
af1863e
Add Project Euler problem 79 solution 1 (#8607)
ishabahmed Apr 2, 2023
4a8bafd
updating DIRECTORY.md
Apr 3, 2023
6aadf4a
[pre-commit.ci] pre-commit autoupdate (#8611)
pre-commit-ci[bot] Apr 4, 2023
540a775
Add LeNet Implementation in PyTorch (#7070)
ishandutta0098 Apr 7, 2023
b916450
Revert "Add LeNet Implementation in PyTorch (#7070)" (#8621)
cclauss Apr 8, 2023
9609b48
Queue implementation using two Stacks (#8617)
amirsoroush Apr 8, 2023
724ab7b
Delete queue_on_two_stacks.py which duplicates queue_by_two_stacks.py…
cclauss Apr 8, 2023
ceddbd1
Bloom Filter (#8615)
isidroas Apr 8, 2023
7ac4a83
[pre-commit.ci] pre-commit autoupdate (#8634)
pre-commit-ci[bot] Apr 10, 2023
37a9db1
Dimensionality reduction (#8590)
Diegomangasco Apr 16, 2023
bcc5746
Create real_and_reactive_power.py (#8665)
rohan472000 Apr 17, 2023
772f26c
Create apparent_power.py (#8664)
rohan472000 Apr 18, 2023
c35db4d
added reference link. (#8667)
rohan472000 Apr 18, 2023
cbcaf06
added a problem with solution on sliding window. (#8566)
rohan472000 Apr 18, 2023
27dd4f3
Create maths/pi_generator.py (#8666)
JulianStiebler Apr 18, 2023
5d8142d
Update linear_discriminant_analysis.py and rsa_cipher.py (#8680)
rohan472000 Apr 24, 2023
3021eda
[pre-commit.ci] pre-commit autoupdate (#8691)
pre-commit-ci[bot] Apr 25, 2023
1809c2c
The tanh activation function is added (#8689)
TMGA-WAY Apr 25, 2023
0fe7cf1
Solving the `Top k most frequent words` problem using a max-heap (#8685)
cclauss Apr 27, 2023
a354342
Added an algorithm to calculate the present value of cash flows (#8700)
sahilg13 Apr 30, 2023
1069240
Fix docstring in present_value.py (#8702)
cclauss May 1, 2023
4ce4dd5
Added minimum waiting time problem solution using greedy algorithm (#…
Himanshutomar31 May 1, 2023
22101d5
[pre-commit.ci] pre-commit autoupdate (#8704)
pre-commit-ci[bot] May 1, 2023
54f1a13
The ELU activation is added (#8699)
TMGA-WAY May 2, 2023
2602b85
Update game_of_life.py (#8703)
pronoym99 May 10, 2023
f98ddf8
Update and_gate.py (#8690)
rohan472000 May 10, 2023
e67541c
Working binary insertion sort in Python (#8024)
shricubed May 10, 2023
c576ab9
Switch case (#7995)
meg-1 May 10, 2023
71b45e1
adding the remove digit algorithm (#6708)
meg-1 May 10, 2023
47ae3ad
Create maximum_subsequence.py (#7811)
pronoym99 May 10, 2023
6285b37
updating DIRECTORY.md
May 10, 2023
d50f7ea
Correct ruff failures (#8732)
CaedenPH May 14, 2023
e5d5594
[pre-commit.ci] pre-commit autoupdate (#8716)
pre-commit-ci[bot] May 15, 2023
596422b
Reduce the complexity of genetic_algorithm/basic_string.py (#8606)
MaximSmolskiy May 15, 2023
f33c50c
Fix strassen_matrix_multiplication.py type error
tianyizheng02 May 16, 2023
acb33c0
updating DIRECTORY.md
May 16, 2023
3414fec
`local_weighted_learning.py`: fix `mypy` errors and more (#8073)
tianyizheng02 May 17, 2023
eb7042d
Added odd_sieve.py (#8740)
r0sa2 May 17, 2023
d766d57
Add h index (#8036)
alexpantyukhin May 17, 2023
7dfe5a4
Create guess_the_number_search.py (#7937)
hakiKhuva May 17, 2023
7a0752c
updating DIRECTORY.md
May 17, 2023
115c7f5
Fixes broken "Create guess_the_number_search.py" (#8746)
CaedenPH May 17, 2023
bb9a735
Added is_palindrome.py (#8748)
r0sa2 May 18, 2023
f743d95
add __main__ around print (#8747)
DanielLuo7 May 19, 2023
c44566d
[pre-commit.ci] pre-commit autoupdate (#8759)
pre-commit-ci[bot] May 23, 2023
73586e5
Mark fetch anime and play as broken (#8763)
CaedenPH May 25, 2023
21ba90f
Dual Number Automatic Differentiation (#8760)
ChrisO345 May 25, 2023
6d128ad
Fix CI badge in the README.md (#8137)
ratneshrt May 25, 2023
155924b
Merge and add benchmarks to palindrome algorithms in the strings/ dir…
CaedenPH May 25, 2023
7333b51
fix: graphs/greedy_best_first typo (#8766)
JadeKim042386 May 25, 2023
9af6da8
Rename is_palindrome.py to is_int_palindrome.py (#8768)
cclauss May 26, 2023
58eddb4
Add more ruff rules (#8767)
cclauss May 26, 2023
41c74b6
Fix ruff errors
tianyizheng02 May 29, 2023
756b85b
Merge branch 'fix-strassen' of github.com:tianyizheng02/Python into f…
tianyizheng02 May 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
* [Mergesort](divide_and_conquer/mergesort.py)
* [Peak](divide_and_conquer/peak.py)
* [Power](divide_and_conquer/power.py)
* [Strassen Matrix Multiplication](divide_and_conquer/strassen_matrix_multiplication.py)

## Dynamic Programming
* [Abbreviation](dynamic_programming/abbreviation.py)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,19 @@ def strassen(matrix1: list, matrix2: list) -> list:
[[139, 163], [121, 134], [100, 121]]
"""
if matrix_dimensions(matrix1)[1] != matrix_dimensions(matrix2)[0]:
raise Exception(
"Unable to multiply these matrices, please check the dimensions. \n"
f"Matrix A:{matrix1} \nMatrix B:{matrix2}"
msg = (
"Unable to multiply these matrices, please check the dimensions.\n"
f"Matrix A: {matrix1}\n"
f"Matrix B: {matrix2}"
)
raise Exception(msg)
dimension1 = matrix_dimensions(matrix1)
dimension2 = matrix_dimensions(matrix2)

if dimension1[0] == dimension1[1] and dimension2[0] == dimension2[1]:
return [matrix1, matrix2]

maximum = max(dimension1, dimension2)
maximum = max(*dimension1, *dimension2)
maxim = int(math.pow(2, math.ceil(math.log2(maximum))))
new_matrix1 = matrix1
new_matrix2 = matrix2
Expand Down