class BOAST::TrigonometricOperator
Attributes
operand[R]
return_type[R]
Public Class Methods
new(a)
click to toggle source
# File lib/BOAST/Language/HighLevelOperators.rb, line 84 def initialize(a) @operand = a @return_type = a.to_var unless @return_type.type.kind_of?(Real) then @return_type = Variable::new(:trig_type, Real, :vector_length => @return_type.type.vector_length) end end
Public Instance Methods
pr()
click to toggle source
# File lib/BOAST/Language/HighLevelOperators.rb, line 127 def pr s="" s << indent s << to_s s << ";" if [C, CL, CUDA].include?( lang ) output.puts s return self end
to_s()
click to toggle source
# File lib/BOAST/Language/HighLevelOperators.rb, line 123 def to_s return to_var.to_s end
to_var()
click to toggle source
# File lib/BOAST/Language/HighLevelOperators.rb, line 102 def to_var instruction = nil begin instruction = intrinsics(get_intrinsic_symbol,@return_type.type) rescue end if [FORTRAN, CL].include?(lang) then return @return_type.copy( "#{get_name[lang]}( #{@operand} )", DISCARD_OPTIONS ) elsif lang == CUDA or instruction.nil? then raise IntrinsicsError, "Vector #{get_name[lang]} root unsupported on ARM architecture!" if architecture == ARM and @return_type.type.vector_length > 1 if @return_type.type.size <= 4 then return @return_type.copy( "#{get_name[lang]}f( #{@operand} )", DISCARD_OPTIONS ) else return @return_type.copy( "#{get_name[lang]}( #{@operand} )", DISCARD_OPTIONS ) end end op = convert_operand(@operand.to_var) return @return_type.copy( "#{instruction}( #{op} )", DISCARD_OPTIONS ) end
type()
click to toggle source
# File lib/BOAST/Language/HighLevelOperators.rb, line 98 def type return @return_type.type end
Private Instance Methods
convert_operand(op)
click to toggle source
# File lib/BOAST/Language/HighLevelOperators.rb, line 92 def convert_operand(op) return "#{Operator.convert(op, @return_type.type)}" end