Module: Combinatorics::CartesianProduct
- Defined in:
- lib/combinatorics/cartesian_product/cardinality.rb,
lib/combinatorics/cartesian_product/mixin.rb
Overview
Defined Under Namespace
Modules: Mixin
Class Method Summary collapse
-
.cardinality(a, b) ⇒ Fixnum
Wrapper for Cartesian product cardinality method defined above.
- .X(a, b) ⇒ Object
Class Method Details
.cardinality(a, b) ⇒ Fixnum
Wrapper for Cartesian product cardinality method defined above
29 30 31 32 33 34 35 |
# File 'lib/combinatorics/cartesian_product/cardinality.rb', line 29 def self.cardinality(a,b) if (a <= 0 || b <= 0) raise(RangeError,"inputs must be greater than zero") end a * b end |
.X(a, b) ⇒ Object
Note:
The letter `X' is scholastic notation for the Cartesian product set operation
43 44 45 |
# File 'lib/combinatorics/cartesian_product/cardinality.rb', line 43 def self.X(a,b) cardinality(a,b) end |