Bug Summary

File:/tmp/pyrefcon/scipy/scipy/signal/_spectral.cpp
Warning:line 386, column 25
PyObject ownership leak with reference count of 1

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name _spectral.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-output=html -analyzer-checker=python -analyzer-disable-checker=deadcode -analyzer-config prune-paths=true,suppress-c++-stdlib=true,suppress-null-return-paths=false,crosscheck-with-z3=true,model-path=/opt/pyrefcon/lib/pyrefcon/models/models -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=/tmp/pyrefcon/scipy/csa-scan,ctu-index-name=/tmp/pyrefcon/scipy/csa-scan/externalDefMap.txt,ctu-invocation-list=/tmp/pyrefcon/scipy/csa-scan/invocations.yaml,display-ctu-progress=false -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/tmp/pyrefcon/scipy -resource-dir /opt/pyrefcon/lib/clang/13.0.0 -isystem /opt/pyrefcon/lib/pyrefcon/models/python3.8 -D NDEBUG -D _FORTIFY_SOURCE=2 -D ENABLE_PYTHON_MODULE -D __PYTHRAN__=3 -D PYTHRAN_BLAS_NONE -I /home/pyrefcon/.local/lib/python3.8/site-packages/pythran -I /usr/lib/python3/dist-packages/numpy/core/include -I /usr/lib/python3/dist-packages/numpy/core/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /opt/pyrefcon/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-result -Wsign-compare -Wall -Wformat -Werror=format-security -Wformat -Werror=format-security -Wdate-time -Wno-unused-function -Wno-int-in-bool-context -Wno-unknown-warning-option -std=c++11 -fdeprecated-macro -fdebug-compilation-dir=/tmp/pyrefcon/scipy -ferror-limit 19 -fvisibility hidden -pthread -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/pyrefcon/scipy/csa-scan/reports -x c++ scipy/signal/_spectral.cpp

scipy/signal/_spectral.cpp

