diff --git a/src/common/aka_iterators.hh b/src/common/aka_iterators.hh index 30ae540eb..455b2eae3 100644 --- a/src/common/aka_iterators.hh +++ b/src/common/aka_iterators.hh @@ -1,285 +1,285 @@ /** * @file aka_iterators.hh * * @author Nicolas Richart * * @date creation Wed Jul 19 2017 * * @brief iterator interfaces * * @section LICENSE * * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include #include /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_AKA_ITERATORS_HH__ #define __AKANTU_AKA_ITERATORS_HH__ namespace akantu { namespace tuple { /* ------------------------------------------------------------------------ */ namespace details { template struct Foreach { template static inline bool not_equal(Tuple && a, Tuple && b) { if (std::get(std::forward(a)) == std::get(std::forward(b))) return false; return Foreach::not_equal(std::forward(a), std::forward(b)); } }; /* ---------------------------------------------------------------------- */ template <> struct Foreach<0> { template static inline bool not_equal(Tuple && a, Tuple && b) { return std::get<0>(std::forward(a)) != std::get<0>(std::forward(b)); } }; template decltype(auto) make_tuple_no_decay(Ts &&... args) { return std::tuple(std::forward(args)...); } template void foreach_impl(F && func, Tuple && tuple, std::index_sequence &&) { (void)std::initializer_list{ (std::forward(func)(std::get(std::forward(tuple))), 0)...}; } template decltype(auto) transform_impl(F && func, Tuple && tuple, std::index_sequence &&) { return make_tuple_no_decay( std::forward(func)(std::get(std::forward(tuple)))...); } - }; // namespace details + } // namespace details /* ------------------------------------------------------------------------ */ template bool are_not_equal(Tuple && a, Tuple && b) { return details::Foreach>::value>:: not_equal(std::forward(a), std::forward(b)); } template void foreach (F && func, Tuple && tuple) { return details::foreach_impl( std::forward(func), std::forward(tuple), std::make_index_sequence< std::tuple_size>::value>{}); } template decltype(auto) transform(F && func, Tuple && tuple) { return details::transform_impl( std::forward(func), std::forward(tuple), std::make_index_sequence< std::tuple_size>::value>{}); } } // namespace tuple /* -------------------------------------------------------------------------- */ namespace iterators { template class ZipIterator { private: using tuple_t = std::tuple; public: explicit ZipIterator(tuple_t iterators) : iterators(std::move(iterators)) {} decltype(auto) operator*() { return tuple::transform([] (auto && it) -> decltype(auto) {return *it;}, iterators); } ZipIterator & operator++() { tuple::foreach ([] (auto && it) { ++it; }, iterators); return *this; } bool operator==(const ZipIterator & other) const { return not tuple::are_not_equal(iterators, other.iterators); } bool operator!=(const ZipIterator & other) const { return tuple::are_not_equal(iterators, other.iterators); } private: tuple_t iterators; }; } // namespace iterators /* -------------------------------------------------------------------------- */ template decltype(auto) zip_iterator(std::tuple && iterators_tuple) { auto zip = iterators::ZipIterator( std::forward(iterators_tuple)); return zip; } /* -------------------------------------------------------------------------- */ namespace containers { template class ZipContainer { using containers_t = std::tuple; public: explicit ZipContainer(Containers &&... containers) : containers(std::forward(containers)...) {} decltype(auto) begin() const { return zip_iterator( tuple::transform([] (auto && c) { return c.begin(); }, std::forward(containers))); } decltype(auto) end() const { return zip_iterator( tuple::transform([] (auto && c) { return c.end(); }, std::forward(containers))); } decltype(auto) begin() { return zip_iterator( tuple::transform([] (auto && c) { return c.begin(); }, std::forward(containers))); } decltype(auto) end() { return zip_iterator( tuple::transform([] (auto && c) { return c.end(); }, std::forward(containers))); } private: containers_t containers; }; } // namespace containers /* -------------------------------------------------------------------------- */ template decltype(auto) zip(Containers &&... conts) { return containers::ZipContainer( std::forward(conts)...); } /* -------------------------------------------------------------------------- */ /* Arange */ /* -------------------------------------------------------------------------- */ namespace iterators { template class ArangeIterator { public: using value_type = T; using pointer = T *; using reference = T &; using iterator_category = std::input_iterator_tag; constexpr ArangeIterator(T value, T step) : value(value), step(step) {} constexpr ArangeIterator(const ArangeIterator &) = default; constexpr ArangeIterator & operator++() { value += step; return *this; } constexpr const T & operator*() const { return value; } constexpr bool operator==(const ArangeIterator & other) const { return (value == other.value) and (step == other.step); } constexpr bool operator!=(const ArangeIterator & other) const { return not operator==(other); } private: T value{0}; const T step{1}; }; } // namespace iterators namespace containers { template class ArangeContainer { public: using iterator = iterators::ArangeIterator; constexpr ArangeContainer(T start, T stop, T step = 1) : start(start), stop((stop - start) % step == 0 ? stop : start + (1 + (stop - start) / step) * step), step(step) {} explicit constexpr ArangeContainer(T stop) : ArangeContainer(0, stop, 1) {} constexpr T operator[](size_t i) { T val = start + i * step; assert(val < stop && "i is out of range"); return val; } constexpr T size() { return (stop - start) / step; } constexpr iterator begin() { return iterator(start, step); } constexpr iterator end() { return iterator(stop, step); } private: const T start{0}, stop{0}, step{1}; }; } // namespace containers template >::value>> inline decltype(auto) arange(const T & stop) { return containers::ArangeContainer(stop); } template >::value>> inline constexpr decltype(auto) arange(const T1 & start, const T2 & stop) { return containers::ArangeContainer>(start, stop); } template >::value>> inline constexpr decltype(auto) arange(const T1 & start, const T2 & stop, const T3 & step) { return containers::ArangeContainer>( start, stop, step); } /* -------------------------------------------------------------------------- */ template inline constexpr decltype(auto) enumerate(Container && container, size_t start_ = 0) { auto stop = std::forward(container).size(); decltype(stop) start = start_; return zip(arange(start, stop), std::forward(container)); } } // namespace akantu #endif /* __AKANTU_AKA_ITERATORS_HH__ */ diff --git a/test/test_common/CMakeLists.txt b/test/test_common/CMakeLists.txt index 80caaeb04..1a8bc7149 100644 --- a/test/test_common/CMakeLists.txt +++ b/test/test_common/CMakeLists.txt @@ -1,49 +1,46 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Fri Sep 03 2010 # @date last modification: Mon Dec 07 2015 # # @brief configurations for common tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -#add_akantu_test(test_vector "Test akantu vector") - add_mesh(test_grid_mesh circle.geo 2 1) register_test(test_grid test_grid.cc DEPENDS test_grid_mesh PACKAGE core) -#register_test(test_math test_math.cc PACKAGE core) #register_test(test_types test_types.cc PACKAGE core) register_gtest_sources(SOURCES test_csr.cc PACKAGE core) -register_gtest_sources(SOURCES test_arange_iterator.cc PACKAGE core) -register_gtest_sources(SOURCES test_zip_iterator.cc PACKAGE core) +register_gtest_sources(SOURCES test_arange_iterator.cc PACKAGE core HEADER_ONLY) +register_gtest_sources(SOURCES test_zip_iterator.cc PACKAGE core HEADER_ONLY) register_gtest_sources(SOURCES test_array.cc PACKAGE core) register_gtest_sources(SOURCES test_tensors.cc PACKAGE core) register_gtest_test(test_common) diff --git a/test/test_common/test_math.cc b/test/test_common/test_math.cc deleted file mode 100644 index de8a8bed5..000000000 --- a/test/test_common/test_math.cc +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file test_math.cc - * - * @author Nicolas Richart - * - * @date creation: Mon Jun 14 2010 - * @date last modification: Sun Oct 19 2014 - * - * @brief test the static Math class - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu is free software: you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ -#include "aka_math.hh" - -using namespace akantu; - -void checkVect(Real * x, Real * xref, UInt n) { - Real * diff = new Real[n]; - for (UInt i = 0; i < n; ++i) { - diff[i] = xref[i] - x[i]; - } - - Real norm = Math::norm(n, diff) / Math::norm(n, xref); - Real tol = 1e-12; - if (norm > tol) { - std::cout << "differs form xref of " << std::scientific << norm << std::endl; - exit(-1); - } - - delete [] diff; -} - -/* -------------------------------------------------------------------------- */ -int main() { - Real A[3 * 5] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - }; - - Real x1[5] = {0, 1, 2, 3, 4}; - Real x2[3] = {0, 1, 2}; - - Real y1[3]; - Math::matrix_vector(3, 5, A, x1, y1, 1.); - Real y1_ref[3] = {90, 100, 110}; - - checkVect(y1, y1_ref, 3); - - Real y2[5]; - Math::matVectMul(3, 5, 1., A, x2, 0., y2); - Real y2_ref[5] = {5, 14, 23, 32, 41}; - - checkVect(y2, y2_ref, 5); - - return 0; -} diff --git a/test/test_common/test_vector/CMakeLists.txt b/test/test_common/test_vector/CMakeLists.txt deleted file mode 100644 index 743d9f9b3..000000000 --- a/test/test_common/test_vector/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -#=============================================================================== -# @file CMakeLists.txt -# -# @author Guillaume Anciaux -# -# @date creation: Fri Sep 03 2010 -# @date last modification: Tue Dec 02 2014 -# -# @brief configuration for vector tests -# -# @section LICENSE -# -# Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de -# Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des -# Solides) -# -# Akantu is free software: you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) any -# later version. -# -# Akantu is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with Akantu. If not, see . -# -# @section DESCRIPTION -# -#=============================================================================== - -register_test(test_vector test_vector.cc PACKAGE core) -register_test(test_vector_iterator test_vector_iterator.cc PACKAGE core) -register_test(test_matrix test_matrix.cc PACKAGE core) diff --git a/test/test_common/test_vector/test_matrix.cc b/test/test_common/test_vector/test_matrix.cc deleted file mode 100644 index 79e39009f..000000000 --- a/test/test_common/test_vector/test_matrix.cc +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @file test_matrix.cc - * - * @author Nicolas Richart - * - * @date creation: Thu Mar 03 2011 - * @date last modification: Sun Oct 19 2014 - * - * @brief tests for Matrix - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu is free software: you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ -#include "aka_common.hh" -#include "aka_types.hh" -#include "aka_array.hh" -#include "aka_math.hh" -/* -------------------------------------------------------------------------- */ -#include -#include -#include - - - -/* -------------------------------------------------------------------------- */ -using namespace akantu; - - -int main() { - -#define n 4 - UInt nbm = 10000; - - Real time; - - - Matrix eig_test(3, 3); - eig_test(0, 0) = 0; eig_test(0, 1) = 1; eig_test(0, 2) = 0; - eig_test(1, 0) = 1; eig_test(1, 1) = 0; eig_test(1, 2) = 0; - eig_test(2, 0) = 0; eig_test(2, 1) = 0; eig_test(2, 2) = 1; - - Matrix eig_vects(3, 3); - Vector eigs(3); - - eig_test.eig(eigs, eig_vects); - - std::cout << "A: " << eig_test << std::endl; - std::cout << "eig(A): " << eigs << " " << Vector(eig_vects(0)) << " " << Vector(eig_vects(1)) << " " << Vector(eig_vects(2)) << std::endl; - - Matrix check_eig_vects(3, 3); - check_eig_vects(0, 0) = 1./std::sqrt(2); check_eig_vects(0, 1) = 0; check_eig_vects(0, 2) = -1./std::sqrt(2); - check_eig_vects(1, 0) = 1./std::sqrt(2); check_eig_vects(1, 1) = 0; check_eig_vects(1, 2) = 1./std::sqrt(2); - check_eig_vects(2, 0) = 0; check_eig_vects(2, 1) = 1; check_eig_vects(2, 2) = 0; - - for (UInt i = 0; i < 3; ++i) { - Vector eig_v = eig_vects(i); - Vector check_eig_v = check_eig_vects(i); - - if(! check_eig_v.equal(eig_v, 1e-14)) { - AKANTU_DEBUG_ERROR("The " << i << "th eigen vector is not correct: " << eig_v << " should be " << check_eig_v); - } - } - - - - Array A(nbm, n*n); - Array B(nbm, n*n); - Array C1(nbm, n*n); - Array C2(nbm, n*n); - Array C3(nbm, n*n); - Array C4(nbm, n*n); - - for (UInt i = 0; i < n*n; ++i) { - A.storage()[i] = drand48(); - B.storage()[i] = drand48(); - } - - for (UInt i = 1; i < nbm; ++i) { - memcpy(A.storage() + i * n * n, A.storage(), n*n*sizeof(Real)); - memcpy(B.storage() + i * n * n, B.storage(), n*n*sizeof(Real)); - } - - struct timeval begin, end; - - Array::matrix_iterator itA = A.begin(n,n); - Array::matrix_iterator itB = B.begin(n,n); - itA = A.begin(n,n); - itB = B.begin(n,n); - std::cerr << *itA << std::endl; - std::cerr << *itB << std::endl; - - /* ------------------------------------------------------------------------ */ - gettimeofday(&begin, NULL); - Math::matrix_matrix(n, n, n, A, B, C1); - gettimeofday(&end, NULL); - - //time = (end.tv_sec * 1e3 + end.tv_usec * 1e-3) - (begin.tv_sec * 1e3 + begin.tv_usec * 1e-3); - time = (end.tv_sec * 1e6 + end.tv_usec) - (begin.tv_sec * 1e6 + begin.tv_usec); - std::cout << "matrix_matrix : " << std::fixed << time/nbm << "us" << std::endl; - - /* ------------------------------------------------------------------------ */ - Array::matrix_iterator itC = C2.begin(n,n); - - gettimeofday(&begin, NULL); - for (UInt i = 0; i < nbm; ++i) { - Matrix & C = *itC; - C = *itA * *itB; - ++itA; ++itB;++itC; - } - gettimeofday(&end, NULL); - - itC = C2.begin(n,n); - std::cerr << *itC << std::endl; - time = (end.tv_sec * 1e6 + end.tv_usec) - (begin.tv_sec * 1e6 + begin.tv_usec); - std::cout << "it Mc() = it Ma() * it Mb() : " << std::fixed << time/nbm << "us" << std::endl; - - /* ------------------------------------------------------------------------ */ - Array::matrix_iterator muitA = A.begin(n,n); - Array::matrix_iterator muitB = B.begin(n,n); - Array::matrix_iterator muitC = C4.begin(n,n); - gettimeofday(&begin, NULL); - for (UInt i = 0; i < nbm; ++i) { - muitC->mul(*muitA, *muitB); - ++muitA; ++muitB;++muitC; - } - gettimeofday(&end, NULL); - - muitC = C4.begin(n,n); - std::cerr << *muitC << std::endl; - - time = (end.tv_sec * 1e6 + end.tv_usec) - (begin.tv_sec * 1e6 + begin.tv_usec); - std::cout << "it Mc.mul( it Ma(), it Mb()) : " << std::fixed << time/nbm << "us" << std::endl; - - return 0; -} diff --git a/test/test_common/test_vector/test_vector.cc b/test/test_common/test_vector/test_vector.cc deleted file mode 100644 index 2198caa2a..000000000 --- a/test/test_common/test_vector/test_vector.cc +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file test_vector.cc - * - * @author Nicolas Richart - * - * @date creation: Tue Jun 29 2010 - * @date last modification: Sun Oct 19 2014 - * - * @brief test of the vector class - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu is free software: you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ -#include -#include -/* -------------------------------------------------------------------------- */ -#include "aka_common.hh" -#include "aka_types.hh" -#include "aka_array.hh" - -/* -------------------------------------------------------------------------- */ -using namespace akantu; - -int main() { - int def_value[3]; - def_value[0] = 10; - def_value[1] = 20; - def_value[2] = 30; - - std::cout << "Creating a vector" << std::endl; - Array int_vect(10, 3, def_value, "test1"); - - for (unsigned int i = 5; i < int_vect.size(); ++i) { - for (unsigned int j = 0; j < int_vect.getNbComponent(); ++j) { - int_vect.storage()[i * int_vect.getNbComponent() + j] = def_value[j] * 10; - } - } - - std::cerr << int_vect; - - Vector new_elem(3); - new_elem(0) = 1; - new_elem(1) = 2; - new_elem(2) = 3; - std::cout << "Testing push_back" << std::endl; - int_vect.push_back(new_elem); - - int_vect.push_back(200); - - int_vect.erase(0); - - std::cerr << int_vect; - akantu::Array int_vect0(0, 3, def_value, "test2"); - std::cerr << int_vect0; - int_vect0.push_back(new_elem); - std::cerr << int_vect0; - - return EXIT_SUCCESS; -} diff --git a/test/test_common/test_vector/test_vector_iterator.cc b/test/test_common/test_vector/test_vector_iterator.cc deleted file mode 100644 index 7aca9f005..000000000 --- a/test/test_common/test_vector/test_vector_iterator.cc +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @file test_vector_iterator.cc - * - * @author Nicolas Richart - * - * @date creation: Tue Jun 29 2010 - * @date last modification: Sun Oct 19 2014 - * - * @brief test the iterator present in the vector class - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu is free software: you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ -#include -#include -#include -/* -------------------------------------------------------------------------- */ -#include "aka_common.hh" -#include "aka_array.hh" -#include "aka_types.hh" -/* -------------------------------------------------------------------------- */ - -using namespace akantu; - -#define N 10 - -int main() { - typedef Array RealArray; - - std::cout << "Creating a vector of matrices (2,2)" << std::endl; - RealArray mat_vect(N, 4, 0.); - - std::cout << "Iterating on a Matrix(2,2)" << std::endl; - RealArray::iterator > itm; - itm = mat_vect.begin(2, 2); - RealArray::iterator > endm = mat_vect.end(2, 2); - - for (; itm != endm; ++itm) { - std::cout << *itm << std::endl; - } - - std::cout << "Creating a vector of UInt" << std::endl; - Array vect(N, 1, 0.); - - std::cout << "Iterating on a UInt" << std::endl; - Array::iterator it = vect.begin(); - Array::iterator end = vect.end(); - - std::vector test_vect; - - for (; it != end; ++it) { - UInt r = rand() % N; - *it = r; - test_vect.push_back(r); - std::cout << *it <::iterator itv = test_vect.begin(); - for (it = vect.begin(); it != end; ++it, ++itv) { - std::cout << *it << " " << *itv << std::endl; - if(*it != *itv) - AKANTU_DEBUG_ERROR("The sort of the vector gived bad results ("<< *it << " != " << *itv << ")"); - } - - return EXIT_SUCCESS; -} diff --git a/test/test_common/test_zip_iterator.verified b/test/test_common/test_zip_iterator.verified deleted file mode 100644 index 0d8ca791c..000000000 --- a/test/test_common/test_zip_iterator.verified +++ /dev/null @@ -1,15 +0,0 @@ -1 [1] 6 [1] -2 [1] 7 [1] -3 [1] 8 [1] -4 [1] 9 [1] -5 [1] 10 [1] -1 [1] 6 [1] -2 [1] 7 [1] -3 [1] 8 [1] -4 [1] 9 [1] -5 [1] 10 [1] -10 [1] 6 [1] -20 [1] 7 [1] -30 [1] 8 [1] -40 [1] 9 [1] -50 [1] 10 [1]