Sha256: 413157089c24736c0fd7892c475159bb4b9284b2e8211b69ad7faea33556683c

Contents?: true

Size: 651 Bytes

Versions: 11

Compression:

Stored size: 651 Bytes

Contents

module Dydx
  module Algebra
    module Operator
      module Parts
        module Inverse
          %w(+ * ^).map(&:to_sym).each do |operator|
            define_method(operator) do |x|
              if inverse?(operator, x)
                case operator
                when :+ then e0
                when :* then e1
                end
              elsif !x.is_a?(Inverse) && operator == :+
                x + self
              elsif self.operator == :* && operator == :^
                inverse(self.x ^ x, :*)
              else
                super(x)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dydx-0.1.314 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.31 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.3 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.29 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.28 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.25 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.2 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.1 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.1.0 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.0.9 lib/dydx/algebra/operator/parts/inverse.rb
dydx-0.0.8 lib/dydx/algebra/operator/parts/inverse.rb