diff --git a/scripts/switch_lapack_ubuntu.rb b/scripts/switch_lapack_ubuntu.rb index 71f5725f..560580d8 100755 --- a/scripts/switch_lapack_ubuntu.rb +++ b/scripts/switch_lapack_ubuntu.rb @@ -19,7 +19,6 @@ def run(cmd) system cmd end - run "update-alternatives --set liblapack.so.3 #{lapack_prefix}/liblapack.so.3" run "update-alternatives --set liblapack.so #{lapack_prefix}/liblapack.so" run "update-alternatives --set libblas.so.3 #{blas_prefix}/libblas.so.3" diff --git a/scripts/ttable_helper.rb b/scripts/ttable_helper.rb index 01decd1f..8c948cc2 100755 --- a/scripts/ttable_helper.rb +++ b/scripts/ttable_helper.rb @@ -3,113 +3,107 @@ # A helper file for generating and maintaining template tables. DTYPES = [ - :uint8_t, - :int8_t, - :int16_t, - :int32_t, - :int64_t, - :float32_t, - :float64_t, - :'nm::Complex64', - :'nm::Complex128', - :'nm::RubyObject' - ] + :uint8_t, + :int8_t, + :int16_t, + :int32_t, + :int64_t, + :float32_t, + :float64_t, + :'nm::Complex64', + :'nm::Complex128', + :'nm::RubyObject', +] def nullify(disabled = []) #:nodoc: - DTYPES.map { |t| if disabled.include?(t) then :NULL else t end } + DTYPES.map { |t| disabled.include?(t) ? :NULL : t } end ITYPES = [ - :uint8_t, - :uint16_t, - :uint32_t, - :uint64_t - ] + :uint8_t, + :uint16_t, + :uint32_t, + :uint64_t, +] EWOPS = [ - :'nm::EW_ADD', - :'nm::EW_SUB', - :'nm::EW_MUL', - :'nm::EW_DIV', - :'nm::EW_POW', - :'nm::EW_MOD', - :'nm::EW_EQEQ', - :'nm::EW_NEQ', - :'nm::EW_LT', - :'nm::EW_GT', - :'nm::EW_LEQ', - :'nm::EW_GEQ' - ] + :'nm::EW_ADD', + :'nm::EW_SUB', + :'nm::EW_MUL', + :'nm::EW_DIV', + :'nm::EW_POW', + :'nm::EW_MOD', + :'nm::EW_EQEQ', + :'nm::EW_NEQ', + :'nm::EW_LT', + :'nm::EW_GT', + :'nm::EW_LEQ', + :'nm::EW_GEQ', +] LR_ALLOWED = { - :uint8_t => DTYPES, - :int8_t => DTYPES, - :int16_t => DTYPES, - :int32_t => DTYPES, - :int64_t => DTYPES, - :float32_t => DTYPES, - :float64_t => DTYPES, - :'nm::Complex64' => DTYPES, - :'nm::Complex128' => DTYPES, - :'nm::RubyObject' => DTYPES + uint8_t: DTYPES, + int8_t: DTYPES, + int16_t: DTYPES, + int32_t: DTYPES, + int64_t: DTYPES, + float32_t: DTYPES, + float64_t: DTYPES, + 'nm::Complex64': DTYPES, + 'nm::Complex128': DTYPES, + 'nm::RubyObject': DTYPES, } lines = case ARGV[0] - when 'OPLR' - '{' + - EWOPS.map do |op| - - '{' + - DTYPES.map do |l_dtype| - - '{' + - LR_ALLOWED[l_dtype].map do |r_dtype| - if r_dtype == :NULL - 'NULL' - else - "fun<#{op}, #{l_dtype}, #{r_dtype}>" - end - end.join(', ') + - '}' - - end.join(",\n") + - '}' - - end.join(",\n") + - '}' - - when 'OPID' - '{' + - EWOPS.map do |op| - '{' + - ITYPES.map do |itype| - '{' + - DTYPES.map do |dtype| - - if dtype == :NULL - 'NULL' - else - "fun<#{op}, #{itype}, #{dtype}>" - end - - end.join(",") + - '}' - end.join(",\\\n") + - '}' - end.join(",\\\n") + - '}' - - when 'LR' - '{' + DTYPES.map do |l_dtype| - '{' + LR_ALLOWED[l_dtype].map do |r_dtype| + when "OPLR" + "{" + + EWOPS.map { |op| + "{" + + DTYPES.map { |l_dtype| + "{" + + LR_ALLOWED[l_dtype].map { |r_dtype| + if r_dtype == :NULL + "NULL" + else + "fun<#{op}, #{l_dtype}, #{r_dtype}>" + end + }.join(", ") + + "}" + }.join(",\n") + + "}" + }.join(",\n") + + "}" + + when "OPID" + "{" + + EWOPS.map { |op| + "{" + + ITYPES.map { |itype| + "{" + + DTYPES.map { |dtype| + if dtype == :NULL + "NULL" + else + "fun<#{op}, #{itype}, #{dtype}>" + end + }.join(",") + + "}" + }.join(",\\\n") + + "}" + }.join(",\\\n") + + "}" + + when "LR" + "{" + DTYPES.map { |l_dtype| + "{" + LR_ALLOWED[l_dtype].map { |r_dtype| if r_dtype == :NULL - 'NULL' + "NULL" else "fun<#{l_dtype}, #{r_dtype}>" end - end.join(', ') + '}' - end.join(",\n") + '}' + }.join(", ") + "}" + }.join(",\n") + "}" end puts lines