FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/src/array.h at main · commit-0/matplotlib · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
commit-0
/
matplotlib
Public
forked from
matplotlib/matplotlib
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
src
/
array.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
96 lines (76 loc) · 1.35 KB
Breadcrumbs
matplotlib
/
src
/
array.h
Copy path
File metadata and controls
96 lines (76 loc) · 1.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
-*- mode: c++; c-basic-offset: 4 -*-
*/
/*
Utilities to create scalars and empty arrays that behave like the
Numpy array wrappers in numpy_cpp.h
*/
#
ifndef
MPL_SCALAR_H
#
define
MPL_SCALAR_H
#
include
<
cstddef
>
#
include
<
stdexcept
>
namespace
array
{
template
<
typename
T,
int
ND
>
class
scalar
{
public:
T m_value;
scalar
(
const
T value) : m_value(value)
{
}
T &
operator
()(
int
i,
int
j =
0
,
int
k =
0
)
{
return
m_value;
}
const
T &
operator
()(
int
i,
int
j =
0
,
int
k =
0
)
const
{
return
m_value;
}
int
shape
(
size_t
i)
{
return
1
;
}
size_t
size
()
{
return
1
;
}
};
template
<
typename
T,
int
ND
>
size_t
safe_first_shape
(scalar<T,
ND
>)
{
return
1
;
}
template
<
typename
T>
class
empty
{
public:
typedef
empty<T>
sub_t
;
empty
()
{
}
T &
operator
()(
int
i,
int
j =
0
,
int
k =
0
)
{
throw
std::runtime_error
(
"
Accessed empty array
"
);
}
const
T &
operator
()(
int
i,
int
j =
0
,
int
k =
0
)
const
{
throw
std::runtime_error
(
"
Accessed empty array
"
);
}
sub_t
operator
[](
int
i)
const
{
return
empty<T>();
}
int
shape
(
size_t
i)
const
{
return
0
;
}
size_t
size
()
const
{
return
0
;
}
};
template
<
typename
T>
size_t
safe_first_shape
(empty<T>)
{
return
0
;
}
}
#
endif
Back
|
FazBrowse Home
|
New Git URL