I Learned a lot about operator overriding, oop, the practical use of parameter keywords like inout, borrowed, and owned, c-style memory management/ pointers in mojo, and much more. Tutorials like this are hard to find this early on in the life of a new programming language, and I appreciate your pioneering efforts and your effective explanations. I look forward to your future videos!
I like this series much more since it explains concepts new comparing to Python. Waiting for videos explaining system - level stuff like parameters / compile time stuff / inlining etc :)
In the equals function, you should first check if the dimensions of the two matrices are the same. Otherwise, you may be accessing elements out of bounds from the other matrix.
Very wonderful, one of the few people who have begun to explain this new language. We are waiting for more from you and waiting for the Machine learning and deep learning course in the Mojo language
When you define the operators for addition, subtraction and multiplication with scalars, does it matter in which order you put them into the expression? I ask because you always name the argument "rhs", and I don't know if you could put the rhs on the left side. E.g., when coding, can you do "matrix + \lambda" as well as "\lambda + matrix"?
Nice, but there is a bug in the __init__() you should specify self.total_items = self.width * self.height and not width * height because. The actual width and height of the table are the "self" ones and changed to 1 if passed a zero. For a sake of completeness I would test the allocation and the actual size of the array.
you've overloaded your __mul__ method for scalar multiplication of your matrix e.g. M*2; Will you need to implement __rmul__ in order to be able to right multiply by a scalar e.g. 2*M also, its defined currently for rhs: Float32; does it need overlaods for all the other scalar types (Int, Flaot64...)?
Yep, so you have to implement a separate method if you want to do 2*M. I believe there are generics to work with in mojo. It's been a while since I programmed in mojo. You could check out the documentation page.
would you be able to do a video on implementing a dictionary in mojo? I know the standard library doesn't have them but i'm sure with stucts you and fancy pointer magic it could work. I tried to use register passable pointers but still couldn't get it to compile...
@@activelearning4386 amazing thank you! its been bothering me lately because i wanted to run some benchmarks on how a custom made dict using mojo structs would compare to importing a dict using the python interop
Great tutorials But I didn't understand why in the __copyinit__ method, you define the type of other to Self rather than Matrix. Does the Self indicate to the instantiated object of the Matrix class?
Self here is used to indicate that the type is the same as the class to which the method belongs. You can also just use Matrix here :) Here's a more in depth guide for Self in python that's applicable to Mojo: peps.python.org/pep-0673/
In your __setitem__ method, your're using the `inout` directive for `self`, on the basis that `self` is going to change. Is this correct? Surely the underlying value of self will stay the same, and only the associated data will change. It may well be that the semantics of Mojo are different, but in Delphi, and Java, `self`, by definition, is immutable!
Plenty of bugs in this code, and very questionable implementation choices. Example, the __eq__ method assumes rhs is the same dimensions as self. This is my very first look at mojo so I don’t know but isn’t there a simpler memcmp to compare the 2 memory blocks? (not that you should compare floats for equality using a straight == operator anyway, due to precision issues, best to compare for equality within a tolerance for floating point data).
I Learned a lot about operator overriding, oop, the practical use of parameter keywords like inout, borrowed, and owned, c-style memory management/ pointers in mojo, and much more. Tutorials like this are hard to find this early on in the life of a new programming language, and I appreciate your pioneering efforts and your effective explanations. I look forward to your future videos!
Thank you so much for your support! :)
Don't mind the length. These are really good videos, excellent pace, very clear. Thank you!
Thank you so much!
Bro this is so cool. Your mice is also pretty good in this video compared to your old videos !
Thank you fam!
I like this series much more since it explains concepts new comparing to Python. Waiting for videos explaining system - level stuff like parameters / compile time stuff / inlining etc :)
Thank you! I will look into making those videos :)
In the equals function, you should first check if the dimensions of the two matrices are the same. Otherwise, you may be accessing elements out of bounds from the other matrix.
Very wonderful, one of the few people who have begun to explain this new language. We are waiting for more from you and waiting for the Machine learning and deep learning course in the Mojo language
Thank you for your support!
When you define the operators for addition, subtraction and multiplication with scalars, does it matter in which order you put them into the expression? I ask because you always name the argument "rhs", and I don't know if you could put the rhs on the left side.
E.g., when coding, can you do "matrix + \lambda" as well as "\lambda + matrix"?
Nice, but there is a bug in the __init__()
you should specify self.total_items = self.width * self.height and not width * height because.
The actual width and height of the table are the "self" ones and changed to 1 if passed a zero.
For a sake of completeness I would test the allocation and the actual size of the array.
Thank you for your feedback! You are right!
@@activelearning4386Not the only bug. if loc > self.total_items is also wrong. should be >=
you've overloaded your __mul__ method for scalar multiplication of your matrix e.g. M*2;
Will you need to implement __rmul__ in order to be able to right multiply by a scalar e.g. 2*M
also, its defined currently for rhs: Float32; does it need overlaods for all the other scalar types (Int, Flaot64...)?
Yep, so you have to implement a separate method if you want to do 2*M. I believe there are generics to work with in mojo. It's been a while since I programmed in mojo. You could check out the documentation page.
Which theme of visual studio are you using
This is the theme: marketplace.visualstudio.com/items?itemName=pmndrs.pmndrs
would you be able to do a video on implementing a dictionary in mojo? I know the standard library doesn't have them but i'm sure with stucts you and fancy pointer magic it could work. I tried to use register passable pointers but still couldn't get it to compile...
Sure! I will look into it tomorrow!
@@activelearning4386 amazing thank you! its been bothering me lately because i wanted to run some benchmarks on how a custom made dict using mojo structs would compare to importing a dict using the python interop
Great tutorials
But I didn't understand why in the __copyinit__ method, you define the type of other to Self rather than Matrix.
Does the Self indicate to the instantiated object of the Matrix class?
Self here is used to indicate that the type is the same as the class to which the method belongs. You can also just use Matrix here :) Here's a more in depth guide for Self in python that's applicable to Mojo: peps.python.org/pep-0673/
Hi, in 22:07 you are mistaken. Since you fetched Float32 from the "array" you can compare it with == opeartor.
Cool tutorial really...also cool theme ..what is it ?the color coded scopes are nice
Thanks! This is the theme: marketplace.visualstudio.com/items?itemName=pmndrs.pmndrs
In your __setitem__ method, your're using the `inout` directive for `self`, on the basis that `self` is going to change. Is this correct? Surely the underlying value of self will stay the same, and only the associated data will change. It may well be that the semantics of Mojo are different, but in Delphi, and Java, `self`, by definition, is immutable!
Yep, inout just allows you to modify the data associated with self. You aren't changing the entire object that self refers to.
Plenty of bugs in this code, and very questionable implementation choices. Example, the __eq__ method assumes rhs is the same dimensions as self. This is my very first look at mojo so I don’t know but isn’t there a simpler memcmp to compare the 2 memory blocks? (not that you should compare floats for equality using a straight == operator anyway, due to precision issues, best to compare for equality within a tolerance for floating point data).
Proprietary sh.t. I will never get even close to it, thank you. Julia is a way better choice.