Class: MilkTea::Types::Matrix
- Defined in:
- lib/milk_tea/core/types/types.rb
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.
1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 |
# File 'lib/milk_tea/core/types/types.rb', line 1440 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.
1438 1439 1440 |
# File 'lib/milk_tea/core/types/types.rb', line 1438 def dim @dim end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
1458 1459 1460 |
# File 'lib/milk_tea/core/types/types.rb', line 1458 def hash @hash end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
1438 1439 1440 |
# File 'lib/milk_tea/core/types/types.rb', line 1438 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1438 1439 1440 |
# File 'lib/milk_tea/core/types/types.rb', line 1438 def name @name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
1452 1453 1454 |
# File 'lib/milk_tea/core/types/types.rb', line 1452 def eql?(other) other.is_a?(Matrix) && other.name == name end |
#field(name) ⇒ Object
1464 1465 1466 |
# File 'lib/milk_tea/core/types/types.rb', line 1464 def field(name) @fields[name] end |
#fields ⇒ Object
1460 1461 1462 |
# File 'lib/milk_tea/core/types/types.rb', line 1460 def fields @fields end |
#numeric? ⇒ Boolean
1468 1469 1470 |
# File 'lib/milk_tea/core/types/types.rb', line 1468 def numeric? true end |
#to_s ⇒ Object
1473 1474 1475 |
# File 'lib/milk_tea/core/types/types.rb', line 1473 def to_s name end |