// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com> // // 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/.
Tensor<std::string, 1> sum = data1 + data2; for (int i = 0; i < 3; ++i) {
std::ostringstream concat;
concat << "abc" << i;
std::string expected = concat.str();
VERIFY_IS_EQUAL(sum(i), expected);
}
}
staticvoid test_initialization()
{
Tensor<std::string, 2> a(2, 3);
a.setConstant(std::string("foo")); for (int i = 0; i < 2*3; ++i) {
VERIFY_IS_EQUAL(a(i), std::string("foo"));
}
}
EIGEN_DECLARE_TEST(cxx11_tensor_of_strings)
{ // Beware: none of this is likely to ever work on a GPU.
CALL_SUBTEST(test_assign());
CALL_SUBTEST(test_concat());
CALL_SUBTEST(test_slices());
CALL_SUBTEST(test_additions());
CALL_SUBTEST(test_initialization());
}
¤ Dauer der Verarbeitung: 0.11 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.