File: test_extended_xmath_interp.cppy

package info (click to toggle)
xtensor 0.27.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,528 kB
  • sloc: cpp: 65,746; makefile: 202; python: 171; javascript: 8
file content (39 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/***************************************************************************
* Copyright (c) Johan Mabille, Sylvain Corlay and Wolf Vollprecht          *
* Copyright (c) QuantStack                                                 *
*                                                                          *
* Distributed under the terms of the BSD 3-Clause License.                 *
*                                                                          *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include <algorithm>

#include "xtensor/xarray.hpp"
#include "xtensor/xtensor.hpp"
#include "xtensor/xmath.hpp"

#include "test_common_macros.hpp"

namespace xt
{
    using namespace xt::placeholders;

    /*py
    xp = np.sort(np.random.random(20) - 0.5)
    fp = np.random.random(20) - 0.5
    x  = np.linspace(-1,1,50)
    f  = np.interp(x, xp, fp)
    */
    TEST(xtest_extended_xmath, interp)
    {
        // py_xp
        // py_fp
        // py_x
        // py_f

        auto f = xt::interp(py_x, py_xp, py_fp);

        EXPECT_TRUE(xt::allclose(f, py_f));
    }
}