fn_conv.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2015 Conrad Sanderson (http://conradsanderson.id.au)
  2. // Copyright 2015 National ICT Australia (NICTA)
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // ------------------------------------------------------------------------
  15. #include <armadillo>
  16. #include "catch.hpp"
  17. using namespace arma;
  18. TEST_CASE("fn_conv_1")
  19. {
  20. vec a = linspace<vec>(1,5,6);
  21. vec b = 2*linspace<vec>(1,6,7);
  22. vec c = conv(a,b);
  23. vec d =
  24. {
  25. 2.00000000000000,
  26. 7.26666666666667,
  27. 17.13333333333333,
  28. 32.93333333333334,
  29. 56.00000000000000,
  30. 87.66666666666667,
  31. 117.66666666666666,
  32. 134.00000000000003,
  33. 137.73333333333335,
  34. 127.53333333333336,
  35. 102.06666666666668,
  36. 60.00000000000000
  37. };
  38. REQUIRE( accu(abs(c - d)) == Approx(0.0) );
  39. }