Method: Rust::MathArray#*
- Defined in:
- lib/rust/core/types/utils.rb
#*(other) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rust/core/types/utils.rb', line 72 def *(other) raise ArgumentError, "Expected array or numeric" if !other.is_a?(::Array) && !other.is_a?(Numeric) raise ArgumentError, "The two arrays must have the same size" if other.is_a?(::Array) && self.size != other.size result = self.clone other = [other] * self.size if other.is_a?(Numeric) for i in 0...self.size result[i] *= other[i] end return result end |