Class: MVector
- Inherits:
-
Vector
- Object
- Vector
- MVector
- Defined in:
- lib/cicada/mutable_matrix.rb
Overview
Extension to the standard library Vector class making them mutable and adding some additional functionality.
Class Method Summary collapse
-
.unit(size) ⇒ MVector
Generates a unit vector of specified size.
-
.zero(size) ⇒ MVector
Generates a zero vector of specified size.
Instance Method Summary collapse
-
#replace(other) ⇒ void
Replaces the contents of this vector with the contents of another vector.
Class Method Details
Instance Method Details
#replace(other) ⇒ void
This method returns an undefined value.
Replaces the contents of this vector with the contents of another vector. This will not change the size of the current vector and will replace entries only up to the current size.
105 106 107 108 109 |
# File 'lib/cicada/mutable_matrix.rb', line 105 def replace(other) self.each_with_index do |e,i| self[i] = other[i] end end |