Mercurial > hg > tvii
view tvii/dot.py @ 7:bb8b6b06ca83
dot product
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Thu, 31 Aug 2017 08:50:36 -0700 |
parents | be09c8fc58b8 |
children |
line wrap: on
line source
""" dot product """ def dot(w, x): """inner dot product""" assert len(w) == len(x) return sum([a*b for a, b in zip(w,x)])