Define the 'type system' rules for vectors
vkostyukov opened this issue · 0 comments
vkostyukov commented
Since, we want to move out of the factories, we have to provide the explicit set of rules for common operations. This ticket is only about vectors. There idea is to have the table like this:
Operand A | Operand B | Operation | Result Type |
---|---|---|---|
DenseVector |
DenseVector |
any operation | DenseVector like A |
DenseVector |
double |
any operation | DenseVector like A |
DenseVector |
SparseVector |
A + B or A - B |
DenseVector like A |
SparseVector |
DenseVector |
A * B |
SparseVector like A |
SparseVector |
SparseVector |
A * B |
SparseVector like A |
SparseVector |
SparseVector |
A + B or A - B |
SparseVector like A |
SparseVector |
double |
A * B or A / B |
SparseVector like A |
SparseVector |
double |
A + B or A - B |
the default DenseVector |
Here like
means that the resulting vector should has the same type as A
or B
. Simple speaking, we should do a.blank()
or b.blank()
for those cases.