Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include vectorization #19

Open
shwina opened this issue Feb 19, 2015 · 7 comments
Open

Include vectorization #19

shwina opened this issue Feb 19, 2015 · 7 comments
Assignees
Labels
type:enhancement Propose enhancement to the lesson

Comments

@shwina
Copy link

shwina commented Feb 19, 2015

In a discussion with Ken Deeley and Jos Martin from Mathworks, and @gvwilson, the following improvements to the SWC MATLAB material have been suggested:

  1. MATLAB environment - the lessons don't have, for instance, screenshots of the MATLAB environment. While this reduces maintenance costs, it might also make learning more difficult for beginners. Greg's suggestion: short GIFs/videos of the MATLAB environment
  2. Vectorization - effective use of MATLAB entails familiarity with the idea of vectorization. We should introduce this in some depth in our lesson.
@IsaKiko
Copy link
Contributor

IsaKiko commented Feb 20, 2015

Where do you thing vectorization should go? Before or after loops?
Are we including logical indexing?
I'm hoping this is not too confusing since we're already teaching loops.

@gvwilson
Copy link
Contributor

The MATLAB folks think vectorization should come first, and loops later

  • this is part of why we start with whole-array operations, then show
    loops over all input files (because that doesn't vectorize).

@shwina
Copy link
Author

shwina commented Feb 20, 2015

I think it's worth having learners use both approaches to accomplish the same task, have them understand why vectorization is generally a better idea, and also when it becomes necessary to use a for loop. The challenge will be making sure all of this doesn't stick out awkwardly in the lessons :)

@gcapes
Copy link
Contributor

gcapes commented Jun 21, 2021

We now have a screenshot of MATLAB, and a gif of debugging.
I'll have a think about how to cover vectorisation

@gcapes gcapes changed the title Improvements to MATLAB materials Include vectorization Jun 21, 2021
@gcapes gcapes assigned gcapes and unassigned shwina Jun 21, 2021
@gcapes gcapes added the type:enhancement Propose enhancement to the lesson label Jun 21, 2021
@gcapes
Copy link
Contributor

gcapes commented Jun 21, 2021

Some thoughts:
The arrays episode (2) is quite short, so could probably accommodate some examples of whole-array operations, assignment to a slice, and logical indexing which is important in vectorization.

In ep5 (loops) some of the examples would be much better achieved using whole-array operations e.g. printing each letter in a word, summing all the elements of an array etc. So while they're poorly-motivated examples of loops, they are easy to follow examples, and give a natural motivation for vectorization. We could show how some of these examples could be achieved using vectorization, and come up with an example which doesn't vectorize before looping over files (which also doesn't vectorize).

@cjfullerton
Copy link

I'm interested in having a crack at adding some vectorization material to the lessons as I think it's an important part of using MATLAB.

@gcapes - these are great suggestions. I think it's sensible to introduce vectorization in the arrays lesson, but although the lesson is short the array indexing material is conceptually dense. I'll add some material and we can see how it looks.

@gcapes
Copy link
Contributor

gcapes commented Nov 18, 2022

Would be good to see your ideas. Perhaps it might be useful to refer back to mean i.e. an inbuilt vectorised function which is previously used in the lesson

zkamvar pushed a commit that referenced this issue Apr 26, 2023
Multiple changes based on converting Make lesson to template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Propose enhancement to the lesson
Projects
None yet
Development

No branches or pull requests

5 participants