class Wector

Public Instance Methods

%(other) click to toggle source

wector.%

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 131
def %(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i % other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i % other })
  else
    super
  end
end
*(other) click to toggle source

Operators

wector.*

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 41
def *(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i * other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i * other })
  else
    super
  end
end
**(other) click to toggle source

wector.**

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 113
def **(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i ** other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i ** other })
  else
    super
  end
end
+(other) click to toggle source

wector.+

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 59
def +(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i + other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i + other })
  else
    super
  end
end
+@() click to toggle source

wector.+

# File lib/wector.rb, line 30
def +@
  self.class.new(map { |i| +i })
end
-(other) click to toggle source

wector.-

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 95
def -(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i - other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i - other })
  else
    super
  end
end
-@() click to toggle source

wector.-

# File lib/wector.rb, line 23
def -@
  self.class.new(map { |i| -i })
end
/(other) click to toggle source

wector./

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 77
def /(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i / other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i / other })
  else
    super
  end
end
<(other) click to toggle source

wector.<

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 239
def <(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i < other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i < other })
  else
    super
  end
end
<=(other) click to toggle source

wector.<=

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 257
def <=(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i <= other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i <= other })
  else
    super
  end
end
<=>(other) click to toggle source

wector.<=>

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 185
def <=>(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i <=> other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i <=> other })
  else
    super
  end
end
==(other) click to toggle source

wector.==

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 149
def ==(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i == other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i == other })
  else
    super
  end
end
===(other) click to toggle source

wector.===

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 167
def ===(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i === other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i === other })
  else
    super
  end
end
>(other) click to toggle source

wector.>

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 203
def >(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i > other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i > other })
  else
    super
  end
end
>=(other) click to toggle source

wector.>=

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 221
def >=(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i >= other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i >= other })
  else
    super
  end
end
[](*args) click to toggle source

wector.[]

# File lib/wector.rb, line 6
def [](*args)
  args.each do |arg|
    raise "Non-numeric item" unless arg.is_a?(Integer) or arg.is_a?(Float)
    unshift arg
  end
end
abs() click to toggle source

wector.abs

# File lib/wector.rb, line 425
def abs
  self.class.new(map { |i| i.abs })
end
abs2() click to toggle source

wector.abs2

# File lib/wector.rb, line 584
def abs2
  self.class.new(map { |i| i.abs2 })
end
angle() click to toggle source

wector.angle

# File lib/wector.rb, line 598
def angle
  self.class.new(map { |i| i.angle })
end
arg() click to toggle source

wector.arg

# File lib/wector.rb, line 591
def arg
  self.class.new(map { |i| i.arg })
end
ceil() click to toggle source

wector.ceil

# File lib/wector.rb, line 418
def ceil
  self.class.new(map { |i| i.ceil })
end
coerce(other) click to toggle source

wector.coerce

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 294
def coerce(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.coerce other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.coerce other })
  else
    super
  end
end
conj() click to toggle source

wector.conj

# File lib/wector.rb, line 605
def conj
  self.class.new(map { |i| i.conj })
end
conjugate() click to toggle source

wector.conjugate

# File lib/wector.rb, line 612
def conjugate
  self.class.new(map { |i| i.conjugate })
end
denominator() click to toggle source

wector.denominator

# File lib/wector.rb, line 619
def denominator
  self.class.new(map { |i| i.denominator })
end
div(other) click to toggle source

wector.div

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 312
def div(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.div other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.div other })
  else
    super
  end
end
divmod(other) click to toggle source

wector.divmod

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 330
def divmod(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.divmod other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.divmod other })
  else
    super
  end
end
eql?(other) click to toggle source

wector.eql?

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 348
def eql?(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.eql? other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.eql? other })
  else
    super
  end
end
even?() click to toggle source

wector.even?

# File lib/wector.rb, line 432
def even?
  self.class.new(map { |i| i.even? })
end
fdiv(other) click to toggle source

