Module: QuantumVector
Constant Summary collapse
- PRECISION =
14
Instance Method Summary collapse
Instance Method Details
#==(other) ⇒ Object
82 83 84 |
# File 'lib/quantum_ruby.rb', line 82 def ==(other) @vector.map { |i| i.round(PRECISION) } == other.vector.map { |i| i.round(PRECISION) } end |
#state ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/quantum_ruby.rb', line 73 def state out = '[' out << @vector[0, 0].to_s @vector.drop(1).each do |i| out << "\n " << i.to_s end out << ']' end |