• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IntelPython / dpnp / 16126000227

07 Jul 2025 07:24PM UTC coverage: 22.684% (-49.4%) from 72.051%
16126000227

Pull #2519

github

web-flow
Merge bd753a3a3 into 624f14f20
Pull Request #2519: tmp changes

889 of 9756 branches covered (9.11%)

Branch coverage included in aggregate %.

6317 of 22011 relevant lines covered (28.7%)

35.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

21.28
/dpnp/backend/src/dpnp_iface_fptr.cpp
1
//*****************************************************************************
2
// Copyright (c) 2016-2025, Intel Corporation
3
// All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are met:
7
// - Redistributions of source code must retain the above copyright notice,
8
//   this list of conditions and the following disclaimer.
9
// - Redistributions in binary form must reproduce the above copyright notice,
10
//   this list of conditions and the following disclaimer in the documentation
11
//   and/or other materials provided with the distribution.
12
//
13
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
// THE POSSIBILITY OF SUCH DAMAGE.
24
//*****************************************************************************
25

26
/*
27
 * This header file is for interface Cython with C++.
28
 * It should not contains any backend specific headers (like SYCL or math
29
 * library) because all included headers will be exposed in Cython compilation
30
 * procedure
31
 *
32
 * Also, this file should contains documentation on functions and types
33
 * which are used in the interface
34
 */
35

36
#include <cstring>
37
#include <stdexcept>
38

39
#include "dpnp_fptr.hpp"
40

41
static func_map_t func_map_init();
42

43
func_map_t func_map = func_map_init();
44

45
DPNPFuncData_t get_dpnp_function_ptr(DPNPFuncName func_name,
46
                                     DPNPFuncType first_type,
47
                                     DPNPFuncType second_type)
48
{
×
49
    DPNPFuncType local_second_type =
×
50
        (second_type == DPNPFuncType::DPNP_FT_NONE) ? first_type : second_type;
×
51

52
    func_map_t::const_iterator func_it = func_map.find(func_name);
×
53
    if (func_it == func_map.cend()) {
×
54
        throw std::runtime_error(
×
55
            "DPNP Error: Unsupported function call."); // TODO print Function ID
×
56
    }
×
57

58
    const map_1p_t &type1_map = func_it->second;
×
59
    map_1p_t::const_iterator type1_map_it = type1_map.find(first_type);
×
60
    if (type1_map_it == type1_map.cend()) {
×
61
        throw std::runtime_error("DPNP Error: Function ID with unsupported "
×
62
                                 "first parameter type."); // TODO print
×
63
                                                           // Function ID
64
    }
×
65

66
    const map_2p_t &type2_map = type1_map_it->second;
×
67
    map_2p_t::const_iterator type2_map_it = type2_map.find(local_second_type);
×
68
    if (type2_map_it == type2_map.cend()) {
×
69
        throw std::runtime_error("DPNP Error: Function ID with unsupported "
×
70
                                 "second parameter type."); // TODO print
×
71
                                                            // Function ID
72
    }
×
73

74
    DPNPFuncData_t func_info = type2_map_it->second;
×
75

76
    return func_info;
×
77
}
×
78

79
/**
80
 * This operator is needed for compatibility with Cython 0.29 which has a bug in
81
 * Enum handling
82
 * TODO needs to be deleted in future
83
 */
84
size_t operator-(DPNPFuncType lhs, DPNPFuncType rhs)
85
{
×
86
    size_t lhs_base = static_cast<size_t>(lhs);
×
87
    size_t rhs_base = static_cast<size_t>(rhs);
×
88

89
    size_t result = lhs_base - rhs_base;
×
90

91
    return result;
×
92
}
×
93

94
static func_map_t func_map_init()
95
{
2✔
96
    func_map_t fmap;
2✔
97

98
    func_map_init_arraycreation(fmap);
2✔
99
    func_map_init_elemwise(fmap);
2✔
100
    func_map_init_linalg(fmap);
2✔
101
    func_map_init_mathematical(fmap);
2✔
102
    func_map_init_random(fmap);
2✔
103
    func_map_init_sorting(fmap);
2✔
104

105
    return fmap;
2✔
106
};
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc