Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Python

how can we represent a sparse matrix in an efficent manner using dictionary data type....? how would we compare this with the representation of matrix using list data type?... what approches will be efficent for large sprase matrix?

20th Jun 2018, 7:01 PM
jayasanka madhawa
jayasanka madhawa - avatar
4 Answers
+ 2
http://interactivepython.org/courselib/static/thinkcspy/Dictionaries/Sparsematrices.html You can read this , Jayasanka and everyone with this problem... hope this was helpful..:)
22nd Jun 2018, 8:11 AM
Savitar!!!
Savitar!!! - avatar
+ 6
I know that numpy is very efficient when it comes to vectors and matrices, in case it helps.
21st Jun 2018, 1:56 AM
Pedro Demingos
Pedro Demingos - avatar
+ 3
var m = {1, 2, 3 4, 5, 6, 7, 8, 9} that's how I think it is done
21st Jun 2018, 7:19 AM
DengSXCreates
DengSXCreates - avatar
0
What about this? {i:v for i,v in enumerate( [{i:x for x in range(3)} for i in range(3) ]} The result is a nested dict
22nd Jun 2018, 9:41 AM
You
You - avatar