Class: MilkTea::Types::Matrix
Instance Attribute Summary collapse
-
#dim ⇒ Object
readonly
Returns the value of attribute dim.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #field(name) ⇒ Object
- #fields ⇒ Object
-
#initialize(name, dim:) ⇒ Matrix
constructor
A new instance of Matrix.
- #numeric? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #children, #field_c_name, #float?, #integer?, #sendable?, #void?
Constructor Details
#initialize(name, dim:) ⇒ Matrix
Returns a new instance of Matrix.
1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 |
# File 'lib/milk_tea/core/types.rb', line 1429 def initialize(name, dim:) @name = name @dim = dim @module_name = nil col_type = Vector.new("vec#{dim}", element_type: BUILTIN_VECTOR_ELEMENT, width: dim) @fields = (0...dim).each_with_object({}) do |i, h| h["col#{i}"] = col_type end.freeze @hash = [self.class, name].hash freeze end |
Instance Attribute Details
#dim ⇒ Object (readonly)
Returns the value of attribute dim.
1427 1428 1429 |
# File 'lib/milk_tea/core/types.rb', line 1427 def dim @dim end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
1447 1448 1449 |
# File 'lib/milk_tea/core/types.rb', line 1447 def hash @hash end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
1427 1428 1429 |
# File 'lib/milk_tea/core/types.rb', line 1427 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1427 1428 1429 |
# File 'lib/milk_tea/core/types.rb', line 1427 def name @name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
1441 1442 1443 |
# File 'lib/milk_tea/core/types.rb', line 1441 def eql?(other) other.is_a?(Matrix) && other.name == name end |
#field(name) ⇒ Object
1453 1454 1455 |
# File 'lib/milk_tea/core/types.rb', line 1453 def field(name) @fields[name] end |
#fields ⇒ Object
1449 1450 1451 |
# File 'lib/milk_tea/core/types.rb', line 1449 def fields @fields end |
#numeric? ⇒ Boolean
1457 1458 1459 |
# File 'lib/milk_tea/core/types.rb', line 1457 def numeric? true end |
#to_s ⇒ Object
1462 1463 1464 |
# File 'lib/milk_tea/core/types.rb', line 1462 def to_s name end |