Module: Daru::Maths::Arithmetic::Vector

Included in:
Vector
Defined in:
lib/daru/maths/arithmetic/vector.rb

Instance Method Summary collapse

Instance Method Details

#%(other) ⇒ Object



21
22
23
# File 'lib/daru/maths/arithmetic/vector.rb', line 21

def % other
  binary_op :%, other
end

#*(other) ⇒ Object



13
14
15
# File 'lib/daru/maths/arithmetic/vector.rb', line 13

def * other
  binary_op :*, other
end

#**(other) ⇒ Object



25
26
27
# File 'lib/daru/maths/arithmetic/vector.rb', line 25

def ** other
  binary_op :**, other
end

#+(other) ⇒ Object



5
6
7
# File 'lib/daru/maths/arithmetic/vector.rb', line 5

def + other
  binary_op :+, other
end

#-(other) ⇒ Object



9
10
11
# File 'lib/daru/maths/arithmetic/vector.rb', line 9

def - other
  binary_op :-, other
end

#/(other) ⇒ Object



17
18
19
# File 'lib/daru/maths/arithmetic/vector.rb', line 17

def / other
  binary_op :/, other
end

#absObject



37
38
39
# File 'lib/daru/maths/arithmetic/vector.rb', line 37

def abs
  self.recode { |e| e.abs unless e.nil? }
end

#expObject



29
30
31
# File 'lib/daru/maths/arithmetic/vector.rb', line 29

def exp
  math_unary_op :exp
end

#round(precision = 0) ⇒ Object



41
42
43
# File 'lib/daru/maths/arithmetic/vector.rb', line 41

def round precision=0
  self.recode { |e| e.round(precision) unless e.nil? }
end

#sqrtObject



33
34
35
# File 'lib/daru/maths/arithmetic/vector.rb', line 33

def sqrt
  math_unary_op :sqrt
end