VECTOR_LENGTH
The VECTOR_LENGTH node returns the length of the input.Inputs
------
v : vector
The input vector to find the length of.Params:Returns:out : ScalarThe length of the input vector.
Python Code
import numpy as np
from flojoy import flojoy, Vector, Scalar
@flojoy
def VECTOR_LENGTH(default: Vector) -> Scalar:
"""The VECTOR_LENGTH node returns the length of the input.
Inputs
------
v : vector
The input vector to find the length of.
Returns
-------
Scalar
The length of the input vector.
"""
return Scalar(c=len(default.v))
Example
Having problem with this example app? Join our Discord community and we will help you out!
In this example, we generate a vector by using a LINSPACE
node. Then, the length of this vector is extracted with the VECTOR_LENGTH
node. The length is visualized with BIG_NUMBER
.