Skip to content

Commit

Permalink
add multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
amattioc committed Apr 8, 2024
1 parent d607a50 commit 62be353
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 0 deletions.
56 changes: 56 additions & 0 deletions v2.1/docs/operators/Multiplication/content.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
------
Syntax
------
.. code-block:: text
op1 * op2
----------------
Input parameters
----------------
.. list-table::

* - op1
- the multiplicand
* - op2
- the multiplier

------------------------------------
Semantics for scalar operations
------------------------------------
The operator addition returns the product of two numbers.
For example: ::

3 * 5 gives 15

-----------------------------
Input parameters type
-----------------------------
op1, op2 ::

dataset { measure<number> _+ }
| component<number>
| number
-----------------------------
Result type
-----------------------------
result ::

dataset { measure<number> _+ }
| component<number>
| number
-----------------------------
Additional Constraints
-----------------------------
None.

--------
Behavior
--------

The operator has the behaviour of the "Operators applicable on two Scalar Values or Data Sets or Data Set Components" (see the section "Typical behaviours of the ML Operators").
According to the general rules about data types, the operator can be applied also on sub-types of number, that is the type integer.
If the type of both operands is integer then the result has type integer.
If one of the operands is of type number, then the other operand is implicitly cast to number and therefore the result has type number.
5 changes: 5 additions & 0 deletions v2.1/docs/operators/Multiplication/examples/ds_1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Id_1,Id_2,Me_1,Me_2
10,A,100,7.6
10,B,10,12.3
11,A,20,25.0
11,B,2,20.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ds_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
4 changes: 4 additions & 0 deletions v2.1/docs/operators/Multiplication/examples/ds_2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Id_1,Id_2,Me_1,Me_2
10,A,1,2.0
10,C,5,3.0
11,B,2,1.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ds_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
3 changes: 3 additions & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Id_1,Id_2,Me_1,Me_2
10,A,100,15.2
11,B,4,20.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_1.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DS_r := DS_1 * DS_2
5 changes: 5 additions & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Id_1,Id_2,Me_1,Me_2
10,A,-300,-22.8
10,B,-30,-36.9
11,A,-60,-75.0
11,B,-6,-60.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_2.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DS_r := DS_1 * -3
5 changes: 5 additions & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_3.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Id_1,Id_2,Me_1,Me_2,Me_3
10,A,100,7.6,760.0
10,B,10,12.3,123.0
11,A,20,25.0,500.0
11,B,2,20.0,40.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/ex_3.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DS_r := DS_1 [ calc Me_3 := Me_1 + 3.0 ]
1 change: 1 addition & 0 deletions v2.1/docs/operators/Multiplication/examples/intro.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Given the operand datasets DS_1 and DS_2:

0 comments on commit 62be353

Please sign in to comment.