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.




127
128
129
130
131
132
133
134
135
# File 'lib/mdarray/ruby_functions.rb', line 127

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.




142
143
144
145
146
147
148
149
150
# File 'lib/mdarray/ruby_functions.rb', line 142

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