fix: remove redundant copy operation to fix warning (#3486)

* fix compiler warning: deprecated implicit copy constructor

* take care of the bug http://eigen.tuxfamily.org/bz/show_bug.cgi?id=747

* add parenthesis for better reading

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update include/pybind11/eigen.h

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
Lishen1 2021-11-22 23:27:00 +03:00 committed by GitHub
parent 9281faf429
commit 5d067e870a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,14 +80,12 @@ template <bool EigenRowMajor> struct EigenConformable {
// Matrix type:
EigenConformable(EigenIndex r, EigenIndex c,
EigenIndex rstride, EigenIndex cstride) :
conformable{true}, rows{r}, cols{c} {
// TODO: when Eigen bug #747 is fixed, remove the tests for non-negativity. http://eigen.tuxfamily.org/bz/show_bug.cgi?id=747
if (rstride < 0 || cstride < 0) {
negativestrides = true;
} else {
stride = {EigenRowMajor ? rstride : cstride /* outer stride */,
EigenRowMajor ? cstride : rstride /* inner stride */ };
}
conformable{true}, rows{r}, cols{c},
//TODO: when Eigen bug #747 is fixed, remove the tests for non-negativity. http://eigen.tuxfamily.org/bz/show_bug.cgi?id=747
stride{EigenRowMajor ? (rstride > 0 ? rstride : 0) : (cstride > 0 ? cstride : 0) /* outer stride */,
EigenRowMajor ? (cstride > 0 ? cstride : 0) : (rstride > 0 ? rstride : 0) /* inner stride */ },
negativestrides{rstride < 0 || cstride < 0} {
}
// Vector type:
EigenConformable(EigenIndex r, EigenIndex c, EigenIndex stride)