class Wector
Public Instance Methods
wector.%
Arguments:
other: (Array)
# 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
Operators
wector.*
Arguments:
other: (Array)
# 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
wector.**
Arguments:
other: (Array)
# 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
wector.+
Arguments:
other: (Array)
# 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
wector.+
# File lib/wector.rb, line 30 def +@ self.class.new(map { |i| +i }) end
wector.-
Arguments:
other: (Array)
# 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
wector.-
# File lib/wector.rb, line 23 def -@ self.class.new(map { |i| -i }) end
wector./
Arguments:
other: (Array)
# 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
wector.<
Arguments:
other: (Array)
# 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
wector.<=
Arguments:
other: (Array)
# 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
wector.<=>
Arguments:
other: (Array)
# 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
wector.==
Arguments:
other: (Array)
# 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
wector.===
Arguments:
other: (Array)
# 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
wector.>
Arguments:
other: (Array)
# 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
wector.>=
Arguments:
other: (Array)
# 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
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
wector.abs
# File lib/wector.rb, line 425 def abs self.class.new(map { |i| i.abs }) end
wector.abs2
# File lib/wector.rb, line 584 def abs2 self.class.new(map { |i| i.abs2 }) end
wector.angle
# File lib/wector.rb, line 598 def angle self.class.new(map { |i| i.angle }) end
wector.arg
# File lib/wector.rb, line 591 def arg self.class.new(map { |i| i.arg }) end
wector.ceil
# File lib/wector.rb, line 418 def ceil self.class.new(map { |i| i.ceil }) end
wector.coerce
Arguments:
other: (Array)
# 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
wector.conj
# File lib/wector.rb, line 605 def conj self.class.new(map { |i| i.conj }) end
wector.conjugate
# File lib/wector.rb, line 612 def conjugate self.class.new(map { |i| i.conjugate }) end
wector.denominator
# File lib/wector.rb, line 619 def denominator self.class.new(map { |i| i.denominator }) end
wector.div
Arguments:
other: (Array)
# 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
wector.divmod
Arguments:
other: (Array)
# 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
wector.eql?
Arguments:
other: (Array)
# 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
wector.even?
# File lib/wector.rb, line 432 def even? self.class.new(map { |i| i.even? }) end
wector.fdiv
Arguments:
other: (Array)
# 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
wector.floor
# File lib/wector.rb, line 439 def floor self.class.new(map { |i| i.floor }) end
wector.gcd
Arguments:
other: (Array)
# 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
wector.gcdlcm
Arguments:
other: (Array)
# 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
wector.imag
# File lib/wector.rb, line 626 def imag self.class.new(map { |i| i.imag }) end
wector.imaginary
# File lib/wector.rb, line 633 def imaginary self.class.new(map { |i| i.imaginary }) end
wector.integer?
# File lib/wector.rb, line 446 def integer? self.class.new(map { |i| i.integer? }) end
wector.lcm
Arguments:
other: (Array)
# 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
wector.magnitude
# File lib/wector.rb, line 640 def magnitude self.class.new(map { |i| i.magnitude }) end
wector.modulo
Arguments:
other: (Array)
# 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
wector.nonzero?
# File lib/wector.rb, line 453 def nonzero? self.class.new(map { |i| i.nonzero? }) end
wector.numerator
# File lib/wector.rb, line 647 def numerator self.class.new(map { |i| i.numerator }) end
wector.odd?
# File lib/wector.rb, line 460 def odd? self.class.new(map { |i| i.odd? }) end
wector.phase
# File lib/wector.rb, line 654 def phase self.class.new(map { |i| i.phase }) end
wector.polar
# File lib/wector.rb, line 661 def polar self.class.new(map { |i| i.polar }) end
wector.pred
# File lib/wector.rb, line 467 def pred self.class.new(map { |i| i.pred }) end
wector.quo
Arguments:
other: (Array)
# 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
wector.rationalize
Arguments:
other: (Array)
# 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
wector.real
# File lib/wector.rb, line 668 def real self.class.new(map { |i| i.real }) end
wector.real?
# File lib/wector.rb, line 675 def real? self.class.new(map { |i| i.real? }) end
wector.rect
# File lib/wector.rb, line 682 def rect self.class.new(map { |i| i.rect }) end
wector.remainder
Arguments:
other: (Array)
# 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
wector.round
Arguments:
other: (Array)
# 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
wector.truncate
# File lib/wector.rb, line 474 def truncate self.class.new(map { |i| i.truncate }) end
wector.zero?
# File lib/wector.rb, line 481 def zero? self.class.new(map { |i| i.zero? }) end
wector.~
# File lib/wector.rb, line 16 def ~ self.class.new(map { |i| ~i }) end