class BOAST::ConstArray
Attributes
shape[RW]
Public Class Methods
new(array,type = nil)
click to toggle source
Calls superclass method
# File lib/BOAST/Language/Variable.rb, line 98 def initialize(array,type = nil) super(array) @type = type::new if type end
Public Instance Methods
to_s()
click to toggle source
# File lib/BOAST/Language/Variable.rb, line 103 def to_s return to_s_fortran if lang == FORTRAN return to_s_c if [C, CL, CUDA].include?( lang ) end
Private Instance Methods
to_s_c()
click to toggle source
# File lib/BOAST/Language/Variable.rb, line 127 def to_s_c arr = flatten s = "" return s if arr.first.nil? s << "{\n" s << arr.first.to_s s << @type.suffix if @type arr[1..-1].each { |v| s << ",\n"+v.to_s s << @type.suffix if @type } s << "}" end
to_s_fortran()
click to toggle source
# File lib/BOAST/Language/Variable.rb, line 110 def to_s_fortran arr = flatten s = "" return s if arr.first.nil? s << "reshape(" if @shape s << "(/ &\n" s << arr.first.to_s s << @type.suffix if @type arr[1..-1].each { |v| s << ", &\n"+v.to_s s << @type.suffix if @type } s << " /)" s << ", shape(#{@shape}))" if @shape return s end