// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
vec1.conservativeResize(rows+incRows);
refVec1.conservativeResize(rows+incRows); if (incRows > 0) refVec1.tail(incRows).setZero();
VERIFY_IS_APPROX(vec1, refVec1);
// Insert new values if (incRows > 0)
vec1.insert(vec1.rows()-1) = refVec1(refVec1.rows()-1) = 1;
VERIFY_IS_APPROX(vec1, refVec1);
}
}
}
EIGEN_DECLARE_TEST(sparse_vector)
{ for(int i = 0; i < g_repeat; i++) { int r = Eigen::internal::random<int>(1,500), c = Eigen::internal::random<int>(1,500); if(Eigen::internal::random<int>(0,4) == 0) {
r = c; // check square matrices in 25% of tries
}
EIGEN_UNUSED_VARIABLE(r+c);
CALL_SUBTEST_1(( sparse_vector<double,int>(8, 8) ));
CALL_SUBTEST_2(( sparse_vector<std::complex<double>, int>(r, c) ));
CALL_SUBTEST_1(( sparse_vector<double,longint>(r, c) ));
CALL_SUBTEST_1(( sparse_vector<double,short>(r, c) ));
}
}
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.