Module: UserFunction

Extended by:
RubyFunctions
Defined in:
lib/mdarray/ruby_functions.rb

Class Method Summary collapse

Methods included from RubyFunctions

make_binary_operator, make_binary_operators, make_comparison_operator, make_unary_operator, make_unary_operators, ruby_binary_function, ruby_unary_function

Class Method Details

.binary_operator(name, exec_type, func, where, force_type = nil, pre_condition = nil, post_condition = nil) ⇒ Object


Creates a binary operator in the given class. For direct creation of operators directly by the user.



131
132
133
134
135
136
137
138
139
# File 'lib/mdarray/ruby_functions.rb', line 131

def self.binary_operator(name, exec_type, func, where, force_type = nil, 
                         pre_condition = nil, post_condition = nil)

  function = ruby_binary_function("#{name}_user", func)
  klass = Object.const_get("#{where.capitalize}MDArray")
  klass.make_binary_op(name, exec_type, function, RubyFunctions.binary_helper, 
                       force_type, pre_condition, post_condition)

end

.unary_operator(name, exec_type, func, where, force_type = nil, pre_condition = nil, post_condition = nil) ⇒ Object


Creates a unary operator in the given class. For direct creation of operators directly by the user.



146
147
148
149
150
151
152
153
154
# File 'lib/mdarray/ruby_functions.rb', line 146

def self.unary_operator(name, exec_type, func, where, force_type = nil, 
                        pre_condition = nil, post_condition = nil)

  function = ruby_unary_function("#{name}_user", func)
  klass = Object.const_get("#{where.capitalize}MDArray")
  klass.make_unary_op(name, exec_type, function, RubyFunctions.unary_helper, force_type, 
                      pre_condition, post_condition)

end