Class: ValueGraphTransformation::Arithmetic::Div

Inherits:
Function show all
Defined in:
lib/value_graph_transformation/arithmetic.rb

Overview

Division

Instance Attribute Summary

Attributes inherited from Graph::Vertex

#sources, #targets

Instance Method Summary (collapse)

Methods inherited from Graph::Vertex

#initialize, #source_vertices, #target_vertices

Constructor Details

This class inherits a constructor from ValueGraphTransformation::Graph::Vertex

Instance Method Details

- (Class, Array<Vertex>) inverse_to(source)

Returns the inverse function and its parameters

Returns:

  • (Class, Array<Vertex>, Array<Vertex>)

    the inverse function and its parameters



152
153
154
155
156
157
158
159
160
161
# File 'lib/value_graph_transformation/arithmetic.rb', line 152

def inverse_to(source)
  other_source = source_vertices - [source]
  if source == source_vertices[0] then
    [Mul, other_source + target_vertices, [source]]
  elsif source == source_vertices[1] then
    [Div, other_source + target_vertices, [source]]
  else
    fail "Function does not contain given source"
  end
end

- (String) symbol

Returns the symbol that represents this function.

Returns:

  • (String)

    the symbol that represents this function.



147
148
149
# File 'lib/value_graph_transformation/arithmetic.rb', line 147

def symbol
  "&#247;"
end