Beispiel #1
0
double SparseVector::product(const SparseVector &a)  const  {

    double ss = 0;

    if (this->nzEntries > a.nzEntries)  return a.product(*this);

    for (int cnt = 0; cnt < this->nzEntries; ++cnt)  {

        int ix = this->nz[ cnt ];

        if ( a.isNz[ ix ] )

            ss += a.val[ ix ] * this->val[ ix ];

    };

    return ss;



}