1#include <pythonic/core.hpp>
2#include <pythonic/python/core.hpp>
3#include <pythonic/types/bool.hpp>
4#include <pythonic/types/int.hpp>
5#ifdef _OPENMP
6#include <omp.h>
7#endif
8#include <pythonic/include/types/ndarray.hpp>
9#include <pythonic/include/types/float64.hpp>
10#include <pythonic/types/float64.hpp>
11#include <pythonic/types/ndarray.hpp>
12#include <pythonic/include/builtins/ValueError.hpp>
13#include <pythonic/include/builtins/ZeroDivisionError.hpp>
14#include <pythonic/include/builtins/getattr.hpp>
15#include <pythonic/include/builtins/range.hpp>
16#include <pythonic/include/numpy/arctan2.hpp>
17#include <pythonic/include/numpy/cos.hpp>
18#include <pythonic/include/numpy/empty_like.hpp>
19#include <pythonic/include/numpy/sin.hpp>
20#include <pythonic/include/numpy/square.hpp>
21#include <pythonic/include/operator_/add.hpp>
22#include <pythonic/include/operator_/div.hpp>
23#include <pythonic/include/operator_/eq.hpp>
24#include <pythonic/include/operator_/iadd.hpp>
25#include <pythonic/include/operator_/mul.hpp>
26#include <pythonic/include/operator_/ne.hpp>
27#include <pythonic/include/operator_/sub.hpp>
28#include <pythonic/include/types/slice.hpp>
29#include <pythonic/include/types/str.hpp>
30#include <pythonic/builtins/ValueError.hpp>
31#include <pythonic/builtins/ZeroDivisionError.hpp>
32#include <pythonic/builtins/getattr.hpp>
33#include <pythonic/builtins/range.hpp>
34#include <pythonic/numpy/arctan2.hpp>
35#include <pythonic/numpy/cos.hpp>
36#include <pythonic/numpy/empty_like.hpp>
37#include <pythonic/numpy/sin.hpp>
38#include <pythonic/numpy/square.hpp>
39#include <pythonic/operator_/add.hpp>
40#include <pythonic/operator_/div.hpp>
41#include <pythonic/operator_/eq.hpp>
42#include <pythonic/operator_/iadd.hpp>
43#include <pythonic/operator_/mul.hpp>
44#include <pythonic/operator_/ne.hpp>
45#include <pythonic/operator_/sub.hpp>
46#include <pythonic/types/slice.hpp>
47#include <pythonic/types/str.hpp>
48namespace __pythran__spectral
49{
50 struct _lombscargle
51 {
52 typedef void callable;
53 typedef void pure;
54 template <typename argument_type0 , typename argument_type1 , typename argument_type2 >
55 struct type
56 {
57 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::empty_like{})>::type>::type __type0;
58 typedef typename std::remove_cv<typename std::remove_reference<argument_type2>::type>::type __type1;
59 typedef typename pythonic::assignable<decltype(std::declval<__type0>()(std::declval<__type1>()))>::type __type2;
60 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::builtins::functor::range{})>::type>::type __type3;
61 typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type1>())) __type5;
62 typedef typename std::tuple_element<0,typename std::remove_reference<__type5>::type>::type __type6;
63 typedef decltype(std::declval<__type3>()(std::declval<__type6>())) __type7;
64 typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type7>::type::iterator>::value_type>::type __type8;
65 typedef indexable<__type8> __type9;
66 typedef typename __combined<__type2,__type9>::type __type10;
67 typedef double __type11;
68 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::square{})>::type>::type __type12;
69 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::cos{})>::type>::type __type13;
70 typedef decltype(std::declval<__type1>()[std::declval<__type8>()]) __type16;
71 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::arctan2{})>::type>::type __type17;
72 typedef long __type18;
73 typedef typename pythonic::assignable<double>::type __type19;
74 typedef typename std::remove_cv<typename std::remove_reference<argument_type0>::type>::type __type20;
75 typedef typename pythonic::assignable<decltype(std::declval<__type0>()(std::declval<__type20>()))>::type __type21;
76 typedef decltype(pythonic::operator_::mul(std::declval<__type16>(), std::declval<__type20>())) __type26;
77 typedef decltype(std::declval<__type13>()(std::declval<__type26>())) __type27;
78 typedef typename __combined<__type21,__type27>::type __type28;
79 typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type20>())) __type30;
80 typedef typename std::tuple_element<0,typename std::remove_reference<__type30>::type>::type __type31;
81 typedef decltype(std::declval<__type3>()(std::declval<__type31>())) __type32;
82 typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type32>::type::iterator>::value_type>::type __type33;
83 typedef decltype(std::declval<__type28>()[std::declval<__type33>()]) __type34;
84 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::sin{})>::type>::type __type37;
85 typedef decltype(std::declval<__type37>()(std::declval<__type26>())) __type43;
86 typedef typename __combined<__type21,__type43>::type __type44;
87 typedef decltype(std::declval<__type44>()[std::declval<__type33>()]) __type46;
88 typedef decltype(pythonic::operator_::mul(std::declval<__type34>(), std::declval<__type46>())) __type47;
89 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type47>())) __type48;
90 typedef typename __combined<__type19,__type48>::type __type49;
91 typedef typename __combined<__type49,__type47>::type __type50;
92 typedef decltype(pythonic::operator_::mul(std::declval<__type18>(), std::declval<__type50>())) __type51;
93 typedef decltype(std::declval<__type12>()(std::declval<__type34>())) __type55;
94 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type55>())) __type56;
95 typedef typename __combined<__type19,__type56>::type __type57;
96 typedef typename __combined<__type57,__type55>::type __type58;
97 typedef decltype(std::declval<__type12>()(std::declval<__type46>())) __type62;
98 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type62>())) __type63;
99 typedef typename __combined<__type19,__type63>::type __type64;
100 typedef typename __combined<__type64,__type62>::type __type65;
101 typedef decltype(pythonic::operator_::sub(std::declval<__type58>(), std::declval<__type65>())) __type66;
102 typedef decltype(std::declval<__type17>()(std::declval<__type51>(), std::declval<__type66>())) __type67;
103 typedef decltype(pythonic::operator_::mul(std::declval<__type18>(), std::declval<__type16>())) __type71;
104 typedef typename pythonic::assignable<decltype(pythonic::operator_::div(std::declval<__type67>(), std::declval<__type71>()))>::type __type72;
105 typedef decltype(pythonic::operator_::mul(std::declval<__type16>(), std::declval<__type72>())) __type73;
106 typedef typename pythonic::assignable<decltype(std::declval<__type13>()(std::declval<__type73>()))>::type __type74;
107 typedef typename std::remove_cv<typename std::remove_reference<argument_type1>::type>::type __type75;
108 typedef decltype(std::declval<__type75>()[std::declval<__type33>()]) __type77;
109 typedef decltype(pythonic::operator_::mul(std::declval<__type77>(), std::declval<__type34>())) __type81;
110 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type81>())) __type82;
111 typedef typename __combined<__type19,__type82>::type __type83;
112 typedef typename __combined<__type83,__type81>::type __type84;
113 typedef decltype(pythonic::operator_::mul(std::declval<__type74>(), std::declval<__type84>())) __type85;
114 typedef typename pythonic::assignable<decltype(std::declval<__type37>()(std::declval<__type73>()))>::type __type91;
115 typedef decltype(pythonic::operator_::mul(std::declval<__type77>(), std::declval<__type46>())) __type98;
116 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type98>())) __type99;
117 typedef typename __combined<__type19,__type99>::type __type100;
118 typedef typename __combined<__type100,__type98>::type __type101;
119 typedef decltype(pythonic::operator_::mul(std::declval<__type91>(), std::declval<__type101>())) __type102;
120 typedef decltype(pythonic::operator_::add(std::declval<__type85>(), std::declval<__type102>())) __type103;
121 typedef decltype(std::declval<__type12>()(std::declval<__type103>())) __type104;
122 typedef typename pythonic::assignable<decltype(std::declval<__type12>()(std::declval<__type74>()))>::type __type106;
123 typedef decltype(pythonic::operator_::mul(std::declval<__type106>(), std::declval<__type58>())) __type108;
124 typedef decltype(pythonic::operator_::mul(std::declval<__type18>(), std::declval<__type74>())) __type110;
125 typedef typename pythonic::assignable<decltype(pythonic::operator_::mul(std::declval<__type110>(), std::declval<__type91>()))>::type __type112;
126 typedef decltype(pythonic::operator_::mul(std::declval<__type112>(), std::declval<__type50>())) __type114;
127 typedef decltype(pythonic::operator_::add(std::declval<__type108>(), std::declval<__type114>())) __type115;
128 typedef typename pythonic::assignable<decltype(std::declval<__type12>()(std::declval<__type91>()))>::type __type117;
129 typedef decltype(pythonic::operator_::mul(std::declval<__type117>(), std::declval<__type65>())) __type119;
130 typedef decltype(pythonic::operator_::add(std::declval<__type115>(), std::declval<__type119>())) __type120;
131 typedef decltype(pythonic::operator_::div(std::declval<__type104>(), std::declval<__type120>())) __type121;
132 typedef decltype(pythonic::operator_::mul(std::declval<__type74>(), std::declval<__type101>())) __type124;
133 typedef decltype(pythonic::operator_::mul(std::declval<__type91>(), std::declval<__type84>())) __type127;
134 typedef decltype(pythonic::operator_::sub(std::declval<__type124>(), std::declval<__type127>())) __type128;
135 typedef decltype(std::declval<__type12>()(std::declval<__type128>())) __type129;
136 typedef decltype(pythonic::operator_::mul(std::declval<__type106>(), std::declval<__type65>())) __type132;
137 typedef decltype(pythonic::operator_::sub(std::declval<__type132>(), std::declval<__type114>())) __type136;
138 typedef decltype(pythonic::operator_::mul(std::declval<__type117>(), std::declval<__type58>())) __type139;
139 typedef decltype(pythonic::operator_::add(std::declval<__type136>(), std::declval<__type139>())) __type140;
140 typedef decltype(pythonic::operator_::div(std::declval<__type129>(), std::declval<__type140>())) __type141;
141 typedef decltype(pythonic::operator_::add(std::declval<__type121>(), std::declval<__type141>())) __type142;
142 typedef decltype(pythonic::operator_::mul(std::declval<__type11>(), std::declval<__type142>())) __type143;
143 typedef container<typename std::remove_reference<__type143>::type> __type144;
144 typedef typename pythonic::returnable<typename __combined<__type10,__type144,__type9>::type>::type result_type;
145 }
146 ;
147 template <typename argument_type0 , typename argument_type1 , typename argument_type2 >
148 typename type<argument_type0, argument_type1, argument_type2>::result_type operator()(argument_type0&& x, argument_type1&& y, argument_type2&& freqs) const
149 ;
150 } ;
151 template <typename argument_type0 , typename argument_type1 , typename argument_type2 >
152 typename _lombscargle::type<argument_type0, argument_type1, argument_type2>::result_type _lombscargle::operator()(argument_type0&& x, argument_type1&& y, argument_type2&& freqs) const
153 {
154 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::empty_like{})>::type>::type __type0;
155 typedef typename std::remove_cv<typename std::remove_reference<argument_type2>::type>::type __type1;
156 typedef typename pythonic::assignable<decltype(std::declval<__type0>()(std::declval<__type1>()))>::type __type2;
157 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::builtins::functor::range{})>::type>::type __type3;
158 typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type1>())) __type5;
159 typedef typename std::tuple_element<0,typename std::remove_reference<__type5>::type>::type __type6;
160 typedef decltype(std::declval<__type3>()(std::declval<__type6>())) __type7;
161 typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type7>::type::iterator>::value_type>::type __type8;
162 typedef indexable<__type8> __type9;
163 typedef typename __combined<__type2,__type9>::type __type10;
164 typedef double __type11;
165 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::square{})>::type>::type __type12;
166 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::cos{})>::type>::type __type13;
167 typedef decltype(std::declval<__type1>()[std::declval<__type8>()]) __type16;
168 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::arctan2{})>::type>::type __type17;
169 typedef long __type18;
170 typedef typename pythonic::assignable<double>::type __type19;
171 typedef typename std::remove_cv<typename std::remove_reference<argument_type0>::type>::type __type20;
172 typedef typename pythonic::assignable<decltype(std::declval<__type0>()(std::declval<__type20>()))>::type __type21;
173 typedef decltype(pythonic::operator_::mul(std::declval<__type16>(), std::declval<__type20>())) __type26;
174 typedef decltype(std::declval<__type13>()(std::declval<__type26>())) __type27;
175 typedef typename __combined<__type21,__type27>::type __type28;
176 typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type20>())) __type30;
177 typedef typename std::tuple_element<0,typename std::remove_reference<__type30>::type>::type __type31;
178 typedef decltype(std::declval<__type3>()(std::declval<__type31>())) __type32;
179 typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type32>::type::iterator>::value_type>::type __type33;
180 typedef decltype(std::declval<__type28>()[std::declval<__type33>()]) __type34;
181 typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::sin{})>::type>::type __type37;
182 typedef decltype(std::declval<__type37>()(std::declval<__type26>())) __type43;
183 typedef typename __combined<__type21,__type43>::type __type44;
184 typedef decltype(std::declval<__type44>()[std::declval<__type33>()]) __type46;
185 typedef decltype(pythonic::operator_::mul(std::declval<__type34>(), std::declval<__type46>())) __type47;
186 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type47>())) __type48;
187 typedef typename __combined<__type19,__type48>::type __type49;
188 typedef typename __combined<__type49,__type47>::type __type50;
189 typedef decltype(pythonic::operator_::mul(std::declval<__type18>(), std::declval<__type50>())) __type51;
190 typedef decltype(std::declval<__type12>()(std::declval<__type34>())) __type55;
191 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type55>())) __type56;
192 typedef typename __combined<__type19,__type56>::type __type57;
193 typedef typename __combined<__type57,__type55>::type __type58;
194 typedef decltype(std::declval<__type12>()(std::declval<__type46>())) __type62;
195 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type62>())) __type63;
196 typedef typename __combined<__type19,__type63>::type __type64;
197 typedef typename __combined<__type64,__type62>::type __type65;
198 typedef decltype(pythonic::operator_::sub(std::declval<__type58>(), std::declval<__type65>())) __type66;
199 typedef decltype(std::declval<__type17>()(std::declval<__type51>(), std::declval<__type66>())) __type67;
200 typedef decltype(pythonic::operator_::mul(std::declval<__type18>(), std::declval<__type16>())) __type71;
201 typedef typename pythonic::assignable<decltype(pythonic::operator_::div(std::declval<__type67>(), std::declval<__type71>()))>::type __type72;
202 typedef decltype(pythonic::operator_::mul(std::declval<__type16>(), std::declval<__type72>())) __type73;
203 typedef typename pythonic::assignable<decltype(std::declval<__type13>()(std::declval<__type73>()))>::type __type74;
204 typedef typename std::remove_cv<typename std::remove_reference<argument_type1>::type>::type __type75;
205 typedef decltype(std::declval<__type75>()[std::declval<__type33>()]) __type77;
206 typedef decltype(pythonic::operator_::mul(std::declval<__type77>(), std::declval<__type34>())) __type81;
207 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type81>())) __type82;
208 typedef typename __combined<__type19,__type82>::type __type83;
209 typedef typename __combined<__type83,__type81>::type __type84;
210 typedef decltype(pythonic::operator_::mul(std::declval<__type74>(), std::declval<__type84>())) __type85;
211 typedef typename pythonic::assignable<decltype(std::declval<__type37>()(std::declval<__type73>()))>::type __type91;
212 typedef decltype(pythonic::operator_::mul(std::declval<__type77>(), std::declval<__type46>())) __type98;
213 typedef decltype(pythonic::operator_::add(std::declval<__type19>(), std::declval<__type98>())) __type99;
214 typedef typename __combined<__type19,__type99>::type __type100;
215 typedef typename __combined<__type100,__type98>::type __type101;
216 typedef decltype(pythonic::operator_::mul(std::declval<__type91>(), std::declval<__type101>())) __type102;
217 typedef decltype(pythonic::operator_::add(std::declval<__type85>(), std::declval<__type102>())) __type103;
218 typedef decltype(std::declval<__type12>()(std::declval<__type103>())) __type104;
219 typedef typename pythonic::assignable<decltype(std::declval<__type12>()(std::declval<__type74>()))>::type __type106;
220 typedef decltype(pythonic::operator_::mul(std::declval<__type106>(), std::declval<__type58>())) __type108;
221 typedef decltype(pythonic::operator_::mul(std::declval<__type18>(), std::declval<__type74>())) __type110;
222 typedef typename pythonic::assignable<decltype(pythonic::operator_::mul(std::declval<__type110>(), std::declval<__type91>()))>::type __type112;
223 typedef decltype(pythonic::operator_::mul(std::declval<__type112>(), std::declval<__type50>())) __type114;
224 typedef decltype(pythonic::operator_::add(std::declval<__type108>(), std::declval<__type114>())) __type115;
225 typedef typename pythonic::assignable<decltype(std::declval<__type12>()(std::declval<__type91>()))>::type __type117;
226 typedef decltype(pythonic::operator_::mul(std::declval<__type117>(), std::declval<__type65>())) __type119;
227 typedef decltype(pythonic::operator_::add(std::declval<__type115>(), std::declval<__type119>())) __type120;
228 typedef decltype(pythonic::operator_::div(std::declval<__type104>(), std::declval<__type120>())) __type121;
229 typedef decltype(pythonic::operator_::mul(std::declval<__type74>(), std::declval<__type101>())) __type124;
230 typedef decltype(pythonic::operator_::mul(std::declval<__type91>(), std::declval<__type84>())) __type127;
231 typedef decltype(pythonic::operator_::sub(std::declval<__type124>(), std::declval<__type127>())) __type128;
232 typedef decltype(std::declval<__type12>()(std::declval<__type128>())) __type129;
233 typedef decltype(pythonic::operator_::mul(std::declval<__type106>(), std::declval<__type65>())) __type132;
234 typedef decltype(pythonic::operator_::sub(std::declval<__type132>(), std::declval<__type114>())) __type136;
235 typedef decltype(pythonic::operator_::mul(std::declval<__type117>(), std::declval<__type58>())) __type139;
236 typedef decltype(pythonic::operator_::add(std::declval<__type136>(), std::declval<__type139>())) __type140;
237 typedef decltype(pythonic::operator_::div(std::declval<__type129>(), std::declval<__type140>())) __type141;
238 typedef decltype(pythonic::operator_::add(std::declval<__type121>(), std::declval<__type141>())) __type142;
239 typedef decltype(pythonic::operator_::mul(std::declval<__type11>(), std::declval<__type142>())) __type143;
240 typedef container<typename std::remove_reference<__type143>::type> __type144;
241 if (pythonic::operator_::ne(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, x), pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, y)))
242 {
243 throw pythonic::builtins::functor::ValueError{}(pythonic::types::str("Input arrays do not have the same size."));
244 }
245 typename pythonic::assignable<typename __combined<__type10,__type144,__type9>::type>::type pgram = pythonic::numpy::functor::empty_like{}(freqs);
246 typename pythonic::assignable<typename __combined<__type21,__type27>::type>::type c = pythonic::numpy::functor::empty_like{}(x);
247 typename pythonic::assignable<typename __combined<__type21,__type43>::type>::type s = pythonic::numpy::functor::empty_like{}(x);
248 {
249 long __target139669607991184 = std::get<0>(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, freqs));
250 for (long i=0L; i < __target139669607991184; i += 1L)
251 {
252 typename pythonic::assignable<typename __combined<__type83,__type81>::type>::type xc = 0.0;
253 typename pythonic::assignable<typename __combined<__type100,__type98>::type>::type xs = 0.0;
254 typename pythonic::assignable<typename __combined<__type57,__type55>::type>::type cc = 0.0;
255 typename pythonic::assignable<typename __combined<__type64,__type62>::type>::type ss = 0.0;
256 typename pythonic::assignable<typename __combined<__type49,__type47>::type>::type cs = 0.0;
257 c[pythonic::types::contiguous_slice(pythonic::builtins::None,pythonic::builtins::None)] = pythonic::numpy::functor::cos{}(pythonic::operator_::mul(freqs.fast(i), x));
258 s[pythonic::types::contiguous_slice(pythonic::builtins::None,pythonic::builtins::None)] = pythonic::numpy::functor::sin{}(pythonic::operator_::mul(freqs.fast(i), x));
259 {
260 long __target139669607995040 = std::get<0>(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, x));
261 for (long j=0L; j < __target139669607995040; j += 1L)
262 {
263 xc += pythonic::operator_::mul(y.fast(j), c.fast(j));
264 xs += pythonic::operator_::mul(y.fast(j), s.fast(j));
265 cc += pythonic::numpy::functor::square{}(c.fast(j));
266 ss += pythonic::numpy::functor::square{}(s.fast(j));
267 cs += pythonic::operator_::mul(c.fast(j), s.fast(j));
268 }
269 }
270 if (pythonic::operator_::eq(freqs.fast(i), 0L))
271 {
272 throw pythonic::builtins::functor::ZeroDivisionError{}();
273 }
274 typename pythonic::assignable_noescape<decltype(pythonic::operator_::div(pythonic::numpy::functor::arctan2{}(pythonic::operator_::mul(2L, cs), pythonic::operator_::sub(cc, ss)), pythonic::operator_::mul(2L, freqs.fast(i))))>::type tau = pythonic::operator_::div(pythonic::numpy::functor::arctan2{}(pythonic::operator_::mul(2L, cs), pythonic::operator_::sub(cc, ss)), pythonic::operator_::mul(2L, freqs.fast(i)));
275 typename pythonic::assignable_noescape<decltype(pythonic::numpy::functor::cos{}(pythonic::operator_::mul(freqs.fast(i), tau)))>::type c_tau = pythonic::numpy::functor::cos{}(pythonic::operator_::mul(freqs.fast(i), tau));
276 typename pythonic::assignable_noescape<decltype(pythonic::numpy::functor::sin{}(pythonic::operator_::mul(freqs.fast(i), tau)))>::type s_tau = pythonic::numpy::functor::sin{}(pythonic::operator_::mul(freqs.fast(i), tau));
277 typename pythonic::assignable_noescape<decltype(pythonic::numpy::functor::square{}(c_tau))>::type c_tau2 = pythonic::numpy::functor::square{}(c_tau);
278 typename pythonic::assignable_noescape<decltype(pythonic::numpy::functor::square{}(s_tau))>::type s_tau2 = pythonic::numpy::functor::square{}(s_tau);
279 typename pythonic::assignable_noescape<decltype(pythonic::operator_::mul(pythonic::operator_::mul(2L, c_tau), s_tau))>::type cs_tau = pythonic::operator_::mul(pythonic::operator_::mul(2L, c_tau), s_tau);
280 pgram.fast(i) = pythonic::operator_::mul(0.5, pythonic::operator_::add(pythonic::operator_::div(pythonic::numpy::functor::square{}(pythonic::operator_::add(pythonic::operator_::mul(c_tau, xc), pythonic::operator_::mul(s_tau, xs))), pythonic::operator_::add(pythonic::operator_::add(pythonic::operator_::mul(c_tau2, cc), pythonic::operator_::mul(cs_tau, cs)), pythonic::operator_::mul(s_tau2, ss))), pythonic::operator_::div(pythonic::numpy::functor::square{}(pythonic::operator_::sub(pythonic::operator_::mul(c_tau, xs), pythonic::operator_::mul(s_tau, xc))), pythonic::operator_::add(pythonic::operator_::sub(pythonic::operator_::mul(c_tau2, ss), pythonic::operator_::mul(cs_tau, cs)), pythonic::operator_::mul(s_tau2, cc)))));
281 }
282 }
283 return pgram;
284 }
285}
286#include <pythonic/python/exception_handler.hpp>
287#ifdef ENABLE_PYTHON_MODULE1
288typename __pythran__spectral::_lombscargle::type<pythonic::types::ndarray<double,pythonic::types::pshape<long>>, pythonic::types::ndarray<double,pythonic::types::pshape<long>>, pythonic::types::ndarray<double,pythonic::types::pshape<long>>>::result_type _lombscargle0(pythonic::types::ndarray<double,pythonic::types::pshape<long>>&& x, pythonic::types::ndarray<double,pythonic::types::pshape<long>>&& y, pythonic::types::ndarray<double,pythonic::types::pshape<long>>&& freqs)
289{
290
291 PyThreadState *_save = PyEval_SaveThread();
292 try {
293 auto res = __pythran__spectral::_lombscargle()(x, y, freqs);
294 PyEval_RestoreThread(_save);
295 return res;
296 }
297 catch(...) {
298 PyEval_RestoreThread(_save);
299 throw;
300 }
301 ;
302}
303
304static PyObject *
305__pythran_wrap__lombscargle0(PyObject *self, PyObject *args, PyObject *kw)
306{
307 PyObject* args_obj[3+1];
308
309 char const* keywords[] = {"x", "y", "freqs", nullptr};
310 if(! PyArg_ParseTupleAndKeywords(args, kw, "OOO",
311 (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2]))
312 return nullptr;
313 if(is_convertible<pythonic::types::ndarray<double,pythonic::types::pshape<long>>>(args_obj[0]) && is_convertible<pythonic::types::ndarray<double,pythonic::types::pshape<long>>>(args_obj[1]) && is_convertible<pythonic::types::ndarray<double,pythonic::types::pshape<long>>>(args_obj[2]))
314 return to_python(_lombscargle0(from_python<pythonic::types::ndarray<double,pythonic::types::pshape<long>>>(args_obj[0]), from_python<pythonic::types::ndarray<double,pythonic::types::pshape<long>>>(args_obj[1]), from_python<pythonic::types::ndarray<double,pythonic::types::pshape<long>>>(args_obj[2])));
315 else {
316 return nullptr;
317 }
318}
319
320 static PyObject *
321 __pythran_wrapall__lombscargle(PyObject *self, PyObject *args, PyObject *kw)
322 {
323 return pythonic::handle_python_exception([self, args, kw]()
324 -> PyObject* {
325
326if(PyObject* obj = __pythran_wrap__lombscargle0(self, args, kw))
327 return obj;
328PyErr_Clear();
329
330 return pythonic::python::raise_invalid_argument(
331 "_lombscargle", "\n"" - _lombscargle(float64[:], float64[:], float64[:])", args, kw);
332 });
333 }
334
335
336static PyMethodDef Methods[] = {
337 {
338 "_lombscargle",
339 (PyCFunction)__pythran_wrapall__lombscargle,
340 METH_VARARGS0x0001 | METH_KEYWORDS0x0002,
341 "\n""_lombscargle(x, y, freqs)\n""\n""Supported prototypes:\n""\n""- _lombscargle(float64[:], float64[:], float64[:])\n""\n""Computes the Lomb-Scargle periodogram.\n""\n""Parameters\n""----------\n""x : array_like\n"" Sample times.\n""y : array_like\n"" Measurement values (must be registered so the mean is zero).\n""freqs : array_like\n"" Angular frequencies for output periodogram.\n""\n""Returns\n""-------\n""pgram : array_like\n"" Lomb-Scargle periodogram.\n""\n""Raises\n""------\n""ValueError\n"" If the input arrays `x` and `y` do not have the same shape.\n""\n""See also\n""--------\n""lombscargle\n""\n"""},
342 {NULL__null, NULL__null, 0, NULL__null}
343};
344
345
346#if PY_MAJOR_VERSION3 >= 3
347 static struct PyModuleDef moduledef = {
348 PyModuleDef_HEAD_INIT{ { 1, __null }, __null, 0, __null, },
349 "_spectral", /* m_name */
350 "Tools for spectral analysis of unequally sampled signals.", /* m_doc */
351 -1, /* m_size */
352 Methods, /* m_methods */
353 NULL__null, /* m_reload */
354 NULL__null, /* m_traverse */
355 NULL__null, /* m_clear */
356 NULL__null, /* m_free */
357 };
358#define PYTHRAN_RETURNreturn theModule return theModule
359#define PYTHRAN_MODULE_INIT(s)PyInit_s PyInit_##s
360#else
361#define PYTHRAN_RETURNreturn theModule return
362#define PYTHRAN_MODULE_INIT(s)PyInit_s init##s
363#endif
364PyMODINIT_FUNCextern "C" PyObject*
365PYTHRAN_MODULE_INIT(_spectral)PyInit__spectral(void)
366#ifndef _WIN32
367__attribute__ ((visibility("default")))
368#if defined(GNUC) && !defined(__clang__1)
369__attribute__ ((externally_visible))
370#endif
371#endif
372;
373PyMODINIT_FUNCextern "C" PyObject*
374PYTHRAN_MODULE_INIT(_spectral)PyInit__spectral(void) {
375 import_array(){if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(
PyExc_ImportError, "numpy.core.multiarray failed to import");
return __null; } }
1
Taking false branch
376 #if PY_MAJOR_VERSION3 >= 3
377 PyObject* theModule = PyModule_Create(&moduledef)PyModule_Create2(&moduledef, 1013);
378 #else
379 PyObject* theModule = Py_InitModule3("_spectral",
380 Methods,
381 "Tools for spectral analysis of unequally sampled signals."
382 );
383 #endif
384 if(! theModule)
2
Assuming 'theModule' is non-null
3
Taking false branch
385 PYTHRAN_RETURNreturn theModule;
386 PyObject * theDoc = Py_BuildValue("(sss)",
4
Calling 'Py_BuildValue'
6
Returning from 'Py_BuildValue'
9
PyObject ownership leak with reference count of 1
387 "0.9.12",
388 "2021-07-14 11:02:33.631161",
389 "b56cff7c57981a37e4a502cd99394a47b45590ea94b06fe3923cf38ac2cdffd3");
390 if(! theDoc)
7
Assuming 'theDoc' is non-null
8
Taking false branch
391 PYTHRAN_RETURNreturn theModule;
392 PyModule_AddObject(theModule,
393 "__pythran__",
394 theDoc);
395
396
397 PYTHRAN_RETURNreturn theModule;
398}
399
400#endif

/opt/pyrefcon/lib/pyrefcon/models/models/Py_BuildValue.model

1#ifndef Py_BuildValue
2struct _object;
3typedef struct _object PyObject;
4PyObject* clang_analyzer_PyObject_New_Reference();
5PyObject* Py_BuildValue(const char *format, ...) {
6 return clang_analyzer_PyObject_New_Reference();
5
Setting reference count to 1
7}
8#else
9#warning "API Py_BuildValue is defined as a macro."
10#endif