docstrings included
optimized dot producto calculation