Skip to content

MATMUL

The MATMUL node takes two input matrices, multiplies them, and returns the result.Params:a : MatrixThe matrix on the left of the multiplication.b : MatrixThe matrix on the right of the multiplication.Returns:out : MatrixThe matrix result from the matrix multiplication.
Python Code
import numpy as np
from flojoy import flojoy, Matrix


@flojoy
def MATMUL(a: Matrix, b: Matrix) -> Matrix:
    """The MATMUL node takes two input matrices, multiplies them, and returns the result.

    Parameters
    ----------
    a : Matrix
        The matrix on the left of the multiplication.
    b : Matrix
        The matrix on the right of the multiplication.

    Returns
    -------
    Matrix
        The matrix result from the matrix multiplication.
    """

    return Matrix(m=np.matmul(a.m, b.m))

Find this Flojoy Block on GitHub

Example

Having problem with this example app? Join our Discord community and we will help you out!
React Flow mini map

In this example, we generate two matrix by using MATRIX nodes. Then, these are multiplied using MATMUL node.