Vector Based Languages

https://servingourchildrendc.org/format/essays-on-influence-of-media/28/ free essay paper generator quotes on thesis statements follow here https://heystamford.com/writing/argumentative-essays-by-famous-writers/8/ cialis balkan pharmaceuticals levitra wirkung frau essay on the death of jesus christ critical thinking vs lateral thinking https://www.carrollkennelclub.org/phrasing/russian-terms-of-endearment/6/ http://hyperbaricnurses.org/15265-viagra-chea/ properly quoting in an essay original cialis 20mg kaufen https://explorationproject.org/annotated/thesis-work-proposal/80/ case studies database https://thejeffreyfoundation.org/newsletter/write-a-response-paper/17/ https://www.lapressclub.org/hypothesis/essay-that-analyzes/29/ follow free examples of a definition essay thesis ibm systems journal writing prompts pinterest https://www.pugetsoundnavymuseum.org/paraphrasing/research-paper-on-diocletion/24/ devices generic cialis https://davidlankes.org/transition/free-simple-essays/16/ https://chanelmovingforward.com/stories/how-to-write-academic-essays/51/ get link birth control pills before clomid cialis 20 mg upotreba https://mnscha.org/advised/seroquel-4-tabs-p-r-n/38/ https://sanctuaryforest.org/prompts/free-speech-clause/19/ go here

Dexter

After working in data science for a while there is one concept that I began to take for granted; Vectorization.

The term Vectorization comes from R.  It can have other names but I like Vectorization because it sounds cool.

In a normal programming language, if you want to add two arrays together it can be quite a grind.

Let’s say you want to do this in regular ‘ole Python (or C or any other ‘normal’ language), you would have to build an elaborate series of for-loops, like this:

d = [1,2,2,3,4]
e = [4,5,4,6,4]
f = []
for x in range(0, len(d)):
     f.append(d[x]*e[x])
print(f)
[4, 10, 8, 18, 16]

Mental

That’s all fine and good, but now imagine doing that with 2D matrices.  Or multiple arrays.  Or performing even more complex math on any of them.

In a Vector Based Language, you don’t have to go through that whole rigamarole.  Instead you can just do this:

d = np.array([1,2,2,3,4])
e = np.array([4,5,4,6,4])
print (d*e)
[4, 10, 8, 18, 16]

Vector Based Languages let you perform mathematical functions on entire lists or matrices as though they were single objects.

d = np.array([[1,2,2,3,4],
[3,2,8,7,12],
[11,21,26,3,43]])
e = np.array([[4,5,4,6,4],
[13,21,21,31,24],
[51,12,22,31,46]])

print (d*e)
[[   4 10    8 18 16]
 [  39 42  168 217 288]
 [ 561  252 572   93 1978]]

With a vectorized language, like R, or python with numpy, you can do these types of calculations simply and without concern about the underbelly of the process.

My Lord

Thank Thor for this technology. Staring at endless nested for-loops would cause me to pull my eyeballs out.

Again, I completely lost any appreciation for this important construct because getting knee deep in numpy or R will allow you to do that.  Just wait until you get back to your C programming!  Then you'll appreciate it...

 

Leave a Reply

Your email address will not be published. Required fields are marked *