Mojo Boolean Tests
struct RisingBoolDetector¶
A simple rising edge detector for boolean triggers. Outputs a boolean True trigger when the input transitions from False to True.
Traits: AnyType, Copyable, ImplicitlyDestructible, Movable
RisingBoolDetector Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
The size of the SIMD vector - defaults to 1. |
RisingBoolDetector Functions¶
struct RisingBoolDetector . fn init¶
struct RisingBoolDetector . fn next¶
Check if a trigger has occurred (rising edge) per SIMD lane.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| trig | SIMD[DType.bool, num_chans] |
— | The input boolean SIMD vector to check for rising edges. Each SIMD lane is processed independently. |
fn next Returns
: SIMD[DType.bool, num_chans]
A SIMD boolean vector outputting single sample boolean triggers which indicate the rising edge detection for each lane.
struct ToggleBool¶
A rising edge detector for boolean triggers.
Traits: AnyType, Copyable, ImplicitlyDestructible, Movable
ToggleBool Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
The size of the SIMD vector - defaults to 1. |
ToggleBool Functions¶
struct ToggleBool . fn init¶
Initialize the ToggleBool struct.
fn init Signature
fn init Returns
: Self
Static Method
This is a static method.
struct ToggleBool . fn next¶
Check if a trigger has occurred (rising edge) per SIMD lane.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| trig | SIMD[DType.bool, num_chans] |
— | The input boolean SIMD vector to check for rising edges. Each SIMD lane is processed independently. |
fn next Returns
: SIMD[DType.bool, num_chans]
A SIMD boolean vector indicating the toggled state for each lane.
struct Changed¶
Detect changes in a Bool, Int, or Float64 value.
Traits: AnyType, Copyable, ImplicitlyDestructible, Movable
Changed Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| T | Equatable & ImplicitlyCopyable |
— | The type of value to track for changes. The is required when declared as a struct member. This will usually be Bool, Int, Float64, or SIMD vector. Changed[Bool] will track changes in boolean values, Changed[Int] will track changes in integer values, and Changed[Float64] will track changes in floating-point values. |
Changed Functions¶
struct Changed . fn init¶
Initialize the Changed struct.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| initial | T |
— | The initial value to compare against. |
fn init Returns
: Self
Static Method
This is a static method.
struct Changed . fn next¶
Check if the value has changed.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| val | T |
— | The current value to check. Bool, Int, and Float64 types are supported. |
fn next Returns
: Bool
True if the value has changed since the last check, False otherwise.
struct ChangedSIMD¶
Detect element-wise changes in a SIMD vector value.
Traits: AnyType, Copyable, ImplicitlyDestructible, Movable
ChangedSIMD Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| type | DType |
— | The DType of the SIMD vector elements (e.g., DType.float32, DType.int64, DType.bool). |
| size | Int |
— | The number of elements in the SIMD vector. |
ChangedSIMD Functions¶
struct ChangedSIMD . fn init¶
Initialize the ChangedSIMD struct.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| initial | SIMD[type, size] |
— | The initial SIMD vector value to compare against. |
fn init Returns
: Self
Static Method
This is a static method.
struct ChangedSIMD . fn next¶
Check which elements in the SIMD vector have changed.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| val | SIMD[type, size] |
— | The current SIMD vector value to check. |
fn next Returns
: SIMD[DType.bool, size]
A boolean SIMD vector where True indicates the element changed.
Documentation generated with mojo doc from Mojo version 1.0.0b1