wector.fdiv

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 366
def fdiv(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.fdiv other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.fdiv other })
  else
    super
  end
end
floor() click to toggle source

wector.floor

# File lib/wector.rb, line 439
def floor
  self.class.new(map { |i| i.floor })
end
gcd(other) click to toggle source

wector.gcd

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 496
def gcd(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.gcd other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.gcd other })
  else
    super
  end
end
gcdlcm(other) click to toggle source

wector.gcdlcm

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 514
def gcdlcm(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.gcdlcm other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.gcdlcm other })
  else
    super
  end
end
imag() click to toggle source

wector.imag

# File lib/wector.rb, line 626
def imag
  self.class.new(map { |i| i.imag })
end
imaginary() click to toggle source

wector.imaginary

# File lib/wector.rb, line 633
def imaginary
  self.class.new(map { |i| i.imaginary })
end
integer?() click to toggle source

wector.integer?

# File lib/wector.rb, line 446
def integer?
  self.class.new(map { |i| i.integer? })
end
lcm(other) click to toggle source

wector.lcm

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 532
def lcm(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.lcm other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.lcm other })
  else
    super
  end
end
magnitude() click to toggle source

wector.magnitude

# File lib/wector.rb, line 640
def magnitude
  self.class.new(map { |i| i.magnitude })
end
modulo(other) click to toggle source

wector.modulo

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 276
def modulo(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.modulo other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.modulo other })
  else
    super
  end
end
nonzero?() click to toggle source

wector.nonzero?

# File lib/wector.rb, line 453
def nonzero?
  self.class.new(map { |i| i.nonzero? })
end
numerator() click to toggle source

wector.numerator

# File lib/wector.rb, line 647
def numerator
  self.class.new(map { |i| i.numerator })
end
odd?() click to toggle source

wector.odd?

# File lib/wector.rb, line 460
def odd?
  self.class.new(map { |i| i.odd? })
end
phase() click to toggle source

wector.phase

# File lib/wector.rb, line 654
def phase
  self.class.new(map { |i| i.phase })
end
polar() click to toggle source

wector.polar

# File lib/wector.rb, line 661
def polar
  self.class.new(map { |i| i.polar })
end
pred() click to toggle source

wector.pred

# File lib/wector.rb, line 467
def pred
  self.class.new(map { |i| i.pred })
end
quo(other) click to toggle source

wector.quo

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 384
def quo(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.quo other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.quo other })
  else
    super
  end
end
rationalize(other) click to toggle source

wector.rationalize

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 550
def rationalize(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.rationalize other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.rationalize other })
  else
    super
  end
end
real() click to toggle source

wector.real

# File lib/wector.rb, line 668
def real
  self.class.new(map { |i| i.real })
end
real?() click to toggle source

wector.real?

# File lib/wector.rb, line 675
def real?
  self.class.new(map { |i| i.real? })
end
rect() click to toggle source

wector.rect

# File lib/wector.rb, line 682
def rect
  self.class.new(map { |i| i.rect })
end
remainder(other) click to toggle source

wector.remainder

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 402
def remainder(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.remainder other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.remainder other })
  else
    super
  end
end
round(other) click to toggle source

wector.round

Arguments:

other: (Array)
Calls superclass method
# File lib/wector.rb, line 568
def round(other)
  if other.is_a? Array
    raise "Incorrect Dimensions" unless self.size == other.size
    other = other.dup
    self.class.new(map { |i| i.round other.shift })
  elsif other.is_a?(Integer) or other.is_a?(Float)
    self.class.new(map { |i| i.round other })
  else
    super
  end
end
truncate() click to toggle source

wector.truncate

# File lib/wector.rb, line 474
def truncate
  self.class.new(map { |i| i.truncate })
end
zero?() click to toggle source

wector.zero?

# File lib/wector.rb, line 481
def zero?
  self.class.new(map { |i| i.zero? })
end
~() click to toggle source

wector.~

# File lib/wector.rb, line 16
def ~
  self.class.new(map { |i| ~i })
end