help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: book to learn vectorize


From: Ian McCallion
Subject: Re: book to learn vectorize
Date: Fri, 26 Jul 2019 13:06:33 +0100

On Thu, 25 Jul 2019 at 20:59, shivax <address@hidden> wrote:
>
> hi all,
> you have to recommend exercise books to learn vectorization?
> i know programming code but i've so difficult recode it through
> vectorization

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:
  boolean indices
  repmat
  reshape
  find
  cumsum.*
  '
  (:)
  (etc)

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!

HTH
Ian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]