Linear
Inputs: i1
...iN
where N is defined by the length of coeff
.
Outputs: o1
Synchronizes input streams and emits a linear combination of the values for a given .
The synchronization mechanism is inherited from the Join
operator. The Linear
operator holds a message buffer on i1
...iN
respectively, it emits a modified version of the synchronized messages from i1
...iN
as the linear combination
of its values and the coefficients in coeff
through o1
right after the synchronization takes place, if no synchronization
occurs then an empty message {} is emitted through o1
.
Parameters
id: The id of the operator
coeff: The list of coefficients.
Usage
- TypeScript
- Python
- C++
- YAML
- Json
import { Program, Linear } from "@rtbot-dev/rtbot";
const id = "id";
const coeff = [1,1,-1];
const program = new Program();
program.addOperator(new Linear(id, coeff));
import rtbot as rb
id = "id";
coeff = [1,1,-1];
program = rb.Program()
program.addOperator(rb.Linear(id, coeff))
#include "rtbot/Linear.h"
auto id = "id";
auto coeff = {1,1,-1};
auto op = Linear<std::uint64_t, double>(id, coeff)
# minimal RtBot program
operators:
- type: Linear
id: "id"
coeff: [1,1,-1]
{
"operators": [
{ "type": "Linear", "id": "id", "coeff": [1,1,-1] }
]
}