Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
  • OM-Functions

    • OM-Functions Overview
    • Arithmetic Operations
    • Array Operations
    • Logical Operations
    • Statistics
    • Transformations
    • Utilities

Logical Operations

These functions allow you to perform element-wise logical comparisons:

1. mad.equal(a, b)

Checks element-wise equality:

ParameterTypeDescription
a, bArrayArrays of the same shape
ReturnsArrayBoolean array of comparisons

Example:

import { equal } from 'openmadness';

equal([1, 2], [1, 3]);
// Result: [true, false]

2. mad.greater(a, b)

Checks if elements in a are greater than corresponding elements in b:

ParameterTypeDescription
a, bArrayArrays of the same shape
ReturnsArrayBoolean array

Example:

import { greater } from 'openmadness';

greater([4, 2], [3, 3]);
// Result: [true, false]

3. mad.where(condition, a, b)

Returns elements from a where the condition is true, otherwise from b:

ParameterTypeDescription
conditionArrayBoolean mask
a, bArrayArrays of values
ReturnsArrayResulting values from a or b

Example:

import { where } from 'openmadness';

where([true, false], [1, 2], [3, 4]);
// Result: [1, 4]
Edit this page on GitHub
Last Updated:: 7/11/25, 12:24 PM
Contributors: Dev-Liz
Prev
Array Operations
Next
Statistics