Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
df810151
Unverified
Kaydet (Commit)
df810151
authored
Eyl 29, 2018
tarafından
Raymond Hettinger
Kaydeden (comit)
GitHub
Eyl 29, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Speed-up math.dist() by 30% (GH-9628)
üst
e45473e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
mathmodule.c.h
Modules/clinic/mathmodule.c.h
+4
-3
mathmodule.c
Modules/mathmodule.c
+8
-3
No files found.
Modules/clinic/mathmodule.c.h
Dosyayı görüntüle @
df810151
...
@@ -294,8 +294,9 @@ math_dist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
...
@@ -294,8 +294,9 @@ math_dist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject
*
p
;
PyObject
*
p
;
PyObject
*
q
;
PyObject
*
q
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"O!O!:dist"
,
if
(
!
_PyArg_UnpackStack
(
args
,
nargs
,
"dist"
,
&
PyTuple_Type
,
&
p
,
&
PyTuple_Type
,
&
q
))
{
2
,
2
,
&
p
,
&
q
))
{
goto
exit
;
goto
exit
;
}
}
return_value
=
math_dist_impl
(
module
,
p
,
q
);
return_value
=
math_dist_impl
(
module
,
p
,
q
);
...
@@ -522,4 +523,4 @@ math_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
...
@@ -522,4 +523,4 @@ math_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
exit:
exit:
return
return_value
;
return
return_value
;
}
}
/*[clinic end generated code: output=
d936137c1189b89
b input=a9049054013a1b77]*/
/*[clinic end generated code: output=
239c51a5acefbaf
b input=a9049054013a1b77]*/
Modules/mathmodule.c
Dosyayı görüntüle @
df810151
...
@@ -2101,8 +2101,8 @@ vector_norm(Py_ssize_t n, double *vec, double max, int found_nan)
...
@@ -2101,8 +2101,8 @@ vector_norm(Py_ssize_t n, double *vec, double max, int found_nan)
/*[clinic input]
/*[clinic input]
math.dist
math.dist
p: object
(subclass_of='&PyTuple_Type')
p: object
q: object
(subclass_of='&PyTuple_Type')
q: object
/
/
Return the Euclidean distance between two points p and q.
Return the Euclidean distance between two points p and q.
...
@@ -2116,7 +2116,7 @@ Roughly equivalent to:
...
@@ -2116,7 +2116,7 @@ Roughly equivalent to:
static
PyObject
*
static
PyObject
*
math_dist_impl
(
PyObject
*
module
,
PyObject
*
p
,
PyObject
*
q
)
math_dist_impl
(
PyObject
*
module
,
PyObject
*
p
,
PyObject
*
q
)
/*[clinic end generated code: output=56bd9538d06bbcfe input=
937122eaa5f19272
]*/
/*[clinic end generated code: output=56bd9538d06bbcfe input=
8c83c07c7a524664
]*/
{
{
PyObject
*
item
;
PyObject
*
item
;
double
max
=
0
.
0
;
double
max
=
0
.
0
;
...
@@ -2126,6 +2126,11 @@ math_dist_impl(PyObject *module, PyObject *p, PyObject *q)
...
@@ -2126,6 +2126,11 @@ math_dist_impl(PyObject *module, PyObject *p, PyObject *q)
double
diffs_on_stack
[
NUM_STACK_ELEMS
];
double
diffs_on_stack
[
NUM_STACK_ELEMS
];
double
*
diffs
=
diffs_on_stack
;
double
*
diffs
=
diffs_on_stack
;
if
(
!
PyTuple_Check
(
p
)
||
!
PyTuple_Check
(
q
))
{
PyErr_SetString
(
PyExc_TypeError
,
"dist argument must be a tuple"
);
return
NULL
;
}
m
=
PyTuple_GET_SIZE
(
p
);
m
=
PyTuple_GET_SIZE
(
p
);
n
=
PyTuple_GET_SIZE
(
q
);
n
=
PyTuple_GET_SIZE
(
q
);
if
(
m
!=
n
)
{
if
(
m
!=
n
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment