Class: Ropt::VectorMatrixMath::OperationVectors

Inherits:
Object
  • Object
show all
Defined in:
lib/ropt/vector_matrix_math/operation_vectors.rb

Overview

class-wrapper for converting arrays to objects of vectors with option of inner product

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vector1, vector2) ⇒ OperationVectors

Returns a new instance of OperationVectors.



12
13
14
15
# File 'lib/ropt/vector_matrix_math/operation_vectors.rb', line 12

def initialize(vector1, vector2)
  @vector1 = ShellVector.create(vector1)
  @vector2 = ShellVector.create(vector2)
end

Instance Attribute Details

#vector1Object

Returns the value of attribute vector1.



10
11
12
# File 'lib/ropt/vector_matrix_math/operation_vectors.rb', line 10

def vector1
  @vector1
end

#vector2Object

Returns the value of attribute vector2.



10
11
12
# File 'lib/ropt/vector_matrix_math/operation_vectors.rb', line 10

def vector2
  @vector2
end

Instance Method Details

#inner_productObject



17
18
19
# File 'lib/ropt/vector_matrix_math/operation_vectors.rb', line 17

def inner_product
  vector1.inner_product(vector2)
end