def kdot ( x , y , K = 2 ) : xx = x . reshape ( - 1 , x . shape [ - 1 ] ) yy = y . reshape ( y . shape [ 0 ] , - 1 ) xx = numpy . ascontiguousarray ( xx ) yy = numpy . ascontiguousarray ( yy ) r = _accupy . kdot_helper ( xx , yy ) . reshape ( ( - 1 , ) + x . shape [ : - 1 ] + y . shape [ 1 : ] ) return ksum ( r , K - 1 )
dot product algorithm in python 3 without numpy
Algorithm 5 . 10 . Dot product algorithm in K - fold working precision K > = 3 .
def kdot(x, y, K=2):
    """Algorithm 5.10. Dot product algorithm in K-fold working precision,
    K >= 3.
    """
    xx = x.reshape(-1, x.shape[-1])
    yy = y.reshape(y.shape[0], -1)

    xx = numpy.ascontiguousarray(xx)
    yy = numpy.ascontiguousarray(yy)

    r = _accupy.kdot_helper(xx, yy).reshape((-1,) + x.shape[:-1] + y.shape[1:])
    return ksum(r, K - 1)