Popular recipes tagged "multiplication" but not "python"http://code.activestate.com/recipes/tags/multiplication-python/2011-07-07T07:07:59-07:00ActiveState Code RecipesLattice Multiplication (Python) 2011-07-07T07:07:59-07:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/577782-lattice-multiplication/ <p style="color: grey"> Python recipe 577782 by <a href="/recipes/users/4174477/">Thomas Lehmann</a> (<a href="/recipes/tags/lattice/">lattice</a>, <a href="/recipes/tags/multiplication/">multiplication</a>). </p> <p>The documentation in the function explains the algorithm but there are additional pages which provide additional visual help:</p> <ul> <li><a href="http://mathforum.org/library/drmath/view/52468.html" rel="nofollow">http://mathforum.org/library/drmath/view/52468.html</a></li> <li><a href="http://en.wikipedia.org/wiki/Multiplication_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/Multiplication_algorithm</a></li> </ul> <p>The function can handle a string as well as a sequence of digits. The test function is just to have a basic verification.</p> Infix operators for numpy arrays (Python) 2010-06-07T05:57:07-07:00John Schulmanhttp://code.activestate.com/recipes/users/4171677/http://code.activestate.com/recipes/577201-infix-operators-for-numpy-arrays/ <p style="color: grey"> Python recipe 577201 by <a href="/recipes/users/4171677/">John Schulman</a> (<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/infix/">infix</a>, <a href="/recipes/tags/matrix/">matrix</a>, <a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/numpy/">numpy</a>). Revision 3. </p> <p>This recipe adapts the infix operator trick from <a href="http://code.activestate.com/recipes/384122-infix-operators/" rel="nofollow">http://code.activestate.com/recipes/384122-infix-operators/</a> to give the appropriate behavior with numpy arrays, so you can write A *dot* B for np.dot(A,B)</p> <p>UPDATE A solution to the dot problem was recently added to the numpy trunk: the dot method was added to the ndarray class so you can write a.dot(b). See <a href="http://projects.scipy.org/numpy/ticket/1456" rel="nofollow">http://projects.scipy.org/numpy/ticket/1456</a></p>