def matmul_for_numba(lefts, rights, dtype):
    total_outer = 0
    total_inner = 0
    total_content = 0
    for (A, B) in zip(lefts, rights):
        first = (- 1)
        for Ai in A:
            if (first == (- 1)):
                first = len(Ai)
            elif (first != len(Ai)):
                raise ValueError('one of the left matrices in np.matmul is not rectangular')
        if (first == (- 1)):
            first = 0
        rowsA = len(A)
        colsA = first
        first = (- 1)
        for Bi in B:
            if (first == (- 1)):
                first = len(Bi)
            elif (first != len(Bi)):
                raise ValueError('one of the right matrices in np.matmul is not rectangular')
        if (first == (- 1)):
            first = 0
        rowsB = len(B)
        colsB = first
        if (colsA != rowsB):
            raise ValueError(u'one of the pairs of matrices in np.matmul do not match shape: (n × k) @ (k × m)')
        total_outer += 1
        total_inner += rowsA
        total_content += (rowsA * colsB)
    outer = numpy.empty((total_outer + 1), numpy.int64)
    inner = numpy.empty((total_inner + 1), numpy.int64)
    content = numpy.zeros(total_content, dtype)
    outer[0] = 0
    inner[0] = 0
    outer_i = 1
    inner_i = 1
    content_i = 0
    for (A, B) in zip(lefts, rights):
        rows = len(A)
        cols = 0
        if (len(B) > 0):
            cols = len(B[0])
        mids = 0
        if (len(A) > 0):
            mids = len(A[0])
        for i in range(rows):
            for j in range(cols):
                for v in range(mids):
                    pos = ((content_i + (i * cols)) + j)
                    content[pos] += (A[i][v] * B[v][j])
        outer[outer_i] = (outer[(outer_i - 1)] + rows)
        outer_i += 1
        for _ in range(rows):
            inner[inner_i] = (inner[(inner_i - 1)] + cols)
            inner_i += 1
        content_i += (rows * cols)
    return (outer, inner, content)
def matmul_for_numba(lefts, rights, dtype):
    total_outer = 0
    total_inner = 0
    total_content = 0
    for (A, B) in zip(lefts, rights):
        first = (- 1)
        for Ai in A:
            if (first == (- 1)):
                first = len(Ai)
            elif (first != len(Ai)):
                raise ValueError('one of the left matrices in np.matmul is not rectangular')
        if (first == (- 1)):
            first = 0
        rowsA = len(A)
        colsA = first
        first = (- 1)
        for Bi in B:
            if (first == (- 1)):
                first = len(Bi)
            elif (first != len(Bi)):
                raise ValueError('one of the right matrices in np.matmul is not rectangular')
        if (first == (- 1)):
            first = 0
        rowsB = len(B)
        colsB = first
        if (colsA != rowsB):
            raise ValueError(u'one of the pairs of matrices in np.matmul do not match shape: (n × k) @ (k × m)')
        total_outer += 1
        total_inner += rowsA
        total_content += (rowsA * colsB)
    outer = numpy.empty((total_outer + 1), numpy.int64)
    inner = numpy.empty((total_inner + 1), numpy.int64)
    content = numpy.zeros(total_content, dtype)
    outer[0] = 0
    inner[0] = 0
    outer_i = 1
    inner_i = 1
    content_i = 0
    for (A, B) in zip(lefts, rights):
        rows = len(A)
        cols = 0
        if (len(B) > 0):
            cols = len(B[0])
        mids = 0
        if (len(A) > 0):
            mids = len(A[0])
        for i in range(rows):
            for j in range(cols):
                for v in range(mids):
                    pos = ((content_i + (i * cols)) + j)
                    content[pos] += (A[i][v] * B[v][j])
        outer[outer_i] = (outer[(outer_i - 1)] + rows)
        outer_i += 1
        for _ in range(rows):
            inner[inner_i] = (inner[(inner_i - 1)] + cols)
            inner_i += 1
        content_i += (rows * cols)
    return (outer, inner, content)