int[] dimWH = { m, n };
int[] dimVWH = { m, n };
int[] dimHWVWH = { r, n };
SparseMatrix matrixWH = new SparseMatrix(dimWH);
SparseMatrix matrixVWH = new SparseMatrix(dimVWH);
SparseMatrix matrixHWVWH = new SparseMatrix(dimHWVWH);
matrixWH = w.mutiplyMatrix(h);
TLongFloatIterator itV = v.vector.iterator();
TLongFloatIterator itH = h.vector.iterator();
for (int i = v.vector.size(); i-- > 0;) {
itV.advance();
matrixVWH.set(itV.key(),
itV.value() / (matrixWH.elementAt(itV.key()) + eps));
}
SparseMatrix matrixTranW = w.trans();
SparseMatrix matrixWVWH = matrixTranW.mutiplyMatrix(matrixVWH);
for (int i = h.vector.size(); i-- > 0;) {
itH.advance();
matrixHWVWH.set(itH.key(),
itH.value() * matrixWVWH.elementAt(itH.key()));
}
return matrixHWVWH;
}