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.
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:
DenseVector
DenseVector
DenseVector
likeA
DenseVector
double
DenseVector
likeA
DenseVector
SparseVector
A + B
orA - B
DenseVector
likeA
SparseVector
DenseVector
A * B
SparseVector
likeA
SparseVector
SparseVector
A * B
SparseVector
likeA
SparseVector
SparseVector
A + B
orA - B
SparseVector
likeA
SparseVector
double
A * B
orA / B
SparseVector
likeA
SparseVector
double
A + B
orA - B
DenseVector
Here
like
means that the resulting vector should has the same type asA
orB
. Simple speaking, we should doa.blank()
orb.blank()
for those cases.