Aller au contenu

MATRIX

Ce contenu n’est pas encore disponible dans votre langue.

Generates a random matrix with values between 0 and 1. Params: row : Scalar number of rows column : Scalar number of columns Returns: out : Matrix Randomly generated matrix
Python Code
import numpy as np
from flojoy import flojoy, Matrix, Scalar


@flojoy
def MATRIX(row: Scalar = 100, column: Scalar = 100) -> Matrix:
    """Generates a random matrix with values between 0 and 1.

    Parameters
    ----------
    row : Scalar
        number of rows
    column : Scalar
        number of columns

    Returns
    -------
    Matrix
        Randomly generated matrix
    """

    np.random.seed()

    mat = np.random.random_sample((row, column))

    return Matrix(m=mat)

Find this Flojoy Block on GitHub

Example

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

In this example, MATRIX node generates 8x8 matrix and passes it MATRIX_VIEW node.