| 251 | } |
| 252 | |
| 253 | void MatOp::diag(const MatExpr& expr, int d, MatExpr& e) const |
| 254 | { |
| 255 | if( elementWise(expr) ) |
| 256 | { |
| 257 | e = MatExpr(expr.op, expr.flags, Mat(), Mat(), Mat(), |
| 258 | expr.alpha, expr.beta, expr.s); |
| 259 | if(expr.a.data) |
| 260 | e.a = expr.a.diag(d); |
| 261 | if(expr.b.data) |
| 262 | e.b = expr.b.diag(d); |
| 263 | if(expr.c.data) |
| 264 | e.c = expr.c.diag(d); |
| 265 | } |
| 266 | else |
| 267 | { |
| 268 | Mat m; |
| 269 | expr.op->assign(expr, m); |
| 270 | e = MatExpr(&g_MatOp_Identity, 0, m.diag(d), Mat(), Mat()); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | |
| 275 | void MatOp::augAssignAdd(const MatExpr& expr, Mat& m) const |