| Prev | Start of Chapter | Next Chapter | Contents | Index | (18 out of 18)

Vector Function of Two Arguments


The Vector Function of Two Arguments block lets you use a function or procedure as a block in a NeurOn-Line diagram. The block applies the function or procedure to its two input vectors and passes one vector as the result. Specify the name of the routine in the attribute Arithmetic Function.

You can use any:

This block will not pass a value if the quality of either input path is no-value.

Using a Built-in G2 Function

You can set the attribute Arithmetic Function to any of these built-in G2 functions:

arctan
average
expt
max
min
quotient
random
remainder

The Vector Function of Two Arguments block applies the function to each of the elements in the two input vectors and creates an output vector of the results. For example, this diagram computes 25 and 34.


Using a User-Defined Function

You may use any user-defined function that accepts two quantitative arguments and returns one quantitative value. Set the attribute Arithmetic Function to the name of the function.The Two Argument Vector Function block applies the function to each of the elements in the two input vectors and creates an output vector of the results. For example, the diagram below applies the function to each member of two vectors. In this case, it computes and


Using a Procedure

You can use a procedure that accepts two vectors as arguments and returns a vector. Use a procedure if you want to operate on the vectors as a whole, instead of operating on each element individually.

Set the attribute Arithmetic Function to the name of the procedure. The block passes the procedure's return value as its output value. The input vectors and the output vectors can all have different lengths. The vectors that the procedure accepts and returns should be of type vector-path-value, which has the superior class float-array and contains the following two additional attributes.

Attribute Type Description
collection-time
float
The collection-time of the block's input vector.
quality
symbol
The quality of the block's input vector.

This diagram contains a Vector Function of Two Arguments block with a procedure that creates a two-element vector containing the average values of the two input vectors.


This is the definition of the procedure.

Configuring

This is the configuration panel for Vector Function of Two Arguments.


Attribute Description
Arithmetic Function
The function to apply to each element of the input vectors.
Triggering Method
Specify when to evaluate the block. For more information, see "Choosing When to Evaluate".

See Also

For more information on how to use this block, see the pages below.

Click here for more information...
Basic Block Behavior
Vector Function

| Prev | Start of Chapter | Next Chapter | Contents | Index | (18 out of 18)

Copyright © 1996, Gensym Corporation, Inc.