// Ceres Solver - A fast non-linear least squares minimizer // Copyright 2022 Google Inc. All rights reserved. // http://ceres-solver.org/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Google Inc. nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Author: jodebo_beck@gmx.de (Johannes Beck) // sergiu.deitsch@gmail.com (Sergiu Deitsch) #include "ceres/internal/integer_sequence_algorithm.h" #include #include #include "ceres/internal/jet_traits.h" namespace ceres::internal { // Unit tests for exclusive scan of integer sequence. static_assert(std::is_same>, std::integer_sequence>::value, "Unit test of calculating the exclusive scan of an integer " "sequence failed."); static_assert(std::is_same>, std::integer_sequence>::value, "Unit test of calculating the exclusive scan of an integer " "sequence failed."); static_assert(std::is_same>, std::integer_sequence>::value, "Unit test of calculating the exclusive scan of an integer " "sequence failed."); static_assert(std::is_same>, std::integer_sequence>::value, "Unit test of calculating the exclusive scan of an integer " "sequence failed."); using Ranks001 = Ranks_t, double, Jet>; using Ranks1 = Ranks_t>; using Ranks110 = Ranks_t, Jet, double>; using Ranks023 = Ranks_t, Jet>; using EmptyRanks = Ranks_t<>; // Remove zero from the ranks integer sequence using NonZeroRanks001 = RemoveValue_t; using NonZeroRanks1 = RemoveValue_t; using NonZeroRanks110 = RemoveValue_t; using NonZeroRanks023 = RemoveValue_t; static_assert(std::is_same, std::integer_sequence>::value, "filtered sequence does not match an empty one"); static_assert(std::is_same, 2>, std::integer_sequence>::value, "filtered sequence does not match an empty one"); static_assert( std::is_same, 2>, std::integer_sequence>::value, "filtered sequence does not match the expected one"); static_assert( std::is_same, 7>, std::make_integer_sequence>::value, "sequence not containing the element to remove must not be transformed"); static_assert( std::is_same>::value, "sequences do not match"); static_assert(std::is_same>::value, "sequences do not match"); static_assert( std::is_same>::value, "sequences do not match"); static_assert( std::is_same>::value, "sequences do not match"); static_assert(std::is_same, -1>, std::integer_sequence>::value, "sequences do not match"); static_assert( std::is_same, -1>, std::integer_sequence>::value, "sequences do not match"); using J = Jet; template using J0 = Jet; using J0d = J0; // Ensure all types match static_assert(AreAllSame_v, "types must be the same"); static_assert(AreAllSame_v, "types must be the same"); static_assert(AreAllSame_v, "types must be the same"); static_assert(!AreAllSame_v, "types must not be the same"); static_assert(!AreAllSame_v, "types must not be the same"); // Ensure all values in the integer sequence match static_assert(AreAllEqual_v, "integer sequence must contain same values"); static_assert(AreAllEqual_v, "integer sequence must contain one value"); static_assert(!AreAllEqual_v, "integer sequence must not contain the same values"); static_assert(!AreAllEqual_v, "integer sequence must not contain the same values"); static_assert(!AreAllEqual_v, "integer sequence must not contain the same values"); static_assert(IsEmptyOrAreAllEqual_v>, "expected empty sequence is not"); static_assert(IsEmptyOrAreAllEqual_v>, "expected all equal sequence is not"); static_assert(IsEmptyOrAreAllEqual_v>, "expected all equal sequence is not"); static_assert( IsEmptyOrAreAllEqual_v>, "expected all equal sequence is not"); } // namespace ceres::internal