|
|
@ -200,6 +200,7 @@ public: |
|
|
|
void multiply(const MatExpr& e, double s, MatExpr& res) const; |
|
|
|
void multiply(const MatExpr& e, double s, MatExpr& res) const; |
|
|
|
|
|
|
|
|
|
|
|
static void makeExpr(MatExpr& res, int method, Size sz, int type, double alpha=1); |
|
|
|
static void makeExpr(MatExpr& res, int method, Size sz, int type, double alpha=1); |
|
|
|
|
|
|
|
static void makeExpr(MatExpr& res, int method, int ndims, const int* sizes, int type, double alpha=1); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static MatOp_Initializer* getGlobalMatOpInitializer() |
|
|
|
static MatOp_Initializer* getGlobalMatOpInitializer() |
|
|
@ -1555,8 +1556,13 @@ void MatOp_Initializer::assign(const MatExpr& e, Mat& m, int _type) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( _type == -1 ) |
|
|
|
if( _type == -1 ) |
|
|
|
_type = e.a.type(); |
|
|
|
_type = e.a.type(); |
|
|
|
m.create(e.a.size(), _type); |
|
|
|
|
|
|
|
if( e.flags == 'I' ) |
|
|
|
if( e.a.dims <= 2 ) |
|
|
|
|
|
|
|
m.create(e.a.size(), _type); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
m.create(e.a.dims, e.a.size, _type); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( e.flags == 'I' && e.a.dims <= 2 ) |
|
|
|
setIdentity(m, Scalar(e.alpha)); |
|
|
|
setIdentity(m, Scalar(e.alpha)); |
|
|
|
else if( e.flags == '0' ) |
|
|
|
else if( e.flags == '0' ) |
|
|
|
m = Scalar(); |
|
|
|
m = Scalar(); |
|
|
@ -1577,6 +1583,12 @@ inline void MatOp_Initializer::makeExpr(MatExpr& res, int method, Size sz, int t |
|
|
|
res = MatExpr(getGlobalMatOpInitializer(), method, Mat(sz, type, (void*)0), Mat(), Mat(), alpha, 0); |
|
|
|
res = MatExpr(getGlobalMatOpInitializer(), method, Mat(sz, type, (void*)0), Mat(), Mat(), alpha, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void MatOp_Initializer::makeExpr(MatExpr& res, int method, int ndims, const int* sizes, int type, double alpha) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
res = MatExpr(getGlobalMatOpInitializer(), method, Mat(ndims, sizes, type, (void*)0), Mat(), Mat(), alpha, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
@ -1636,6 +1648,20 @@ MatExpr Mat::ones(Size size, int type) |
|
|
|
return e; |
|
|
|
return e; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MatExpr Mat::zeros(int ndims, const int* sizes, int type) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MatExpr e; |
|
|
|
|
|
|
|
MatOp_Initializer::makeExpr(e, '0', ndims, sizes, type); |
|
|
|
|
|
|
|
return e; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MatExpr Mat::ones(int ndims, const int* sizes, int type) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MatExpr e; |
|
|
|
|
|
|
|
MatOp_Initializer::makeExpr(e, '1', ndims, sizes, type); |
|
|
|
|
|
|
|
return e; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MatExpr Mat::eye(int rows, int cols, int type) |
|
|
|
MatExpr Mat::eye(int rows, int cols, int type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MatExpr e; |
|
|
|
MatExpr e; |
|
|
|