Module: Daru::Maths::Arithmetic::DataFrame
- Included in:
- DataFrame
- Defined in:
- lib/daru/maths/arithmetic/dataframe.rb
Instance Method Summary collapse
-
#%(other) ⇒ Object
Modulus with a scalar or another DataFrame.
-
#*(other) ⇒ Object
Multiply a scalar or another DataFrame.
-
#**(other) ⇒ Object
Exponent with a scalar or another DataFrame.
-
#+(other) ⇒ Object
Add a scalar or another DataFrame.
-
#-(other) ⇒ Object
Subtract a scalar or another DataFrame.
-
#/(other) ⇒ Object
Divide a scalar or another DataFrame.
-
#exp ⇒ Object
Calculate exponenential of all vectors with numeric values.
- #round(precision = 0) ⇒ Object
-
#sqrt ⇒ Object
Calcuate square root of numeric vectors.
Instance Method Details
#%(other) ⇒ Object
Modulus with a scalar or another DataFrame.
27 28 29 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 27 def % other binary_operation :%, other end |
#*(other) ⇒ Object
Multiply a scalar or another DataFrame.
17 18 19 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 17 def * other binary_operation :*, other end |
#**(other) ⇒ Object
Exponent with a scalar or another DataFrame.
32 33 34 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 32 def ** other binary_operation :**, other end |
#+(other) ⇒ Object
Add a scalar or another DataFrame
7 8 9 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 7 def + other binary_operation :+, other end |
#-(other) ⇒ Object
Subtract a scalar or another DataFrame.
12 13 14 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 12 def - other binary_operation :-, other end |
#/(other) ⇒ Object
Divide a scalar or another DataFrame.
22 23 24 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 22 def / other binary_operation :/, other end |
#exp ⇒ Object
Calculate exponenential of all vectors with numeric values.
37 38 39 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 37 def exp only_numerics(clone: false).recode(&:exp) end |
#round(precision = 0) ⇒ Object
46 47 48 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 46 def round precision=0 only_numerics(clone: false).recode { |v| v.round(precision) } end |
#sqrt ⇒ Object
Calcuate square root of numeric vectors.
42 43 44 |
# File 'lib/daru/maths/arithmetic/dataframe.rb', line 42 def sqrt only_numerics(clone: false).recode(&:sqrt) end |