Class: BOAST::TrigonometricOperator
- Inherits:
-
HighLevelOperator
- Object
- Operator
- HighLevelOperator
- BOAST::TrigonometricOperator
- Defined in:
- lib/BOAST/Language/HighLevelOperators.rb
Constant Summary
Constants included from Intrinsics
Intrinsics::CONVERSIONS, Intrinsics::INTRINSICS
Constants inherited from Operator
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Instance Method Summary collapse
-
#initialize(a) ⇒ TrigonometricOperator
constructor
A new instance of TrigonometricOperator.
- #pr ⇒ Object
- #to_s ⇒ Object
- #to_var ⇒ Object
- #type ⇒ Object
Methods included from Inspectable
Methods included from Arithmetic
#!, #!=, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #==, #===, #>, #>=, #and, #cast, #coerce, #components, #dereference, #or, #reference
Methods included from Intrinsics
check_coverage, generate_conversions, get_conversion_path, get_vector_decl, get_vector_decl_ARM, get_vector_decl_X86, get_vector_name, intrinsics, intrinsics_by_vector_name, type_name_ARM, type_name_X86, vector_type_name
Methods included from PrivateStateAccessor
#address_size, #address_size=, #annotate, #annotate=, #annotate?, #annotate_indepth_list, #annotate_indepth_list=, #annotate_level, #annotate_level=, #annotate_list, #annotate_list=, #architecture, #architecture=, #array_start, #array_start=, #chain_code, #chain_code=, #chain_code?, #debug, #debug=, #debug?, #debug_kernel_source, #debug_kernel_source=, #debug_kernel_source?, #debug_source, #debug_source=, #debug_source?, #decl_module, #decl_module=, #decl_module?, #default_align, #default_align=, #default_int_signed, #default_int_signed=, #default_int_signed?, #default_int_size, #default_int_size=, #default_real_size, #default_real_size=, #default_type, #default_type=, #disable_openmp, #disable_openmp=, #disable_openmp?, #executable, #executable=, #executable?, #ffi, #ffi=, #ffi?, #fortran_line_length, #fortran_line_length=, #get_address_size, #get_annotate, #get_annotate_indepth_list, #get_annotate_level, #get_annotate_list, #get_architecture, #get_array_start, #get_chain_code, #get_debug, #get_debug_kernel_source, #get_debug_source, #get_decl_module, #get_default_align, #get_default_int_signed, #get_default_int_size, #get_default_real_size, #get_default_type, #get_disable_openmp, #get_executable, #get_ffi, #get_fortran_line_length, #get_indent_increment, #get_indent_level, #get_keep_temp, #get_lang, #get_model, #get_optimizer_log, #get_optimizer_log_file, #get_output, #get_replace_constants, #get_synchro, #get_use_vla, #get_verbose, #indent_increment, #indent_increment=, #indent_level, #indent_level=, #keep_temp, #keep_temp=, #keep_temp?, #lang, #lang=, #model, #model=, #optimizer_log, #optimizer_log=, #optimizer_log?, #optimizer_log_file, #optimizer_log_file=, #output, #output=, #replace_constants, #replace_constants=, #replace_constants?, #set_address_size, #set_annotate, #set_annotate_indepth_list, #set_annotate_level, #set_annotate_list, #set_architecture, #set_array_start, #set_chain_code, #set_debug, #set_debug_kernel_source, #set_debug_source, #set_decl_module, #set_default_align, #set_default_int_signed, #set_default_int_size, #set_default_real_size, #set_default_type, #set_disable_openmp, #set_executable, #set_ffi, #set_fortran_line_length, #set_indent_increment, #set_indent_level, #set_keep_temp, #set_lang, #set_model, #set_optimizer_log, #set_optimizer_log_file, #set_output, #set_replace_constants, #set_synchro, #set_use_vla, #set_verbose, #synchro, #synchro=, #use_vla, #use_vla=, #use_vla?, #verbose, #verbose=, #verbose?
Methods inherited from Operator
Constructor Details
#initialize(a) ⇒ TrigonometricOperator
Returns a new instance of TrigonometricOperator.
84 85 86 87 88 89 90 |
# 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 |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
81 82 83 |
# File 'lib/BOAST/Language/HighLevelOperators.rb', line 81 def operand @operand end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
82 83 84 |
# File 'lib/BOAST/Language/HighLevelOperators.rb', line 82 def return_type @return_type end |
Instance Method Details
#pr ⇒ Object
127 128 129 130 131 132 133 134 |
# 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 ⇒ Object
123 124 125 |
# File 'lib/BOAST/Language/HighLevelOperators.rb', line 123 def to_s return to_var.to_s end |
#to_var ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# 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 ⇒ Object
98 99 100 |
# File 'lib/BOAST/Language/HighLevelOperators.rb', line 98 def type return @return_type.type end |