-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
rst_files/linear_algebra.rst
Outdated
.. code-block:: julia | ||
|
||
sum(x .* y) # Gives the same result | ||
sum(i * j for (i, j) ∈ zip(x, y)) # Gives the same result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is way too verbose. I would rather have an unnecessary allocation then something so complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sum(*, zip(x, y)) # errors out
but this works
sum(prod, zip(x, y))
|
||
|
||
|
||
sqrt(sum(abs2, x)) # Gives the same result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that leaving both of these examples in there is probably a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used sum(_ -> _^2, x)
and other variants throughout the lectures to introduce a new convenient function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues here.
No description provided.