View/Edit #3456:dot

Switch to edit mode.

Name(s): dot
1:  ":dot({ax, ay, az, ...}, {bx, by, bz, ...}) => ax*bx + ay*by + az*bz + ..."
2:  {a, b} = args
3:  length(a) == length(b) || raise(E_INVARG, "Both vectors must be have the same number of dimensions!")
4:  "s = 0;"
5:  s = 0.0
6:  for x in [1..length(a)]
7:    s = s + a[x] * b[x]
8:  endfor
9:  return s
10: "Last modified by Lao-Tzu (#8084) on Mon Dec 17 12:58:55 2001 MST."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]