On Thu, 25 Jul 2019 at 20:59, shivax <[hidden email]> wrote:
> hi all,
> you have to recommend exercise books to learn vectorization?
> i know programming code but i've so difficult recode it through
Good question! I've never come across such a book, which does not mean
one does not exist, but I have also not personally found one to be
necessary. In lieu of a book here is some advice...
The first step is to familiarise yourself thoroughly with the target
language's facilities designed for this. EG for octave:
By familiarise, I don't just mean be able to recite what the manual
says, I mean be able to predict the result of combinations of them.
For example can you predict the difference between:
reshape((1:10),2,5) and reshape((1:10)',5,2)'? Can you say which of
the quotes in the second expression is not necessary?
You can gain familiarity with vectorising language features in your
projects by trying to use them even though there may be a more
"obvious" solution. Or by playing! It really is not hard, and you will
never achieve your goal of being able to vectorise by asking others
for the solution each time!
I've found the main reason people look to vectorize their code is for speed. That provides a hint of what keywords to look for when searching for a guidebook. With the understanding that not everything written for Matlab applies to Octave, and vice versa, some of the following have been useful: