Beispiel #1
0
    def tdot(self, other):
        try:
            xalglib
        except NameError:
            return self.transpose()._dot(other)

        k, m = self.shape
        k, n = other.shape

        data = xalglib.rmatrixgemm(m, n, k, 1.0, self.data, 0, 0, 1,
                                   other.data, 0, 0, 0, 0,
                                   Zeros((m, n)).data, 0, 0)
        return Array(data, (m, n), self.dtype)
Beispiel #2
0
    def xdot(self, B, C, a=1.0, c=1.0):
        A = self
        try:
            xalglib
        except NameError:
            return A.multiply(a)._dot(B).add(C.multiply(c))

        m, k = A.shape
        k, n = B.shape

        data = xalglib.rmatrixgemm(m, n, k, a, A.data, 0, 0, 0, B.data, 0, 0,
                                   0, c, C.data, 0, 0)

        return Array(data, (m, n), self.dtype)