Skip to content

MATMUL

The MATMUL node takes two input matrices, multiplies them, and returns the result.Inputs ------ a : Matrix The input matrix to be multiplied to input b. b : Matrix The input matrix to be multiplied to input a.Params: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.

    Inputs
    ------
    a : Matrix
        The input matrix to be multiplied to input b.
    b : Matrix
        The input matrix to be multiplied to input a.

    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.