Example #1
0
/**
 * Stream operator for QDebug
 */
QDebug operator<<(QDebug dbg, const RMatrix& m) {
    dbg.nospace() << "RMatrix(";
    for (int rc = 0; rc < m.getRows(); ++rc) {
        for (int cc = 0; cc < m.getCols(); ++cc) {
            dbg.nospace() << m.get(rc, cc);
            if (rc!=m.getRows()-1 || cc!=m.getCols()-1) {
                dbg.nospace() << ",";
            }
        }
    }
    dbg.nospace() << ")";
    return dbg;
}
Example #2
0
RMatrix RMatrix::operator *(double s) const {
    RMatrix ret = *this;

    for (int rc = 0; rc < ret.getRows(); ++rc) {
        for (int cc = 0; cc < ret.getCols(); ++cc) {
            ret.set(rc, cc, ret.get(rc, cc) * s);
        }
    }

    return ret;
}