Class: Numeric

Inherits:
Object show all
Defined in:
lib/multiarray.rb

Instance Method Summary collapse

Instance Method Details

#bNumeric

Get blue component

Returns:



466
467
468
# File 'lib/multiarray.rb', line 466

def b
  self
end

#conjNumeric

Compute complex conjugate

Returns:



445
446
447
# File 'lib/multiarray.rb', line 445

def conj
  self
end

#gNumeric

Get green component

Returns:



459
460
461
# File 'lib/multiarray.rb', line 459

def g
  self
end

#major(other) ⇒ Numeric

Get larger number of two numbers

Parameters:

  • other (Numeric)

    The other number.

Returns:

  • (Numeric)

    The larger number of the two.



475
476
477
478
479
480
481
482
# File 'lib/multiarray.rb', line 475

def major( other )
  if other.is_a? Numeric
    ( self >= other ).conditional self, other
  else
    x, y = other.coerce self
    x.major other
  end
end

#minor(other) ⇒ Numeric

Get smaller number of two numbers

Parameters:

  • other (Numeric)

    The other number.

Returns:

  • (Numeric)

    The smaller number of the two.



489
490
491
492
493
494
495
496
# File 'lib/multiarray.rb', line 489

def minor( other )
  if other.is_a? Numeric
    ( self <= other ).conditional self, other
  else
    x, y = other.coerce self
    x.minor other
  end
end

#rNumeric

Get red component

Returns:



452
453
454
# File 'lib/multiarray.rb', line 452

def r
  self
end