[eigen] How can I improve this function
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: [eigen] How can I improve this function
• From: Hung Dang <hungptit@xxxxxxxxx>
• Date: Fri, 21 Sep 2012 19:54:53 -0400
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=8V3PmW/YsXLHCLzFScIPIOqfVCUHaM8qS3m0pRrnPGE=; b=AjN4DydEjkeV3ileVFbpWRSR/COTj5PuWGT4XqaLK1JEIIdXAxLJ/hBjJL/KTU8qaQ Woqtl+J5yhiV1AhQiG/4aVmjlHh8tHA47hh6iGwaAtGjU8uHygNu/xn1DsddZac8xkLE kRInDbYvoBGxYxSAYX07gdqgLoaN1NG5TZJ0li+zEahl5AX3XF+FL2xXN0mBVwdzDihq C2kvY68pRVcQIx1/0VHHOJHuqB4FUFg4CD/UYYhTMgrRft7bEUIGmkeyz0IKcHwRHjSv q0fOlDDAVmHJ/mqSsoLv2Hm50MWIVmPeRz7DuCyrUy9b4uyL7PJ/kTZzgV/mgfdg3hLD kfew==

```Hi all,

```
I have below function and I would like to improve it using Eigen's way. Any suggestion?
```
Thanks a lot
Hung

template<typename T>
void combine(Eigen::Matrix<T, Eigen::Dynamic, 1> & x, const T xval,
const Eigen::Matrix<T, Eigen::Dynamic, 1> & y, const T yval) {
const size_t len = x.rows();
for (size_t idx = 0; idx < len; idx ++) {
if (x(idx,0) > 0) {
x(idx,0) = xval;
} else {
if (y(idx,0) > 0) x(idx,0) = yval;
}
}
}

```

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/