Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2xla/ops/_xla_ops.so +3 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/allocator_traits.h +442 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/allocator_traits.inl +465 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/default_construct_range.inl +112 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/destroy_range.h +33 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/fill_construct_range.inl +114 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/malloc_allocator.h +51 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/malloc_allocator.inl +65 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/tagged_allocator.h +100 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/temporary_allocator.h +84 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/temporary_allocator.inl +79 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/arithmetic.h +303 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/c99math.h +197 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/catrig.h +785 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/catrigf.h +500 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ccosh.h +215 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ccoshf.h +143 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cexp.h +185 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cexpf.h +163 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/clog.h +214 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/clogf.h +200 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/complex.inl +355 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cpow.h +57 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cproj.h +72 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csinh.h +207 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csinhf.h +144 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csqrt.h +154 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csqrtf.h +149 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ctanh.h +202 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ctanhf.h +126 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/math_private.h +136 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/stream.h +74 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/config/debug.h +32 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/actor.h +155 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/actor.inl +114 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/argument.h +74 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/composite.h +164 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/operators.h +25 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/operators/operator_adaptors.h +136 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/placeholder.h +38 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/value.h +79 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/range/tail_flags.h +133 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/function_traits.h +97 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/has_member_function.h +38 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/has_nested_type.h +32 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/has_trivial_assign.h +47 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/is_call_possible.h +162 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/is_metafunction_defined.h +42 -0
- videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/iterator/is_discard_iterator.h +39 -0
.gitattributes
CHANGED
|
@@ -904,3 +904,4 @@ videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/te
|
|
| 904 |
videochat2/lib/python3.10/site-packages/torchvision/_C.so filter=lfs diff=lfs merge=lfs -text
|
| 905 |
videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/calibrator/pywrap_calibration.so filter=lfs diff=lfs merge=lfs -text
|
| 906 |
videochat2/lib/python3.10/site-packages/tensorflow/python/client/_pywrap_tf_session.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 904 |
videochat2/lib/python3.10/site-packages/torchvision/_C.so filter=lfs diff=lfs merge=lfs -text
|
| 905 |
videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/calibrator/pywrap_calibration.so filter=lfs diff=lfs merge=lfs -text
|
| 906 |
videochat2/lib/python3.10/site-packages/tensorflow/python/client/_pywrap_tf_session.so filter=lfs diff=lfs merge=lfs -text
|
| 907 |
+
videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2xla/ops/_xla_ops.so filter=lfs diff=lfs merge=lfs -text
|
videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2xla/ops/_xla_ops.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:225af281d50a20ab01b3f624b201aa546c33b4f653d62fcf3d7dce7e1f300fe2
|
| 3 |
+
size 1264016
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/allocator_traits.h
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2018 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
// allocator_traits::rebind_alloc and allocator::rebind_traits are from libc++,
|
| 18 |
+
// dual licensed under the MIT and the University of Illinois Open Source
|
| 19 |
+
// Licenses.
|
| 20 |
+
|
| 21 |
+
#pragma once
|
| 22 |
+
|
| 23 |
+
#include <thrust/detail/config.h>
|
| 24 |
+
#include <thrust/detail/type_traits/pointer_traits.h>
|
| 25 |
+
#include <thrust/detail/type_traits/has_nested_type.h>
|
| 26 |
+
#include <thrust/detail/type_traits/has_member_function.h>
|
| 27 |
+
#include <thrust/detail/type_traits.h>
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/memory_wrapper.h>
|
| 30 |
+
|
| 31 |
+
THRUST_NAMESPACE_BEGIN
|
| 32 |
+
namespace detail
|
| 33 |
+
{
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
// forward declaration for has_member_system
|
| 37 |
+
template<typename Alloc> struct allocator_system;
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
namespace allocator_traits_detail
|
| 41 |
+
{
|
| 42 |
+
|
| 43 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_value_type, value_type)
|
| 44 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_pointer, pointer)
|
| 45 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_const_pointer, const_pointer)
|
| 46 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_reference, reference)
|
| 47 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_const_reference, const_reference)
|
| 48 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_void_pointer, void_pointer)
|
| 49 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_const_void_pointer, const_void_pointer)
|
| 50 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_difference_type, difference_type)
|
| 51 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_size_type, size_type)
|
| 52 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_propagate_on_container_copy_assignment, propagate_on_container_copy_assignment)
|
| 53 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_propagate_on_container_move_assignment, propagate_on_container_move_assignment)
|
| 54 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_propagate_on_container_swap, propagate_on_container_swap)
|
| 55 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_system_type, system_type)
|
| 56 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_is_always_equal, is_always_equal)
|
| 57 |
+
__THRUST_DEFINE_HAS_MEMBER_FUNCTION(has_member_system_impl, system)
|
| 58 |
+
|
| 59 |
+
template<typename Alloc, typename U>
|
| 60 |
+
struct has_rebind
|
| 61 |
+
{
|
| 62 |
+
typedef char yes_type;
|
| 63 |
+
typedef int no_type;
|
| 64 |
+
|
| 65 |
+
template<typename S>
|
| 66 |
+
static yes_type test(typename S::template rebind<U>::other*);
|
| 67 |
+
template<typename S>
|
| 68 |
+
static no_type test(...);
|
| 69 |
+
|
| 70 |
+
static bool const value = sizeof(test<U>(0)) == sizeof(yes_type);
|
| 71 |
+
|
| 72 |
+
typedef thrust::detail::integral_constant<bool, value> type;
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
// The following fields of std::allocator have been deprecated (since C++17).
|
| 76 |
+
// There's no way to detect it other than explicit specialization.
|
| 77 |
+
#if THRUST_CPP_DIALECT >= 2017
|
| 78 |
+
#define THRUST_SPECIALIZE_DEPRECATED(trait_name) \
|
| 79 |
+
template <typename T> \
|
| 80 |
+
struct trait_name<std::allocator<T>> : false_type {};
|
| 81 |
+
|
| 82 |
+
THRUST_SPECIALIZE_DEPRECATED(has_is_always_equal)
|
| 83 |
+
THRUST_SPECIALIZE_DEPRECATED(has_pointer)
|
| 84 |
+
THRUST_SPECIALIZE_DEPRECATED(has_const_pointer)
|
| 85 |
+
THRUST_SPECIALIZE_DEPRECATED(has_reference)
|
| 86 |
+
THRUST_SPECIALIZE_DEPRECATED(has_const_reference)
|
| 87 |
+
|
| 88 |
+
#undef THRUST_SPECIALIZE_DEPRECATED
|
| 89 |
+
|
| 90 |
+
template<typename T, typename U>
|
| 91 |
+
struct has_rebind<std::allocator<T>, U> : false_type {};
|
| 92 |
+
#endif
|
| 93 |
+
|
| 94 |
+
template<typename T>
|
| 95 |
+
struct nested_pointer
|
| 96 |
+
{
|
| 97 |
+
typedef typename T::pointer type;
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
template<typename T>
|
| 101 |
+
struct nested_const_pointer
|
| 102 |
+
{
|
| 103 |
+
typedef typename T::const_pointer type;
|
| 104 |
+
};
|
| 105 |
+
|
| 106 |
+
template<typename T>
|
| 107 |
+
struct nested_reference
|
| 108 |
+
{
|
| 109 |
+
typedef typename T::reference type;
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
template<typename T>
|
| 113 |
+
struct nested_const_reference
|
| 114 |
+
{
|
| 115 |
+
typedef typename T::const_reference type;
|
| 116 |
+
};
|
| 117 |
+
|
| 118 |
+
template<typename T>
|
| 119 |
+
struct nested_void_pointer
|
| 120 |
+
{
|
| 121 |
+
typedef typename T::void_pointer type;
|
| 122 |
+
};
|
| 123 |
+
|
| 124 |
+
template<typename T>
|
| 125 |
+
struct nested_const_void_pointer
|
| 126 |
+
{
|
| 127 |
+
typedef typename T::const_void_pointer type;
|
| 128 |
+
};
|
| 129 |
+
|
| 130 |
+
template<typename T>
|
| 131 |
+
struct nested_difference_type
|
| 132 |
+
{
|
| 133 |
+
typedef typename T::difference_type type;
|
| 134 |
+
};
|
| 135 |
+
|
| 136 |
+
template<typename T>
|
| 137 |
+
struct nested_size_type
|
| 138 |
+
{
|
| 139 |
+
typedef typename T::size_type type;
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
template<typename T>
|
| 143 |
+
struct nested_propagate_on_container_copy_assignment
|
| 144 |
+
{
|
| 145 |
+
typedef typename T::propagate_on_container_copy_assignment type;
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
template<typename T>
|
| 149 |
+
struct nested_propagate_on_container_move_assignment
|
| 150 |
+
{
|
| 151 |
+
typedef typename T::propagate_on_container_move_assignment type;
|
| 152 |
+
};
|
| 153 |
+
|
| 154 |
+
template<typename T>
|
| 155 |
+
struct nested_propagate_on_container_swap
|
| 156 |
+
{
|
| 157 |
+
typedef typename T::propagate_on_container_swap type;
|
| 158 |
+
};
|
| 159 |
+
|
| 160 |
+
template<typename T>
|
| 161 |
+
struct nested_is_always_equal
|
| 162 |
+
{
|
| 163 |
+
typedef typename T::is_always_equal type;
|
| 164 |
+
};
|
| 165 |
+
|
| 166 |
+
template<typename T>
|
| 167 |
+
struct nested_system_type
|
| 168 |
+
{
|
| 169 |
+
typedef typename T::system_type type;
|
| 170 |
+
};
|
| 171 |
+
|
| 172 |
+
template<typename Alloc>
|
| 173 |
+
struct has_member_system
|
| 174 |
+
{
|
| 175 |
+
typedef typename allocator_system<Alloc>::type system_type;
|
| 176 |
+
|
| 177 |
+
typedef typename has_member_system_impl<Alloc, system_type&(void)>::type type;
|
| 178 |
+
static const bool value = type::value;
|
| 179 |
+
};
|
| 180 |
+
|
| 181 |
+
template<class Alloc, class U, bool = has_rebind<Alloc, U>::value>
|
| 182 |
+
struct rebind_alloc
|
| 183 |
+
{
|
| 184 |
+
typedef typename Alloc::template rebind<U>::other type;
|
| 185 |
+
};
|
| 186 |
+
|
| 187 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 188 |
+
template<template<typename, typename...> class Alloc,
|
| 189 |
+
typename T, typename... Args, typename U>
|
| 190 |
+
struct rebind_alloc<Alloc<T, Args...>, U, true>
|
| 191 |
+
{
|
| 192 |
+
typedef typename Alloc<T, Args...>::template rebind<U>::other type;
|
| 193 |
+
};
|
| 194 |
+
|
| 195 |
+
template<template<typename, typename...> class Alloc,
|
| 196 |
+
typename T, typename... Args, typename U>
|
| 197 |
+
struct rebind_alloc<Alloc<T, Args...>, U, false>
|
| 198 |
+
{
|
| 199 |
+
typedef Alloc<U, Args...> type;
|
| 200 |
+
};
|
| 201 |
+
#else // C++03
|
| 202 |
+
template <template <typename> class Alloc, typename T, typename U>
|
| 203 |
+
struct rebind_alloc<Alloc<T>, U, true>
|
| 204 |
+
{
|
| 205 |
+
typedef typename Alloc<T>::template rebind<U>::other type;
|
| 206 |
+
};
|
| 207 |
+
|
| 208 |
+
template <template <typename> class Alloc, typename T, typename U>
|
| 209 |
+
struct rebind_alloc<Alloc<T>, U, false>
|
| 210 |
+
{
|
| 211 |
+
typedef Alloc<U> type;
|
| 212 |
+
};
|
| 213 |
+
|
| 214 |
+
template<template<typename, typename> class Alloc,
|
| 215 |
+
typename T, typename A0, typename U>
|
| 216 |
+
struct rebind_alloc<Alloc<T, A0>, U, true>
|
| 217 |
+
{
|
| 218 |
+
typedef typename Alloc<T, A0>::template rebind<U>::other type;
|
| 219 |
+
};
|
| 220 |
+
|
| 221 |
+
template<template<typename, typename> class Alloc,
|
| 222 |
+
typename T, typename A0, typename U>
|
| 223 |
+
struct rebind_alloc<Alloc<T, A0>, U, false>
|
| 224 |
+
{
|
| 225 |
+
typedef Alloc<U, A0> type;
|
| 226 |
+
};
|
| 227 |
+
|
| 228 |
+
template<template<typename, typename, typename> class Alloc,
|
| 229 |
+
typename T, typename A0, typename A1, typename U>
|
| 230 |
+
struct rebind_alloc<Alloc<T, A0, A1>, U, true>
|
| 231 |
+
{
|
| 232 |
+
typedef typename Alloc<T, A0, A1>::template rebind<U>::other type;
|
| 233 |
+
};
|
| 234 |
+
|
| 235 |
+
template<template<typename, typename, typename> class Alloc,
|
| 236 |
+
typename T, typename A0, typename A1, typename U>
|
| 237 |
+
struct rebind_alloc<Alloc<T, A0, A1>, U, false>
|
| 238 |
+
{
|
| 239 |
+
typedef Alloc<U, A0, A1> type;
|
| 240 |
+
};
|
| 241 |
+
|
| 242 |
+
template<template<typename, typename, typename, typename> class Alloc,
|
| 243 |
+
typename T, typename A0, typename A1, typename A2, typename U>
|
| 244 |
+
struct rebind_alloc<Alloc<T, A0, A1, A2>, U, true>
|
| 245 |
+
{
|
| 246 |
+
typedef typename Alloc<T, A0, A1, A2>::template rebind<U>::other type;
|
| 247 |
+
};
|
| 248 |
+
|
| 249 |
+
template<template<typename, typename, typename, typename> class Alloc,
|
| 250 |
+
typename T, typename A0, typename A1, typename A2, typename U>
|
| 251 |
+
struct rebind_alloc<Alloc<T, A0, A1, A2>, U, false>
|
| 252 |
+
{
|
| 253 |
+
typedef Alloc<U, A0, A1, A2> type;
|
| 254 |
+
};
|
| 255 |
+
#endif
|
| 256 |
+
|
| 257 |
+
} // end allocator_traits_detail
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
template<typename Alloc>
|
| 261 |
+
struct allocator_traits
|
| 262 |
+
{
|
| 263 |
+
typedef Alloc allocator_type;
|
| 264 |
+
|
| 265 |
+
typedef typename allocator_type::value_type value_type;
|
| 266 |
+
|
| 267 |
+
typedef typename eval_if<
|
| 268 |
+
allocator_traits_detail::has_pointer<allocator_type>::value,
|
| 269 |
+
allocator_traits_detail::nested_pointer<allocator_type>,
|
| 270 |
+
identity_<value_type*>
|
| 271 |
+
>::type pointer;
|
| 272 |
+
|
| 273 |
+
private:
|
| 274 |
+
template<typename T>
|
| 275 |
+
struct rebind_pointer
|
| 276 |
+
{
|
| 277 |
+
typedef typename pointer_traits<pointer>::template rebind<T>::other type;
|
| 278 |
+
};
|
| 279 |
+
|
| 280 |
+
public:
|
| 281 |
+
|
| 282 |
+
typedef typename eval_if<
|
| 283 |
+
allocator_traits_detail::has_const_pointer<allocator_type>::value,
|
| 284 |
+
allocator_traits_detail::nested_const_pointer<allocator_type>,
|
| 285 |
+
rebind_pointer<const value_type>
|
| 286 |
+
>::type const_pointer;
|
| 287 |
+
|
| 288 |
+
typedef typename eval_if<
|
| 289 |
+
allocator_traits_detail::has_void_pointer<allocator_type>::value,
|
| 290 |
+
allocator_traits_detail::nested_void_pointer<allocator_type>,
|
| 291 |
+
rebind_pointer<void>
|
| 292 |
+
>::type void_pointer;
|
| 293 |
+
|
| 294 |
+
typedef typename eval_if<
|
| 295 |
+
allocator_traits_detail::has_const_void_pointer<allocator_type>::value,
|
| 296 |
+
allocator_traits_detail::nested_const_void_pointer<allocator_type>,
|
| 297 |
+
rebind_pointer<const void>
|
| 298 |
+
>::type const_void_pointer;
|
| 299 |
+
|
| 300 |
+
typedef typename eval_if<
|
| 301 |
+
allocator_traits_detail::has_difference_type<allocator_type>::value,
|
| 302 |
+
allocator_traits_detail::nested_difference_type<allocator_type>,
|
| 303 |
+
pointer_difference<pointer>
|
| 304 |
+
>::type difference_type;
|
| 305 |
+
|
| 306 |
+
typedef typename eval_if<
|
| 307 |
+
allocator_traits_detail::has_size_type<allocator_type>::value,
|
| 308 |
+
allocator_traits_detail::nested_size_type<allocator_type>,
|
| 309 |
+
make_unsigned<difference_type>
|
| 310 |
+
>::type size_type;
|
| 311 |
+
|
| 312 |
+
typedef typename eval_if<
|
| 313 |
+
allocator_traits_detail::has_propagate_on_container_copy_assignment<allocator_type>::value,
|
| 314 |
+
allocator_traits_detail::nested_propagate_on_container_copy_assignment<allocator_type>,
|
| 315 |
+
identity_<false_type>
|
| 316 |
+
>::type propagate_on_container_copy_assignment;
|
| 317 |
+
|
| 318 |
+
typedef typename eval_if<
|
| 319 |
+
allocator_traits_detail::has_propagate_on_container_move_assignment<allocator_type>::value,
|
| 320 |
+
allocator_traits_detail::nested_propagate_on_container_move_assignment<allocator_type>,
|
| 321 |
+
identity_<false_type>
|
| 322 |
+
>::type propagate_on_container_move_assignment;
|
| 323 |
+
|
| 324 |
+
typedef typename eval_if<
|
| 325 |
+
allocator_traits_detail::has_propagate_on_container_swap<allocator_type>::value,
|
| 326 |
+
allocator_traits_detail::nested_propagate_on_container_swap<allocator_type>,
|
| 327 |
+
identity_<false_type>
|
| 328 |
+
>::type propagate_on_container_swap;
|
| 329 |
+
|
| 330 |
+
typedef typename eval_if<
|
| 331 |
+
allocator_traits_detail::has_is_always_equal<allocator_type>::value,
|
| 332 |
+
allocator_traits_detail::nested_is_always_equal<allocator_type>,
|
| 333 |
+
is_empty<allocator_type>
|
| 334 |
+
>::type is_always_equal;
|
| 335 |
+
|
| 336 |
+
typedef typename eval_if<
|
| 337 |
+
allocator_traits_detail::has_system_type<allocator_type>::value,
|
| 338 |
+
allocator_traits_detail::nested_system_type<allocator_type>,
|
| 339 |
+
thrust::iterator_system<pointer>
|
| 340 |
+
>::type system_type;
|
| 341 |
+
|
| 342 |
+
// XXX rebind and rebind_traits are alias templates
|
| 343 |
+
// and so are omitted while c++11 is unavailable
|
| 344 |
+
|
| 345 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 346 |
+
template <typename U>
|
| 347 |
+
using rebind_alloc =
|
| 348 |
+
typename allocator_traits_detail::rebind_alloc<allocator_type, U>::type;
|
| 349 |
+
|
| 350 |
+
template <typename U>
|
| 351 |
+
using rebind_traits = allocator_traits<rebind_alloc<U>>;
|
| 352 |
+
|
| 353 |
+
// We define this nested type alias for compatibility with the C++03-style
|
| 354 |
+
// rebind_* mechanisms.
|
| 355 |
+
using other = allocator_traits;
|
| 356 |
+
#else
|
| 357 |
+
template <typename U>
|
| 358 |
+
struct rebind_alloc
|
| 359 |
+
{
|
| 360 |
+
typedef typename
|
| 361 |
+
allocator_traits_detail::rebind_alloc<allocator_type, U>::type other;
|
| 362 |
+
};
|
| 363 |
+
template <typename U>
|
| 364 |
+
struct rebind_traits
|
| 365 |
+
{
|
| 366 |
+
typedef allocator_traits<typename rebind_alloc<U>::other> other;
|
| 367 |
+
};
|
| 368 |
+
#endif
|
| 369 |
+
|
| 370 |
+
// Deprecated std::allocator typedefs that we need:
|
| 371 |
+
typedef typename thrust::detail::pointer_traits<pointer>::reference reference;
|
| 372 |
+
typedef typename thrust::detail::pointer_traits<const_pointer>::reference const_reference;
|
| 373 |
+
|
| 374 |
+
inline __host__ __device__
|
| 375 |
+
static pointer allocate(allocator_type &a, size_type n);
|
| 376 |
+
|
| 377 |
+
inline __host__ __device__
|
| 378 |
+
static pointer allocate(allocator_type &a, size_type n, const_void_pointer hint);
|
| 379 |
+
|
| 380 |
+
inline __host__ __device__
|
| 381 |
+
static void deallocate(allocator_type &a, pointer p, size_type n);
|
| 382 |
+
|
| 383 |
+
// XXX should probably change T* to pointer below and then relax later
|
| 384 |
+
|
| 385 |
+
template<typename T>
|
| 386 |
+
inline __host__ __device__ static void construct(allocator_type &a, T *p);
|
| 387 |
+
|
| 388 |
+
template<typename T, typename Arg1>
|
| 389 |
+
inline __host__ __device__ static void construct(allocator_type &a, T *p, const Arg1 &arg1);
|
| 390 |
+
|
| 391 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 392 |
+
template<typename T, typename... Args>
|
| 393 |
+
inline __host__ __device__ static void construct(allocator_type &a, T *p, Args&&... args);
|
| 394 |
+
#endif
|
| 395 |
+
|
| 396 |
+
template<typename T>
|
| 397 |
+
inline __host__ __device__ static void destroy(allocator_type &a, T *p);
|
| 398 |
+
|
| 399 |
+
inline __host__ __device__
|
| 400 |
+
static size_type max_size(const allocator_type &a);
|
| 401 |
+
}; // end allocator_traits
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
// we consider a type an allocator if T::value_type exists
|
| 405 |
+
// it doesn't make much sense (containers, which are not allocators, will fulfill this requirement),
|
| 406 |
+
// but allocator_traits is specified to work for any type with that nested typedef
|
| 407 |
+
template<typename T>
|
| 408 |
+
struct is_allocator
|
| 409 |
+
: allocator_traits_detail::has_value_type<T>
|
| 410 |
+
{};
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
// XXX consider moving this non-standard functionality inside allocator_traits
|
| 414 |
+
template<typename Alloc>
|
| 415 |
+
struct allocator_system
|
| 416 |
+
{
|
| 417 |
+
// the type of the allocator's system
|
| 418 |
+
typedef typename eval_if<
|
| 419 |
+
allocator_traits_detail::has_system_type<Alloc>::value,
|
| 420 |
+
allocator_traits_detail::nested_system_type<Alloc>,
|
| 421 |
+
thrust::iterator_system<
|
| 422 |
+
typename allocator_traits<Alloc>::pointer
|
| 423 |
+
>
|
| 424 |
+
>::type type;
|
| 425 |
+
|
| 426 |
+
// the type that get returns
|
| 427 |
+
typedef typename eval_if<
|
| 428 |
+
allocator_traits_detail::has_member_system<Alloc>::value, // if Alloc.system() exists
|
| 429 |
+
add_reference<type>, // then get() needs to return a reference
|
| 430 |
+
identity_<type> // else get() needs to return a value
|
| 431 |
+
>::type get_result_type;
|
| 432 |
+
|
| 433 |
+
__host__ __device__
|
| 434 |
+
inline static get_result_type get(Alloc &a);
|
| 435 |
+
};
|
| 436 |
+
|
| 437 |
+
|
| 438 |
+
} // end detail
|
| 439 |
+
THRUST_NAMESPACE_END
|
| 440 |
+
|
| 441 |
+
#include <thrust/detail/allocator/allocator_traits.inl>
|
| 442 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/allocator_traits.inl
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2018 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/allocator/allocator_traits.h>
|
| 21 |
+
#include <thrust/detail/type_traits/is_call_possible.h>
|
| 22 |
+
#include <thrust/detail/integer_traits.h>
|
| 23 |
+
|
| 24 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 25 |
+
#include <thrust/detail/type_deduction.h>
|
| 26 |
+
#endif
|
| 27 |
+
|
| 28 |
+
#include <thrust/detail/memory_wrapper.h>
|
| 29 |
+
#include <new>
|
| 30 |
+
|
| 31 |
+
THRUST_NAMESPACE_BEGIN
|
| 32 |
+
namespace detail
|
| 33 |
+
{
|
| 34 |
+
|
| 35 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 36 |
+
|
| 37 |
+
// std::allocator's member functions are deprecated in C++17 and removed in
|
| 38 |
+
// C++20, so we can't just use the generic implementation for allocator_traits
|
| 39 |
+
// that calls the allocator's member functions.
|
| 40 |
+
// Instead, specialize allocator_traits for std::allocator and defer to
|
| 41 |
+
// std::allocator_traits<std::allocator> and let the STL do whatever it needs
|
| 42 |
+
// to for the current c++ version. Manually forward the calls to suppress
|
| 43 |
+
// host/device warnings.
|
| 44 |
+
template <typename T>
|
| 45 |
+
struct allocator_traits<std::allocator<T>>
|
| 46 |
+
: public std::allocator_traits<std::allocator<T>>
|
| 47 |
+
{
|
| 48 |
+
private:
|
| 49 |
+
using superclass = std::allocator_traits<std::allocator<T>>;
|
| 50 |
+
|
| 51 |
+
public:
|
| 52 |
+
using allocator_type = typename superclass::allocator_type;
|
| 53 |
+
using value_type = typename superclass::value_type;
|
| 54 |
+
using pointer = typename superclass::pointer;
|
| 55 |
+
using const_pointer = typename superclass::const_pointer;
|
| 56 |
+
using void_pointer = typename superclass::void_pointer;
|
| 57 |
+
using const_void_pointer = typename superclass::const_void_pointer;
|
| 58 |
+
using difference_type = typename superclass::difference_type;
|
| 59 |
+
using size_type = typename superclass::size_type;
|
| 60 |
+
using propagate_on_container_swap = typename superclass::propagate_on_container_swap;
|
| 61 |
+
using propagate_on_container_copy_assignment =
|
| 62 |
+
typename superclass::propagate_on_container_copy_assignment;
|
| 63 |
+
using propagate_on_container_move_assignment =
|
| 64 |
+
typename superclass::propagate_on_container_move_assignment;
|
| 65 |
+
|
| 66 |
+
// std::allocator_traits added this in C++17, but thrust::allocator_traits defines
|
| 67 |
+
// it unconditionally.
|
| 68 |
+
using is_always_equal = typename eval_if<
|
| 69 |
+
allocator_traits_detail::has_is_always_equal<allocator_type>::value,
|
| 70 |
+
allocator_traits_detail::nested_is_always_equal<allocator_type>,
|
| 71 |
+
is_empty<allocator_type>
|
| 72 |
+
>::type;
|
| 73 |
+
|
| 74 |
+
// std::allocator_traits doesn't provide these, but
|
| 75 |
+
// thrust::detail::allocator_traits does. These used to be part of the
|
| 76 |
+
// std::allocator API but were deprecated in C++17.
|
| 77 |
+
using reference = typename thrust::detail::pointer_traits<pointer>::reference;
|
| 78 |
+
using const_reference = typename thrust::detail::pointer_traits<const_pointer>::reference;
|
| 79 |
+
|
| 80 |
+
template <typename U>
|
| 81 |
+
using rebind_alloc = std::allocator<U>;
|
| 82 |
+
template <typename U>
|
| 83 |
+
using rebind_traits = allocator_traits<std::allocator<U>>;
|
| 84 |
+
|
| 85 |
+
__thrust_exec_check_disable__
|
| 86 |
+
__host__ __device__
|
| 87 |
+
static pointer allocate(allocator_type &a, size_type n)
|
| 88 |
+
{
|
| 89 |
+
return superclass::allocate(a, n);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
__thrust_exec_check_disable__
|
| 93 |
+
__host__ __device__
|
| 94 |
+
static pointer allocate(allocator_type &a, size_type n, const_void_pointer hint)
|
| 95 |
+
{
|
| 96 |
+
return superclass::allocate(a, n, hint);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
__thrust_exec_check_disable__
|
| 100 |
+
__host__ __device__
|
| 101 |
+
static void deallocate(allocator_type &a, pointer p, size_type n)
|
| 102 |
+
{
|
| 103 |
+
superclass::deallocate(a, p, n);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
__thrust_exec_check_disable__
|
| 107 |
+
template <typename U, typename ...Args>
|
| 108 |
+
__host__ __device__
|
| 109 |
+
static void construct(allocator_type &a, U *p, Args&&... args)
|
| 110 |
+
{
|
| 111 |
+
superclass::construct(a, p, THRUST_FWD(args)...);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
__thrust_exec_check_disable__
|
| 115 |
+
template <typename U>
|
| 116 |
+
__host__ __device__
|
| 117 |
+
static void destroy(allocator_type &a, U *p)
|
| 118 |
+
{
|
| 119 |
+
superclass::destroy(a, p);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
__thrust_exec_check_disable__
|
| 123 |
+
__host__ __device__
|
| 124 |
+
static size_type max_size(const allocator_type &a)
|
| 125 |
+
{
|
| 126 |
+
return superclass::max_size(a);
|
| 127 |
+
}
|
| 128 |
+
};
|
| 129 |
+
|
| 130 |
+
#endif // C++11
|
| 131 |
+
|
| 132 |
+
namespace allocator_traits_detail
|
| 133 |
+
{
|
| 134 |
+
|
| 135 |
+
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_allocate_with_hint_impl, allocate)
|
| 136 |
+
|
| 137 |
+
template<typename Alloc>
|
| 138 |
+
class has_member_allocate_with_hint
|
| 139 |
+
{
|
| 140 |
+
typedef typename allocator_traits<Alloc>::pointer pointer;
|
| 141 |
+
typedef typename allocator_traits<Alloc>::size_type size_type;
|
| 142 |
+
typedef typename allocator_traits<Alloc>::const_void_pointer const_void_pointer;
|
| 143 |
+
|
| 144 |
+
public:
|
| 145 |
+
typedef typename has_member_allocate_with_hint_impl<Alloc, pointer(size_type,const_void_pointer)>::type type;
|
| 146 |
+
static const bool value = type::value;
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
template<typename Alloc>
|
| 150 |
+
__host__ __device__
|
| 151 |
+
typename enable_if<
|
| 152 |
+
has_member_allocate_with_hint<Alloc>::value,
|
| 153 |
+
typename allocator_traits<Alloc>::pointer
|
| 154 |
+
>::type
|
| 155 |
+
allocate(Alloc &a, typename allocator_traits<Alloc>::size_type n, typename allocator_traits<Alloc>::const_void_pointer hint)
|
| 156 |
+
{
|
| 157 |
+
return a.allocate(n,hint);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
template<typename Alloc>
|
| 161 |
+
__host__ __device__
|
| 162 |
+
typename disable_if<
|
| 163 |
+
has_member_allocate_with_hint<Alloc>::value,
|
| 164 |
+
typename allocator_traits<Alloc>::pointer
|
| 165 |
+
>::type
|
| 166 |
+
allocate(Alloc &a, typename allocator_traits<Alloc>::size_type n, typename allocator_traits<Alloc>::const_void_pointer)
|
| 167 |
+
{
|
| 168 |
+
return a.allocate(n);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_construct1_impl, construct)
|
| 173 |
+
|
| 174 |
+
template<typename Alloc, typename T>
|
| 175 |
+
struct has_member_construct1
|
| 176 |
+
: has_member_construct1_impl<Alloc, void(T*)>
|
| 177 |
+
{};
|
| 178 |
+
|
| 179 |
+
__thrust_exec_check_disable__
|
| 180 |
+
template<typename Alloc, typename T>
|
| 181 |
+
inline __host__ __device__
|
| 182 |
+
typename enable_if<
|
| 183 |
+
has_member_construct1<Alloc,T>::value
|
| 184 |
+
>::type
|
| 185 |
+
construct(Alloc &a, T *p)
|
| 186 |
+
{
|
| 187 |
+
a.construct(p);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
__thrust_exec_check_disable__
|
| 191 |
+
template<typename Alloc, typename T>
|
| 192 |
+
inline __host__ __device__
|
| 193 |
+
typename disable_if<
|
| 194 |
+
has_member_construct1<Alloc,T>::value
|
| 195 |
+
>::type
|
| 196 |
+
construct(Alloc &, T *p)
|
| 197 |
+
{
|
| 198 |
+
::new(static_cast<void*>(p)) T();
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_construct2_impl, construct)
|
| 203 |
+
|
| 204 |
+
template<typename Alloc, typename T, typename Arg1>
|
| 205 |
+
struct has_member_construct2
|
| 206 |
+
: has_member_construct2_impl<Alloc, void(T*,const Arg1 &)>
|
| 207 |
+
{};
|
| 208 |
+
|
| 209 |
+
__thrust_exec_check_disable__
|
| 210 |
+
template<typename Alloc, typename T, typename Arg1>
|
| 211 |
+
inline __host__ __device__
|
| 212 |
+
typename enable_if<
|
| 213 |
+
has_member_construct2<Alloc,T,Arg1>::value
|
| 214 |
+
>::type
|
| 215 |
+
construct(Alloc &a, T *p, const Arg1 &arg1)
|
| 216 |
+
{
|
| 217 |
+
a.construct(p,arg1);
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
__thrust_exec_check_disable__
|
| 221 |
+
template<typename Alloc, typename T, typename Arg1>
|
| 222 |
+
inline __host__ __device__
|
| 223 |
+
typename disable_if<
|
| 224 |
+
has_member_construct2<Alloc,T,Arg1>::value
|
| 225 |
+
>::type
|
| 226 |
+
construct(Alloc &, T *p, const Arg1 &arg1)
|
| 227 |
+
{
|
| 228 |
+
::new(static_cast<void*>(p)) T(arg1);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 232 |
+
|
| 233 |
+
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_constructN_impl, construct)
|
| 234 |
+
|
| 235 |
+
template<typename Alloc, typename T, typename... Args>
|
| 236 |
+
struct has_member_constructN
|
| 237 |
+
: has_member_constructN_impl<Alloc, void(T*, Args...)>
|
| 238 |
+
{};
|
| 239 |
+
|
| 240 |
+
__thrust_exec_check_disable__
|
| 241 |
+
template<typename Alloc, typename T, typename... Args>
|
| 242 |
+
inline __host__ __device__
|
| 243 |
+
typename enable_if<
|
| 244 |
+
has_member_constructN<Alloc, T, Args...>::value
|
| 245 |
+
>::type
|
| 246 |
+
construct(Alloc &a, T* p, Args&&... args)
|
| 247 |
+
{
|
| 248 |
+
a.construct(p, THRUST_FWD(args)...);
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
__thrust_exec_check_disable__
|
| 252 |
+
template<typename Alloc, typename T, typename... Args>
|
| 253 |
+
inline __host__ __device__
|
| 254 |
+
typename disable_if<
|
| 255 |
+
has_member_constructN<Alloc, T, Args...>::value
|
| 256 |
+
>::type
|
| 257 |
+
construct(Alloc &, T* p, Args&&... args)
|
| 258 |
+
{
|
| 259 |
+
::new(static_cast<void*>(p)) T(THRUST_FWD(args)...);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
#endif
|
| 263 |
+
|
| 264 |
+
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_destroy_impl, destroy)
|
| 265 |
+
|
| 266 |
+
template<typename Alloc, typename T>
|
| 267 |
+
struct has_member_destroy
|
| 268 |
+
: has_member_destroy_impl<Alloc, void(T*)>
|
| 269 |
+
{};
|
| 270 |
+
|
| 271 |
+
__thrust_exec_check_disable__
|
| 272 |
+
template<typename Alloc, typename T>
|
| 273 |
+
inline __host__ __device__
|
| 274 |
+
typename enable_if<
|
| 275 |
+
has_member_destroy<Alloc,T>::value
|
| 276 |
+
>::type
|
| 277 |
+
destroy(Alloc &a, T *p)
|
| 278 |
+
{
|
| 279 |
+
a.destroy(p);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
__thrust_exec_check_disable__
|
| 283 |
+
template<typename Alloc, typename T>
|
| 284 |
+
inline __host__ __device__
|
| 285 |
+
typename disable_if<
|
| 286 |
+
has_member_destroy<Alloc,T>::value
|
| 287 |
+
>::type
|
| 288 |
+
destroy(Alloc &, T *p)
|
| 289 |
+
{
|
| 290 |
+
p->~T();
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_max_size_impl, max_size)
|
| 295 |
+
|
| 296 |
+
template<typename Alloc>
|
| 297 |
+
class has_member_max_size
|
| 298 |
+
{
|
| 299 |
+
typedef typename allocator_traits<Alloc>::size_type size_type;
|
| 300 |
+
|
| 301 |
+
public:
|
| 302 |
+
typedef typename has_member_max_size_impl<Alloc, size_type(void)>::type type;
|
| 303 |
+
static const bool value = type::value;
|
| 304 |
+
};
|
| 305 |
+
|
| 306 |
+
template<typename Alloc>
|
| 307 |
+
__host__ __device__
|
| 308 |
+
typename enable_if<
|
| 309 |
+
has_member_max_size<Alloc>::value,
|
| 310 |
+
typename allocator_traits<Alloc>::size_type
|
| 311 |
+
>::type
|
| 312 |
+
max_size(const Alloc &a)
|
| 313 |
+
{
|
| 314 |
+
return a.max_size();
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
template<typename Alloc>
|
| 318 |
+
__host__ __device__
|
| 319 |
+
typename disable_if<
|
| 320 |
+
has_member_max_size<Alloc>::value,
|
| 321 |
+
typename allocator_traits<Alloc>::size_type
|
| 322 |
+
>::type
|
| 323 |
+
max_size(const Alloc &)
|
| 324 |
+
{
|
| 325 |
+
typedef typename allocator_traits<Alloc>::size_type size_type;
|
| 326 |
+
return thrust::detail::integer_traits<size_type>::const_max;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
template<typename Alloc>
|
| 330 |
+
__host__ __device__
|
| 331 |
+
typename enable_if<
|
| 332 |
+
has_member_system<Alloc>::value,
|
| 333 |
+
typename allocator_system<Alloc>::type &
|
| 334 |
+
>::type
|
| 335 |
+
system(Alloc &a)
|
| 336 |
+
{
|
| 337 |
+
// return the allocator's system
|
| 338 |
+
return a.system();
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
template<typename Alloc>
|
| 342 |
+
__host__ __device__
|
| 343 |
+
typename disable_if<
|
| 344 |
+
has_member_system<Alloc>::value,
|
| 345 |
+
typename allocator_system<Alloc>::type
|
| 346 |
+
>::type
|
| 347 |
+
system(Alloc &)
|
| 348 |
+
{
|
| 349 |
+
// return a copy of a value-initialized system
|
| 350 |
+
return typename allocator_system<Alloc>::type();
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
} // end allocator_traits_detail
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
template<typename Alloc>
|
| 358 |
+
__host__ __device__
|
| 359 |
+
typename allocator_traits<Alloc>::pointer
|
| 360 |
+
allocator_traits<Alloc>
|
| 361 |
+
::allocate(Alloc &a, typename allocator_traits<Alloc>::size_type n)
|
| 362 |
+
{
|
| 363 |
+
struct workaround_warnings
|
| 364 |
+
{
|
| 365 |
+
__thrust_exec_check_disable__
|
| 366 |
+
static __host__ __device__
|
| 367 |
+
typename allocator_traits<Alloc>::pointer
|
| 368 |
+
allocate(Alloc &a, typename allocator_traits<Alloc>::size_type n)
|
| 369 |
+
{
|
| 370 |
+
return a.allocate(n);
|
| 371 |
+
}
|
| 372 |
+
};
|
| 373 |
+
|
| 374 |
+
return workaround_warnings::allocate(a, n);
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
template<typename Alloc>
|
| 378 |
+
__host__ __device__
|
| 379 |
+
typename allocator_traits<Alloc>::pointer
|
| 380 |
+
allocator_traits<Alloc>
|
| 381 |
+
::allocate(Alloc &a, typename allocator_traits<Alloc>::size_type n, typename allocator_traits<Alloc>::const_void_pointer hint)
|
| 382 |
+
{
|
| 383 |
+
return allocator_traits_detail::allocate(a, n, hint);
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
template<typename Alloc>
|
| 387 |
+
__host__ __device__
|
| 388 |
+
void allocator_traits<Alloc>
|
| 389 |
+
::deallocate(Alloc &a, typename allocator_traits<Alloc>::pointer p, typename allocator_traits<Alloc>::size_type n)
|
| 390 |
+
{
|
| 391 |
+
struct workaround_warnings
|
| 392 |
+
{
|
| 393 |
+
__thrust_exec_check_disable__
|
| 394 |
+
static __host__ __device__
|
| 395 |
+
void deallocate(Alloc &a, typename allocator_traits<Alloc>::pointer p, typename allocator_traits<Alloc>::size_type n)
|
| 396 |
+
{
|
| 397 |
+
return a.deallocate(p,n);
|
| 398 |
+
}
|
| 399 |
+
};
|
| 400 |
+
|
| 401 |
+
return workaround_warnings::deallocate(a,p,n);
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
template<typename Alloc>
|
| 405 |
+
template<typename T>
|
| 406 |
+
__host__ __device__
|
| 407 |
+
void allocator_traits<Alloc>
|
| 408 |
+
::construct(allocator_type &a, T *p)
|
| 409 |
+
{
|
| 410 |
+
return allocator_traits_detail::construct(a,p);
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
template<typename Alloc>
|
| 414 |
+
template<typename T, typename Arg1>
|
| 415 |
+
__host__ __device__
|
| 416 |
+
void allocator_traits<Alloc>
|
| 417 |
+
::construct(allocator_type &a, T *p, const Arg1 &arg1)
|
| 418 |
+
{
|
| 419 |
+
return allocator_traits_detail::construct(a,p,arg1);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 423 |
+
|
| 424 |
+
template<typename Alloc>
|
| 425 |
+
template<typename T, typename... Args>
|
| 426 |
+
__host__ __device__
|
| 427 |
+
void allocator_traits<Alloc>
|
| 428 |
+
::construct(allocator_type &a, T *p, Args&&... args)
|
| 429 |
+
{
|
| 430 |
+
return allocator_traits_detail::construct(a, p, THRUST_FWD(args)...);
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
#endif
|
| 434 |
+
|
| 435 |
+
template<typename Alloc>
|
| 436 |
+
template<typename T>
|
| 437 |
+
__host__ __device__
|
| 438 |
+
void allocator_traits<Alloc>
|
| 439 |
+
::destroy(allocator_type &a, T *p)
|
| 440 |
+
{
|
| 441 |
+
return allocator_traits_detail::destroy(a,p);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
template<typename Alloc>
|
| 445 |
+
__host__ __device__
|
| 446 |
+
typename allocator_traits<Alloc>::size_type
|
| 447 |
+
allocator_traits<Alloc>
|
| 448 |
+
::max_size(const allocator_type &a)
|
| 449 |
+
{
|
| 450 |
+
return allocator_traits_detail::max_size(a);
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
template<typename Alloc>
|
| 454 |
+
__host__ __device__
|
| 455 |
+
typename allocator_system<Alloc>::get_result_type
|
| 456 |
+
allocator_system<Alloc>
|
| 457 |
+
::get(Alloc &a)
|
| 458 |
+
{
|
| 459 |
+
return allocator_traits_detail::system(a);
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
} // end detail
|
| 464 |
+
THRUST_NAMESPACE_END
|
| 465 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/default_construct_range.inl
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/allocator/allocator_traits.h>
|
| 21 |
+
#include <thrust/detail/type_traits.h>
|
| 22 |
+
#include <thrust/detail/type_traits/pointer_traits.h>
|
| 23 |
+
#include <thrust/for_each.h>
|
| 24 |
+
#include <thrust/uninitialized_fill.h>
|
| 25 |
+
|
| 26 |
+
THRUST_NAMESPACE_BEGIN
|
| 27 |
+
namespace detail
|
| 28 |
+
{
|
| 29 |
+
namespace allocator_traits_detail
|
| 30 |
+
{
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
template<typename Allocator>
|
| 34 |
+
struct construct1_via_allocator
|
| 35 |
+
{
|
| 36 |
+
Allocator &a;
|
| 37 |
+
|
| 38 |
+
__host__ __device__
|
| 39 |
+
construct1_via_allocator(Allocator &a)
|
| 40 |
+
: a(a)
|
| 41 |
+
{}
|
| 42 |
+
|
| 43 |
+
template<typename T>
|
| 44 |
+
inline __host__ __device__
|
| 45 |
+
void operator()(T &x)
|
| 46 |
+
{
|
| 47 |
+
allocator_traits<Allocator>::construct(a, &x);
|
| 48 |
+
}
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
// we need to construct T via the allocator if...
|
| 53 |
+
template<typename Allocator, typename T>
|
| 54 |
+
struct needs_default_construct_via_allocator
|
| 55 |
+
: thrust::detail::or_<
|
| 56 |
+
has_member_construct1<Allocator,T>, // if the Allocator does something interesting
|
| 57 |
+
thrust::detail::not_<has_trivial_constructor<T> > // or if T's default constructor does something interesting
|
| 58 |
+
>
|
| 59 |
+
{};
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
// we know that std::allocator::construct's only effect is to call T's
|
| 63 |
+
// default constructor, so we needn't use it for default construction
|
| 64 |
+
// unless T's constructor does something interesting
|
| 65 |
+
template<typename U, typename T>
|
| 66 |
+
struct needs_default_construct_via_allocator<std::allocator<U>, T>
|
| 67 |
+
: thrust::detail::not_<has_trivial_constructor<T> >
|
| 68 |
+
{};
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
template<typename Allocator, typename Pointer, typename Size>
|
| 72 |
+
__host__ __device__
|
| 73 |
+
typename enable_if<
|
| 74 |
+
needs_default_construct_via_allocator<
|
| 75 |
+
Allocator,
|
| 76 |
+
typename pointer_element<Pointer>::type
|
| 77 |
+
>::value
|
| 78 |
+
>::type
|
| 79 |
+
default_construct_range(Allocator &a, Pointer p, Size n)
|
| 80 |
+
{
|
| 81 |
+
thrust::for_each_n(allocator_system<Allocator>::get(a), p, n, construct1_via_allocator<Allocator>(a));
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
template<typename Allocator, typename Pointer, typename Size>
|
| 86 |
+
__host__ __device__
|
| 87 |
+
typename disable_if<
|
| 88 |
+
needs_default_construct_via_allocator<
|
| 89 |
+
Allocator,
|
| 90 |
+
typename pointer_element<Pointer>::type
|
| 91 |
+
>::value
|
| 92 |
+
>::type
|
| 93 |
+
default_construct_range(Allocator &a, Pointer p, Size n)
|
| 94 |
+
{
|
| 95 |
+
thrust::uninitialized_fill_n(allocator_system<Allocator>::get(a), p, n, typename pointer_element<Pointer>::type());
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
} // end allocator_traits_detail
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
template<typename Allocator, typename Pointer, typename Size>
|
| 103 |
+
__host__ __device__
|
| 104 |
+
void default_construct_range(Allocator &a, Pointer p, Size n)
|
| 105 |
+
{
|
| 106 |
+
return allocator_traits_detail::default_construct_range(a,p,n);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
} // end detail
|
| 111 |
+
THRUST_NAMESPACE_END
|
| 112 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/destroy_range.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
|
| 21 |
+
THRUST_NAMESPACE_BEGIN
|
| 22 |
+
namespace detail
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
template<typename Allocator, typename Pointer, typename Size>
|
| 26 |
+
__host__ __device__
|
| 27 |
+
inline void destroy_range(Allocator &a, Pointer p, Size n);
|
| 28 |
+
|
| 29 |
+
} // end detail
|
| 30 |
+
THRUST_NAMESPACE_END
|
| 31 |
+
|
| 32 |
+
#include <thrust/detail/allocator/destroy_range.inl>
|
| 33 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/fill_construct_range.inl
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/type_traits.h>
|
| 21 |
+
#include <thrust/detail/allocator/allocator_traits.h>
|
| 22 |
+
#include <thrust/detail/type_traits/pointer_traits.h>
|
| 23 |
+
#include <thrust/for_each.h>
|
| 24 |
+
#include <thrust/uninitialized_fill.h>
|
| 25 |
+
#include <thrust/detail/memory_wrapper.h>
|
| 26 |
+
|
| 27 |
+
THRUST_NAMESPACE_BEGIN
|
| 28 |
+
namespace detail
|
| 29 |
+
{
|
| 30 |
+
namespace allocator_traits_detail
|
| 31 |
+
{
|
| 32 |
+
|
| 33 |
+
// fill_construct_range has 2 cases:
|
| 34 |
+
// if Allocator has an effectful member function construct:
|
| 35 |
+
// 1. construct via the allocator
|
| 36 |
+
// else
|
| 37 |
+
// 2. construct via uninitialized_fill
|
| 38 |
+
|
| 39 |
+
template<typename Allocator, typename T, typename Arg1>
|
| 40 |
+
struct has_effectful_member_construct2
|
| 41 |
+
: has_member_construct2<Allocator,T,Arg1>
|
| 42 |
+
{};
|
| 43 |
+
|
| 44 |
+
// std::allocator::construct's only effect is to invoke placement new
|
| 45 |
+
template<typename U, typename T, typename Arg1>
|
| 46 |
+
struct has_effectful_member_construct2<std::allocator<U>,T,Arg1>
|
| 47 |
+
: thrust::detail::false_type
|
| 48 |
+
{};
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
template<typename Allocator, typename Arg1>
|
| 52 |
+
struct construct2_via_allocator
|
| 53 |
+
{
|
| 54 |
+
Allocator &a;
|
| 55 |
+
Arg1 arg;
|
| 56 |
+
|
| 57 |
+
__host__ __device__
|
| 58 |
+
construct2_via_allocator(Allocator &a, const Arg1 &arg)
|
| 59 |
+
: a(a), arg(arg)
|
| 60 |
+
{}
|
| 61 |
+
|
| 62 |
+
template<typename T>
|
| 63 |
+
inline __host__ __device__
|
| 64 |
+
void operator()(T &x)
|
| 65 |
+
{
|
| 66 |
+
allocator_traits<Allocator>::construct(a, &x, arg);
|
| 67 |
+
}
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
template<typename Allocator, typename Pointer, typename Size, typename T>
|
| 72 |
+
__host__ __device__
|
| 73 |
+
typename enable_if<
|
| 74 |
+
has_effectful_member_construct2<
|
| 75 |
+
Allocator,
|
| 76 |
+
typename pointer_element<Pointer>::type,
|
| 77 |
+
T
|
| 78 |
+
>::value
|
| 79 |
+
>::type
|
| 80 |
+
fill_construct_range(Allocator &a, Pointer p, Size n, const T &value)
|
| 81 |
+
{
|
| 82 |
+
thrust::for_each_n(allocator_system<Allocator>::get(a), p, n, construct2_via_allocator<Allocator,T>(a, value));
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
template<typename Allocator, typename Pointer, typename Size, typename T>
|
| 87 |
+
__host__ __device__
|
| 88 |
+
typename disable_if<
|
| 89 |
+
has_effectful_member_construct2<
|
| 90 |
+
Allocator,
|
| 91 |
+
typename pointer_element<Pointer>::type,
|
| 92 |
+
T
|
| 93 |
+
>::value
|
| 94 |
+
>::type
|
| 95 |
+
fill_construct_range(Allocator &a, Pointer p, Size n, const T &value)
|
| 96 |
+
{
|
| 97 |
+
thrust::uninitialized_fill_n(allocator_system<Allocator>::get(a), p, n, value);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
} // end allocator_traits_detail
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
template<typename Alloc, typename Pointer, typename Size, typename T>
|
| 105 |
+
__host__ __device__
|
| 106 |
+
void fill_construct_range(Alloc &a, Pointer p, Size n, const T &value)
|
| 107 |
+
{
|
| 108 |
+
return allocator_traits_detail::fill_construct_range(a,p,n,value);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
} // end detail
|
| 113 |
+
THRUST_NAMESPACE_END
|
| 114 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/malloc_allocator.h
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/type_traits/pointer_traits.h>
|
| 21 |
+
#include <thrust/detail/allocator/tagged_allocator.h>
|
| 22 |
+
|
| 23 |
+
THRUST_NAMESPACE_BEGIN
|
| 24 |
+
namespace detail
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
template<typename T, typename System, typename Pointer>
|
| 28 |
+
class malloc_allocator
|
| 29 |
+
: public thrust::detail::tagged_allocator<
|
| 30 |
+
T, System, Pointer
|
| 31 |
+
>
|
| 32 |
+
{
|
| 33 |
+
private:
|
| 34 |
+
typedef thrust::detail::tagged_allocator<
|
| 35 |
+
T, System, Pointer
|
| 36 |
+
> super_t;
|
| 37 |
+
|
| 38 |
+
public:
|
| 39 |
+
typedef typename super_t::pointer pointer;
|
| 40 |
+
typedef typename super_t::size_type size_type;
|
| 41 |
+
|
| 42 |
+
pointer allocate(size_type cnt);
|
| 43 |
+
|
| 44 |
+
void deallocate(pointer p, size_type n);
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
} // end detail
|
| 48 |
+
THRUST_NAMESPACE_END
|
| 49 |
+
|
| 50 |
+
#include <thrust/detail/allocator/malloc_allocator.inl>
|
| 51 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/malloc_allocator.inl
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/allocator/malloc_allocator.h>
|
| 21 |
+
#include <thrust/system/detail/generic/select_system.h>
|
| 22 |
+
#include <thrust/system/detail/bad_alloc.h>
|
| 23 |
+
#include <thrust/detail/raw_pointer_cast.h>
|
| 24 |
+
#include <thrust/detail/malloc_and_free.h>
|
| 25 |
+
|
| 26 |
+
THRUST_NAMESPACE_BEGIN
|
| 27 |
+
namespace detail
|
| 28 |
+
{
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
template<typename T, typename System, typename Pointer>
|
| 32 |
+
typename malloc_allocator<T,System,Pointer>::pointer
|
| 33 |
+
malloc_allocator<T,System,Pointer>
|
| 34 |
+
::allocate(typename malloc_allocator<T,System,Pointer>::size_type cnt)
|
| 35 |
+
{
|
| 36 |
+
using thrust::system::detail::generic::select_system;
|
| 37 |
+
|
| 38 |
+
// XXX should use a hypothetical thrust::static_pointer_cast here
|
| 39 |
+
System system;
|
| 40 |
+
|
| 41 |
+
pointer result = thrust::malloc<T>(select_system(system), cnt);
|
| 42 |
+
|
| 43 |
+
if(result.get() == 0)
|
| 44 |
+
{
|
| 45 |
+
throw thrust::system::detail::bad_alloc("malloc_allocator::allocate: malloc failed");
|
| 46 |
+
} // end if
|
| 47 |
+
|
| 48 |
+
return result;
|
| 49 |
+
} // end malloc_allocator::allocate()
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
template<typename T, typename System, typename Pointer>
|
| 53 |
+
void malloc_allocator<T,System,Pointer>
|
| 54 |
+
::deallocate(typename malloc_allocator<T,System,Pointer>::pointer p, typename malloc_allocator<T,System,Pointer>::size_type)
|
| 55 |
+
{
|
| 56 |
+
using thrust::system::detail::generic::select_system;
|
| 57 |
+
|
| 58 |
+
System system;
|
| 59 |
+
thrust::free(select_system(system), p);
|
| 60 |
+
} // end malloc_allocator
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
} // end detail
|
| 64 |
+
THRUST_NAMESPACE_END
|
| 65 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/tagged_allocator.h
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/type_traits/pointer_traits.h>
|
| 21 |
+
#include <thrust/iterator/iterator_traits.h>
|
| 22 |
+
|
| 23 |
+
THRUST_NAMESPACE_BEGIN
|
| 24 |
+
namespace detail
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
template<typename T, typename Tag, typename Pointer> class tagged_allocator;
|
| 28 |
+
|
| 29 |
+
template<typename Tag, typename Pointer>
|
| 30 |
+
class tagged_allocator<void, Tag, Pointer>
|
| 31 |
+
{
|
| 32 |
+
public:
|
| 33 |
+
typedef void value_type;
|
| 34 |
+
typedef typename thrust::detail::pointer_traits<Pointer>::template rebind<void>::other pointer;
|
| 35 |
+
typedef typename thrust::detail::pointer_traits<Pointer>::template rebind<const void>::other const_pointer;
|
| 36 |
+
typedef std::size_t size_type;
|
| 37 |
+
typedef typename thrust::detail::pointer_traits<Pointer>::difference_type difference_type;
|
| 38 |
+
typedef Tag system_type;
|
| 39 |
+
|
| 40 |
+
template<typename U>
|
| 41 |
+
struct rebind
|
| 42 |
+
{
|
| 43 |
+
typedef tagged_allocator<U,Tag,Pointer> other;
|
| 44 |
+
}; // end rebind
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
template<typename T, typename Tag, typename Pointer>
|
| 48 |
+
class tagged_allocator
|
| 49 |
+
{
|
| 50 |
+
public:
|
| 51 |
+
typedef T value_type;
|
| 52 |
+
typedef typename thrust::detail::pointer_traits<Pointer>::template rebind<T>::other pointer;
|
| 53 |
+
typedef typename thrust::detail::pointer_traits<Pointer>::template rebind<const T>::other const_pointer;
|
| 54 |
+
typedef typename thrust::iterator_reference<pointer>::type reference;
|
| 55 |
+
typedef typename thrust::iterator_reference<const_pointer>::type const_reference;
|
| 56 |
+
typedef std::size_t size_type;
|
| 57 |
+
typedef typename thrust::detail::pointer_traits<pointer>::difference_type difference_type;
|
| 58 |
+
typedef Tag system_type;
|
| 59 |
+
|
| 60 |
+
template<typename U>
|
| 61 |
+
struct rebind
|
| 62 |
+
{
|
| 63 |
+
typedef tagged_allocator<U,Tag,Pointer> other;
|
| 64 |
+
}; // end rebind
|
| 65 |
+
|
| 66 |
+
__host__ __device__
|
| 67 |
+
inline tagged_allocator();
|
| 68 |
+
|
| 69 |
+
__host__ __device__
|
| 70 |
+
inline tagged_allocator(const tagged_allocator &);
|
| 71 |
+
|
| 72 |
+
template<typename U, typename OtherPointer>
|
| 73 |
+
__host__ __device__
|
| 74 |
+
inline tagged_allocator(const tagged_allocator<U, Tag, OtherPointer> &);
|
| 75 |
+
|
| 76 |
+
__host__ __device__
|
| 77 |
+
inline ~tagged_allocator();
|
| 78 |
+
|
| 79 |
+
__host__ __device__
|
| 80 |
+
pointer address(reference x) const;
|
| 81 |
+
|
| 82 |
+
__host__ __device__
|
| 83 |
+
const_pointer address(const_reference x) const;
|
| 84 |
+
|
| 85 |
+
size_type max_size() const;
|
| 86 |
+
};
|
| 87 |
+
|
| 88 |
+
template<typename T1, typename Pointer1, typename T2, typename Pointer2, typename Tag>
|
| 89 |
+
__host__ __device__
|
| 90 |
+
bool operator==(const tagged_allocator<T1,Pointer1,Tag> &, const tagged_allocator<T2,Pointer2,Tag> &);
|
| 91 |
+
|
| 92 |
+
template<typename T1, typename Pointer1, typename T2, typename Pointer2, typename Tag>
|
| 93 |
+
__host__ __device__
|
| 94 |
+
bool operator!=(const tagged_allocator<T1,Pointer1,Tag> &, const tagged_allocator<T2,Pointer2,Tag> &);
|
| 95 |
+
|
| 96 |
+
} // end detail
|
| 97 |
+
THRUST_NAMESPACE_END
|
| 98 |
+
|
| 99 |
+
#include <thrust/detail/allocator/tagged_allocator.inl>
|
| 100 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/temporary_allocator.h
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/allocator/tagged_allocator.h>
|
| 21 |
+
#include <thrust/detail/allocator/allocator_traits.h>
|
| 22 |
+
#include <thrust/pair.h>
|
| 23 |
+
#include <thrust/memory.h>
|
| 24 |
+
#include <thrust/detail/execution_policy.h>
|
| 25 |
+
|
| 26 |
+
THRUST_NAMESPACE_BEGIN
|
| 27 |
+
namespace detail
|
| 28 |
+
{
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// XXX the pointer parameter given to tagged_allocator should be related to
|
| 32 |
+
// the type of the expression get_temporary_buffer(system, n).first
|
| 33 |
+
// without decltype, compromise on pointer<T,System>
|
| 34 |
+
template<typename T, typename System>
|
| 35 |
+
class temporary_allocator
|
| 36 |
+
: public thrust::detail::tagged_allocator<
|
| 37 |
+
T, System, thrust::pointer<T,System>
|
| 38 |
+
>
|
| 39 |
+
{
|
| 40 |
+
private:
|
| 41 |
+
typedef thrust::detail::tagged_allocator<
|
| 42 |
+
T, System, thrust::pointer<T,System>
|
| 43 |
+
> super_t;
|
| 44 |
+
|
| 45 |
+
System &m_system;
|
| 46 |
+
|
| 47 |
+
public:
|
| 48 |
+
typedef typename super_t::pointer pointer;
|
| 49 |
+
typedef typename super_t::size_type size_type;
|
| 50 |
+
|
| 51 |
+
inline __host__ __device__
|
| 52 |
+
temporary_allocator(const temporary_allocator &other) :
|
| 53 |
+
super_t(),
|
| 54 |
+
m_system(other.m_system)
|
| 55 |
+
{}
|
| 56 |
+
|
| 57 |
+
inline __host__ __device__
|
| 58 |
+
explicit temporary_allocator(thrust::execution_policy<System> &system) :
|
| 59 |
+
super_t(),
|
| 60 |
+
m_system(thrust::detail::derived_cast(system))
|
| 61 |
+
{}
|
| 62 |
+
|
| 63 |
+
__host__ __device__
|
| 64 |
+
pointer allocate(size_type cnt);
|
| 65 |
+
|
| 66 |
+
__host__ __device__
|
| 67 |
+
void deallocate(pointer p, size_type n);
|
| 68 |
+
|
| 69 |
+
__host__ __device__
|
| 70 |
+
inline System &system()
|
| 71 |
+
{
|
| 72 |
+
return m_system;
|
| 73 |
+
} // end system()
|
| 74 |
+
|
| 75 |
+
private:
|
| 76 |
+
typedef thrust::pair<pointer, size_type> pointer_and_size;
|
| 77 |
+
}; // end temporary_allocator
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
} // end detail
|
| 81 |
+
THRUST_NAMESPACE_END
|
| 82 |
+
|
| 83 |
+
#include <thrust/detail/allocator/temporary_allocator.inl>
|
| 84 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/allocator/temporary_allocator.inl
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/allocator/temporary_allocator.h>
|
| 21 |
+
#include <thrust/detail/temporary_buffer.h>
|
| 22 |
+
#include <thrust/system/detail/bad_alloc.h>
|
| 23 |
+
#include <cassert>
|
| 24 |
+
|
| 25 |
+
#include <nv/target>
|
| 26 |
+
|
| 27 |
+
#if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA
|
| 28 |
+
#if (defined(_NVHPC_CUDA) || defined(__CUDA_ARCH__))
|
| 29 |
+
#include <thrust/system/cuda/detail/terminate.h>
|
| 30 |
+
#endif // NVCC device pass or NVC++
|
| 31 |
+
#endif // CUDA
|
| 32 |
+
|
| 33 |
+
THRUST_NAMESPACE_BEGIN
|
| 34 |
+
namespace detail
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
template<typename T, typename System>
|
| 39 |
+
__host__ __device__
|
| 40 |
+
typename temporary_allocator<T,System>::pointer
|
| 41 |
+
temporary_allocator<T,System>
|
| 42 |
+
::allocate(typename temporary_allocator<T,System>::size_type cnt)
|
| 43 |
+
{
|
| 44 |
+
pointer_and_size result = thrust::get_temporary_buffer<T>(system(), cnt);
|
| 45 |
+
|
| 46 |
+
// handle failure
|
| 47 |
+
if(result.second < cnt)
|
| 48 |
+
{
|
| 49 |
+
// deallocate and throw
|
| 50 |
+
// note that we pass cnt to deallocate, not a value derived from result.second
|
| 51 |
+
deallocate(result.first, cnt);
|
| 52 |
+
|
| 53 |
+
#if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA
|
| 54 |
+
NV_IF_TARGET(NV_IS_HOST, (
|
| 55 |
+
throw thrust::system::detail::bad_alloc("temporary_buffer::allocate: get_temporary_buffer failed");
|
| 56 |
+
), ( // NV_IS_DEVICE
|
| 57 |
+
thrust::system::cuda::detail::terminate_with_message("temporary_buffer::allocate: get_temporary_buffer failed");
|
| 58 |
+
));
|
| 59 |
+
#else
|
| 60 |
+
throw thrust::system::detail::bad_alloc("temporary_buffer::allocate: get_temporary_buffer failed");
|
| 61 |
+
#endif
|
| 62 |
+
} // end if
|
| 63 |
+
|
| 64 |
+
return result.first;
|
| 65 |
+
} // end temporary_allocator::allocate()
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
template<typename T, typename System>
|
| 69 |
+
__host__ __device__
|
| 70 |
+
void temporary_allocator<T,System>
|
| 71 |
+
::deallocate(typename temporary_allocator<T,System>::pointer p, typename temporary_allocator<T,System>::size_type n)
|
| 72 |
+
{
|
| 73 |
+
return thrust::return_temporary_buffer(system(), p, n);
|
| 74 |
+
} // end temporary_allocator
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
} // end detail
|
| 78 |
+
THRUST_NAMESPACE_END
|
| 79 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/arithmetic.h
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2021 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <thrust/detail/config.h>
|
| 21 |
+
|
| 22 |
+
#include <thrust/complex.h>
|
| 23 |
+
#include <thrust/detail/complex/c99math.h>
|
| 24 |
+
#include <cfloat>
|
| 25 |
+
#include <cmath>
|
| 26 |
+
|
| 27 |
+
THRUST_NAMESPACE_BEGIN
|
| 28 |
+
|
| 29 |
+
/* --- Binary Arithmetic Operators --- */
|
| 30 |
+
|
| 31 |
+
template <typename T0, typename T1>
|
| 32 |
+
__host__ __device__
|
| 33 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 34 |
+
operator+(const complex<T0>& x, const complex<T1>& y)
|
| 35 |
+
{
|
| 36 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 37 |
+
return complex<T>(x.real() + y.real(), x.imag() + y.imag());
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
template <typename T0, typename T1>
|
| 41 |
+
__host__ __device__
|
| 42 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 43 |
+
operator+(const complex<T0>& x, const T1& y)
|
| 44 |
+
{
|
| 45 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 46 |
+
return complex<T>(x.real() + y, x.imag());
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
template <typename T0, typename T1>
|
| 50 |
+
__host__ __device__
|
| 51 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 52 |
+
operator+(const T0& x, const complex<T1>& y)
|
| 53 |
+
{
|
| 54 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 55 |
+
return complex<T>(x + y.real(), y.imag());
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
template <typename T0, typename T1>
|
| 60 |
+
__host__ __device__
|
| 61 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 62 |
+
operator-(const complex<T0>& x, const complex<T1>& y)
|
| 63 |
+
{
|
| 64 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 65 |
+
return complex<T>(x.real() - y.real(), x.imag() - y.imag());
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
template <typename T0, typename T1>
|
| 69 |
+
__host__ __device__
|
| 70 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 71 |
+
operator-(const complex<T0>& x, const T1& y)
|
| 72 |
+
{
|
| 73 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 74 |
+
return complex<T>(x.real() - y, x.imag());
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
template <typename T0, typename T1>
|
| 78 |
+
__host__ __device__
|
| 79 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 80 |
+
operator-(const T0& x, const complex<T1>& y)
|
| 81 |
+
{
|
| 82 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 83 |
+
return complex<T>(x - y.real(), -y.imag());
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
template <typename T0, typename T1>
|
| 88 |
+
__host__ __device__
|
| 89 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 90 |
+
operator*(const complex<T0>& x, const complex<T1>& y)
|
| 91 |
+
{
|
| 92 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 93 |
+
return complex<T>( x.real() * y.real() - x.imag() * y.imag()
|
| 94 |
+
, x.real() * y.imag() + x.imag() * y.real());
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
template <typename T0, typename T1>
|
| 98 |
+
__host__ __device__
|
| 99 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 100 |
+
operator*(const complex<T0>& x, const T1& y)
|
| 101 |
+
{
|
| 102 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 103 |
+
return complex<T>(x.real() * y, x.imag() * y);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
template <typename T0, typename T1>
|
| 107 |
+
__host__ __device__
|
| 108 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 109 |
+
operator*(const T0& x, const complex<T1>& y)
|
| 110 |
+
{
|
| 111 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 112 |
+
return complex<T>(x * y.real(), x * y.imag());
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
template <typename T0, typename T1>
|
| 117 |
+
__host__ __device__
|
| 118 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 119 |
+
operator/(const complex<T0>& x, const complex<T1>& y)
|
| 120 |
+
{
|
| 121 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 122 |
+
|
| 123 |
+
// Find `abs` by ADL.
|
| 124 |
+
using std::abs;
|
| 125 |
+
|
| 126 |
+
T s = abs(y.real()) + abs(y.imag());
|
| 127 |
+
|
| 128 |
+
T oos = T(1.0) / s;
|
| 129 |
+
|
| 130 |
+
T ars = x.real() * oos;
|
| 131 |
+
T ais = x.imag() * oos;
|
| 132 |
+
T brs = y.real() * oos;
|
| 133 |
+
T bis = y.imag() * oos;
|
| 134 |
+
|
| 135 |
+
s = (brs * brs) + (bis * bis);
|
| 136 |
+
|
| 137 |
+
oos = T(1.0) / s;
|
| 138 |
+
|
| 139 |
+
complex<T> quot( ((ars * brs) + (ais * bis)) * oos
|
| 140 |
+
, ((ais * brs) - (ars * bis)) * oos);
|
| 141 |
+
return quot;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
template <typename T0, typename T1>
|
| 145 |
+
__host__ __device__
|
| 146 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 147 |
+
operator/(const complex<T0>& x, const T1& y)
|
| 148 |
+
{
|
| 149 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 150 |
+
return complex<T>(x.real() / y, x.imag() / y);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
template <typename T0, typename T1>
|
| 154 |
+
__host__ __device__
|
| 155 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 156 |
+
operator/(const T0& x, const complex<T1>& y)
|
| 157 |
+
{
|
| 158 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 159 |
+
return complex<T>(x) / y;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
/* --- Unary Arithmetic Operators --- */
|
| 165 |
+
|
| 166 |
+
template <typename T>
|
| 167 |
+
__host__ __device__
|
| 168 |
+
complex<T> operator+(const complex<T>& y)
|
| 169 |
+
{
|
| 170 |
+
return y;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
template <typename T>
|
| 174 |
+
__host__ __device__
|
| 175 |
+
complex<T> operator-(const complex<T>& y)
|
| 176 |
+
{
|
| 177 |
+
return y * -T(1);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
/* --- Other Basic Arithmetic Functions --- */
|
| 182 |
+
|
| 183 |
+
// As std::hypot is only C++11 we have to use the C interface
|
| 184 |
+
template <typename T>
|
| 185 |
+
__host__ __device__
|
| 186 |
+
T abs(const complex<T>& z)
|
| 187 |
+
{
|
| 188 |
+
return hypot(z.real(), z.imag());
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
// XXX Why are we specializing here?
|
| 192 |
+
namespace detail {
|
| 193 |
+
namespace complex {
|
| 194 |
+
|
| 195 |
+
__host__ __device__
|
| 196 |
+
inline float abs(const thrust::complex<float>& z)
|
| 197 |
+
{
|
| 198 |
+
return hypotf(z.real(),z.imag());
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
__host__ __device__
|
| 202 |
+
inline double abs(const thrust::complex<double>& z)
|
| 203 |
+
{
|
| 204 |
+
return hypot(z.real(),z.imag());
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
} // end namespace complex
|
| 208 |
+
} // end namespace detail
|
| 209 |
+
|
| 210 |
+
template <>
|
| 211 |
+
__host__ __device__
|
| 212 |
+
inline float abs(const complex<float>& z)
|
| 213 |
+
{
|
| 214 |
+
return detail::complex::abs(z);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
template <>
|
| 218 |
+
__host__ __device__
|
| 219 |
+
inline double abs(const complex<double>& z)
|
| 220 |
+
{
|
| 221 |
+
return detail::complex::abs(z);
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
template <typename T>
|
| 226 |
+
__host__ __device__
|
| 227 |
+
T arg(const complex<T>& z)
|
| 228 |
+
{
|
| 229 |
+
// Find `atan2` by ADL.
|
| 230 |
+
using std::atan2;
|
| 231 |
+
return atan2(z.imag(), z.real());
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
template <typename T>
|
| 236 |
+
__host__ __device__
|
| 237 |
+
complex<T> conj(const complex<T>& z)
|
| 238 |
+
{
|
| 239 |
+
return complex<T>(z.real(), -z.imag());
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
template <typename T>
|
| 244 |
+
__host__ __device__
|
| 245 |
+
T norm(const complex<T>& z)
|
| 246 |
+
{
|
| 247 |
+
return z.real() * z.real() + z.imag() * z.imag();
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
// XXX Why specialize these, we could just rely on ADL.
|
| 251 |
+
template <>
|
| 252 |
+
__host__ __device__
|
| 253 |
+
inline float norm(const complex<float>& z)
|
| 254 |
+
{
|
| 255 |
+
// Find `abs` and `sqrt` by ADL.
|
| 256 |
+
using std::abs;
|
| 257 |
+
using std::sqrt;
|
| 258 |
+
|
| 259 |
+
if (abs(z.real()) < sqrt(FLT_MIN) && abs(z.imag()) < sqrt(FLT_MIN))
|
| 260 |
+
{
|
| 261 |
+
float a = z.real() * 4.0f;
|
| 262 |
+
float b = z.imag() * 4.0f;
|
| 263 |
+
return (a * a + b * b) / 16.0f;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
return z.real() * z.real() + z.imag() * z.imag();
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
template <>
|
| 270 |
+
__host__ __device__
|
| 271 |
+
inline double norm(const complex<double>& z)
|
| 272 |
+
{
|
| 273 |
+
// Find `abs` and `sqrt` by ADL.
|
| 274 |
+
using std::abs;
|
| 275 |
+
using std::sqrt;
|
| 276 |
+
|
| 277 |
+
if (abs(z.real()) < sqrt(DBL_MIN) && abs(z.imag()) < sqrt(DBL_MIN))
|
| 278 |
+
{
|
| 279 |
+
double a = z.real() * 4.0;
|
| 280 |
+
double b = z.imag() * 4.0;
|
| 281 |
+
return (a * a + b * b) / 16.0;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
return z.real() * z.real() + z.imag() * z.imag();
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
template <typename T0, typename T1>
|
| 289 |
+
__host__ __device__
|
| 290 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 291 |
+
polar(const T0& m, const T1& theta)
|
| 292 |
+
{
|
| 293 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 294 |
+
|
| 295 |
+
// Find `cos` and `sin` by ADL.
|
| 296 |
+
using std::cos;
|
| 297 |
+
using std::sin;
|
| 298 |
+
|
| 299 |
+
return complex<T>(m * cos(theta), m * sin(theta));
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
THRUST_NAMESPACE_END
|
| 303 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/c99math.h
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
|
| 21 |
+
#include <math.h>
|
| 22 |
+
#include <cmath>
|
| 23 |
+
#include <thrust/detail/complex/math_private.h>
|
| 24 |
+
|
| 25 |
+
THRUST_NAMESPACE_BEGIN
|
| 26 |
+
namespace detail
|
| 27 |
+
{
|
| 28 |
+
namespace complex
|
| 29 |
+
{
|
| 30 |
+
|
| 31 |
+
// Define basic arithmetic functions so we can use them without explicit scope
|
| 32 |
+
// keeping the code as close as possible to FreeBSDs for ease of maintenance.
|
| 33 |
+
// It also provides an easy way to support compilers with missing C99 functions.
|
| 34 |
+
// When possible, just use the names in the global scope.
|
| 35 |
+
// Some platforms define these as macros, others as free functions.
|
| 36 |
+
// Avoid using the std:: form of these as nvcc may treat std::foo() as __host__ functions.
|
| 37 |
+
|
| 38 |
+
using ::log;
|
| 39 |
+
using ::acos;
|
| 40 |
+
using ::asin;
|
| 41 |
+
using ::sqrt;
|
| 42 |
+
using ::sinh;
|
| 43 |
+
using ::tan;
|
| 44 |
+
using ::cos;
|
| 45 |
+
using ::sin;
|
| 46 |
+
using ::exp;
|
| 47 |
+
using ::cosh;
|
| 48 |
+
using ::atan;
|
| 49 |
+
|
| 50 |
+
template <typename T>
|
| 51 |
+
inline __host__ __device__ T infinity();
|
| 52 |
+
|
| 53 |
+
template <>
|
| 54 |
+
inline __host__ __device__ float infinity<float>()
|
| 55 |
+
{
|
| 56 |
+
float res;
|
| 57 |
+
set_float_word(res, 0x7f800000);
|
| 58 |
+
return res;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
template <>
|
| 63 |
+
inline __host__ __device__ double infinity<double>()
|
| 64 |
+
{
|
| 65 |
+
double res;
|
| 66 |
+
insert_words(res, 0x7ff00000,0);
|
| 67 |
+
return res;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
#if defined _MSC_VER
|
| 71 |
+
__host__ __device__ inline int isinf(float x){
|
| 72 |
+
return std::abs(x) == infinity<float>();
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
__host__ __device__ inline int isinf(double x){
|
| 76 |
+
return std::abs(x) == infinity<double>();
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
__host__ __device__ inline int isnan(float x){
|
| 80 |
+
return x != x;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
__host__ __device__ inline int isnan(double x){
|
| 84 |
+
return x != x;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
__host__ __device__ inline int signbit(float x){
|
| 88 |
+
return ((*((uint32_t *)&x)) & 0x80000000) != 0 ? 1 : 0;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
__host__ __device__ inline int signbit(double x){
|
| 92 |
+
return ((*((uint64_t *)&x)) & 0x8000000000000000) != 0ull ? 1 : 0;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
__host__ __device__ inline int isfinite(float x){
|
| 96 |
+
return !isnan(x) && !isinf(x);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
__host__ __device__ inline int isfinite(double x){
|
| 100 |
+
return !isnan(x) && !isinf(x);
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
#else
|
| 104 |
+
|
| 105 |
+
# if defined(__CUDACC__) && !(defined(__CUDA__) && defined(__clang__)) && !defined(_NVHPC_CUDA)
|
| 106 |
+
// NVCC implements at least some signature of these as functions not macros.
|
| 107 |
+
using ::isinf;
|
| 108 |
+
using ::isnan;
|
| 109 |
+
using ::signbit;
|
| 110 |
+
using ::isfinite;
|
| 111 |
+
# else
|
| 112 |
+
// Some compilers do not provide these in the global scope, because they are
|
| 113 |
+
// supposed to be macros. The versions in `std` are supposed to be functions.
|
| 114 |
+
// Since we're not compiling with nvcc, it's safe to use the functions in std::
|
| 115 |
+
using std::isinf;
|
| 116 |
+
using std::isnan;
|
| 117 |
+
using std::signbit;
|
| 118 |
+
using std::isfinite;
|
| 119 |
+
# endif // __CUDACC__
|
| 120 |
+
#endif // _MSC_VER
|
| 121 |
+
|
| 122 |
+
using ::atanh;
|
| 123 |
+
|
| 124 |
+
#if defined _MSC_VER
|
| 125 |
+
|
| 126 |
+
__host__ __device__ inline double copysign(double x, double y){
|
| 127 |
+
uint32_t hx,hy;
|
| 128 |
+
get_high_word(hx,x);
|
| 129 |
+
get_high_word(hy,y);
|
| 130 |
+
set_high_word(x,(hx&0x7fffffff)|(hy&0x80000000));
|
| 131 |
+
return x;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
__host__ __device__ inline float copysignf(float x, float y){
|
| 135 |
+
uint32_t ix,iy;
|
| 136 |
+
get_float_word(ix,x);
|
| 137 |
+
get_float_word(iy,y);
|
| 138 |
+
set_float_word(x,(ix&0x7fffffff)|(iy&0x80000000));
|
| 139 |
+
return x;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
#if !defined(__CUDACC__) && !defined(_NVHPC_CUDA)
|
| 145 |
+
|
| 146 |
+
// Simple approximation to log1p as Visual Studio is lacking one
|
| 147 |
+
inline double log1p(double x){
|
| 148 |
+
double u = 1.0+x;
|
| 149 |
+
if(u == 1.0){
|
| 150 |
+
return x;
|
| 151 |
+
}else{
|
| 152 |
+
if(u > 2.0){
|
| 153 |
+
// Use normal log for large arguments
|
| 154 |
+
return log(u);
|
| 155 |
+
}else{
|
| 156 |
+
return log(u)*(x/(u-1.0));
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
inline float log1pf(float x){
|
| 162 |
+
float u = 1.0f+x;
|
| 163 |
+
if(u == 1.0f){
|
| 164 |
+
return x;
|
| 165 |
+
}else{
|
| 166 |
+
if(u > 2.0f){
|
| 167 |
+
// Use normal log for large arguments
|
| 168 |
+
return logf(u);
|
| 169 |
+
}else{
|
| 170 |
+
return logf(u)*(x/(u-1.0f));
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
#if _MSV_VER <= 1500
|
| 176 |
+
#include <complex>
|
| 177 |
+
|
| 178 |
+
inline float hypotf(float x, float y){
|
| 179 |
+
return abs(std::complex<float>(x,y));
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
inline double hypot(double x, double y){
|
| 183 |
+
return _hypot(x,y);
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
#endif // _MSC_VER <= 1500
|
| 187 |
+
|
| 188 |
+
#endif // __CUDACC__
|
| 189 |
+
|
| 190 |
+
#endif // _MSC_VER
|
| 191 |
+
|
| 192 |
+
} // namespace complex
|
| 193 |
+
|
| 194 |
+
} // namespace detail
|
| 195 |
+
|
| 196 |
+
THRUST_NAMESPACE_END
|
| 197 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/catrig.h
ADDED
|
@@ -0,0 +1,785 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* Adapted from FreeBSD by Filipe Maia <filipe.c.maia@gmail.com>:
|
| 46 |
+
* freebsd/lib/msun/src/catrig.c
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#pragma once
|
| 50 |
+
|
| 51 |
+
#include <thrust/detail/config.h>
|
| 52 |
+
#include <thrust/complex.h>
|
| 53 |
+
#include <thrust/detail/complex/math_private.h>
|
| 54 |
+
#include <cfloat>
|
| 55 |
+
#include <cmath>
|
| 56 |
+
|
| 57 |
+
THRUST_NAMESPACE_BEGIN
|
| 58 |
+
namespace detail{
|
| 59 |
+
namespace complex{
|
| 60 |
+
|
| 61 |
+
using thrust::complex;
|
| 62 |
+
|
| 63 |
+
__host__ __device__
|
| 64 |
+
inline void raise_inexact(){
|
| 65 |
+
const volatile float tiny = 7.888609052210118054117286e-31; /* 0x1p-100; */
|
| 66 |
+
// needs the volatile to prevent compiler from ignoring it
|
| 67 |
+
volatile float junk = 1 + tiny;
|
| 68 |
+
(void)junk;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
__host__ __device__ inline complex<double> clog_for_large_values(complex<double> z);
|
| 72 |
+
|
| 73 |
+
/*
|
| 74 |
+
* Testing indicates that all these functions are accurate up to 4 ULP.
|
| 75 |
+
* The functions casin(h) and cacos(h) are about 2.5 times slower than asinh.
|
| 76 |
+
* The functions catan(h) are a little under 2 times slower than atanh.
|
| 77 |
+
*
|
| 78 |
+
* The code for casinh, casin, cacos, and cacosh comes first. The code is
|
| 79 |
+
* rather complicated, and the four functions are highly interdependent.
|
| 80 |
+
*
|
| 81 |
+
* The code for catanh and catan comes at the end. It is much simpler than
|
| 82 |
+
* the other functions, and the code for these can be disconnected from the
|
| 83 |
+
* rest of the code.
|
| 84 |
+
*/
|
| 85 |
+
|
| 86 |
+
/*
|
| 87 |
+
* ================================
|
| 88 |
+
* | casinh, casin, cacos, cacosh |
|
| 89 |
+
* ================================
|
| 90 |
+
*/
|
| 91 |
+
|
| 92 |
+
/*
|
| 93 |
+
* The algorithm is very close to that in "Implementing the complex arcsine
|
| 94 |
+
* and arccosine functions using exception handling" by T. E. Hull, Thomas F.
|
| 95 |
+
* Fairgrieve, and Ping Tak Peter Tang, published in ACM Transactions on
|
| 96 |
+
* Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335,
|
| 97 |
+
* http://dl.acm.org/citation.cfm?id=275324.
|
| 98 |
+
*
|
| 99 |
+
* Throughout we use the convention z = x + I*y.
|
| 100 |
+
*
|
| 101 |
+
* casinh(z) = sign(x)*log(A+sqrt(A*A-1)) + I*asin(B)
|
| 102 |
+
* where
|
| 103 |
+
* A = (|z+I| + |z-I|) / 2
|
| 104 |
+
* B = (|z+I| - |z-I|) / 2 = y/A
|
| 105 |
+
*
|
| 106 |
+
* These formulas become numerically unstable:
|
| 107 |
+
* (a) for Re(casinh(z)) when z is close to the line segment [-I, I] (that
|
| 108 |
+
* is, Re(casinh(z)) is close to 0);
|
| 109 |
+
* (b) for Im(casinh(z)) when z is close to either of the intervals
|
| 110 |
+
* [I, I*infinity) or (-I*infinity, -I] (that is, |Im(casinh(z))| is
|
| 111 |
+
* close to PI/2).
|
| 112 |
+
*
|
| 113 |
+
* These numerical problems are overcome by defining
|
| 114 |
+
* f(a, b) = (hypot(a, b) - b) / 2 = a*a / (hypot(a, b) + b) / 2
|
| 115 |
+
* Then if A < A_crossover, we use
|
| 116 |
+
* log(A + sqrt(A*A-1)) = log1p((A-1) + sqrt((A-1)*(A+1)))
|
| 117 |
+
* A-1 = f(x, 1+y) + f(x, 1-y)
|
| 118 |
+
* and if B > B_crossover, we use
|
| 119 |
+
* asin(B) = atan2(y, sqrt(A*A - y*y)) = atan2(y, sqrt((A+y)*(A-y)))
|
| 120 |
+
* A-y = f(x, y+1) + f(x, y-1)
|
| 121 |
+
* where without loss of generality we have assumed that x and y are
|
| 122 |
+
* non-negative.
|
| 123 |
+
*
|
| 124 |
+
* Much of the difficulty comes because the intermediate computations may
|
| 125 |
+
* produce overflows or underflows. This is dealt with in the paper by Hull
|
| 126 |
+
* et al by using exception handling. We do this by detecting when
|
| 127 |
+
* computations risk underflow or overflow. The hardest part is handling the
|
| 128 |
+
* underflows when computing f(a, b).
|
| 129 |
+
*
|
| 130 |
+
* Note that the function f(a, b) does not appear explicitly in the paper by
|
| 131 |
+
* Hull et al, but the idea may be found on pages 308 and 309. Introducing the
|
| 132 |
+
* function f(a, b) allows us to concentrate many of the clever tricks in this
|
| 133 |
+
* paper into one function.
|
| 134 |
+
*/
|
| 135 |
+
|
| 136 |
+
/*
|
| 137 |
+
* Function f(a, b, hypot_a_b) = (hypot(a, b) - b) / 2.
|
| 138 |
+
* Pass hypot(a, b) as the third argument.
|
| 139 |
+
*/
|
| 140 |
+
__host__ __device__
|
| 141 |
+
inline double
|
| 142 |
+
f(double a, double b, double hypot_a_b)
|
| 143 |
+
{
|
| 144 |
+
if (b < 0)
|
| 145 |
+
return ((hypot_a_b - b) / 2);
|
| 146 |
+
if (b == 0)
|
| 147 |
+
return (a / 2);
|
| 148 |
+
return (a * a / (hypot_a_b + b) / 2);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/*
|
| 152 |
+
* All the hard work is contained in this function.
|
| 153 |
+
* x and y are assumed positive or zero, and less than RECIP_EPSILON.
|
| 154 |
+
* Upon return:
|
| 155 |
+
* rx = Re(casinh(z)) = -Im(cacos(y + I*x)).
|
| 156 |
+
* B_is_usable is set to 1 if the value of B is usable.
|
| 157 |
+
* If B_is_usable is set to 0, sqrt_A2my2 = sqrt(A*A - y*y), and new_y = y.
|
| 158 |
+
* If returning sqrt_A2my2 has potential to result in an underflow, it is
|
| 159 |
+
* rescaled, and new_y is similarly rescaled.
|
| 160 |
+
*/
|
| 161 |
+
__host__ __device__
|
| 162 |
+
inline void
|
| 163 |
+
do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B,
|
| 164 |
+
double *sqrt_A2my2, double *new_y)
|
| 165 |
+
{
|
| 166 |
+
double R, S, A; /* A, B, R, and S are as in Hull et al. */
|
| 167 |
+
double Am1, Amy; /* A-1, A-y. */
|
| 168 |
+
const double A_crossover = 10; /* Hull et al suggest 1.5, but 10 works better */
|
| 169 |
+
const double FOUR_SQRT_MIN = 5.966672584960165394632772e-154; /* =0x1p-509; >= 4 * sqrt(DBL_MIN) */
|
| 170 |
+
const double B_crossover = 0.6417; /* suggested by Hull et al */
|
| 171 |
+
|
| 172 |
+
R = hypot(x, y + 1); /* |z+I| */
|
| 173 |
+
S = hypot(x, y - 1); /* |z-I| */
|
| 174 |
+
|
| 175 |
+
/* A = (|z+I| + |z-I|) / 2 */
|
| 176 |
+
A = (R + S) / 2;
|
| 177 |
+
/*
|
| 178 |
+
* Mathematically A >= 1. There is a small chance that this will not
|
| 179 |
+
* be so because of rounding errors. So we will make certain it is
|
| 180 |
+
* so.
|
| 181 |
+
*/
|
| 182 |
+
if (A < 1)
|
| 183 |
+
A = 1;
|
| 184 |
+
|
| 185 |
+
if (A < A_crossover) {
|
| 186 |
+
/*
|
| 187 |
+
* Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x, 1-y).
|
| 188 |
+
* rx = log1p(Am1 + sqrt(Am1*(A+1)))
|
| 189 |
+
*/
|
| 190 |
+
if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) {
|
| 191 |
+
/*
|
| 192 |
+
* fp is of order x^2, and fm = x/2.
|
| 193 |
+
* A = 1 (inexactly).
|
| 194 |
+
*/
|
| 195 |
+
*rx = sqrt(x);
|
| 196 |
+
} else if (x >= DBL_EPSILON * fabs(y - 1)) {
|
| 197 |
+
/*
|
| 198 |
+
* Underflow will not occur because
|
| 199 |
+
* x >= DBL_EPSILON^2/128 >= FOUR_SQRT_MIN
|
| 200 |
+
*/
|
| 201 |
+
Am1 = f(x, 1 + y, R) + f(x, 1 - y, S);
|
| 202 |
+
*rx = log1p(Am1 + sqrt(Am1 * (A + 1)));
|
| 203 |
+
} else if (y < 1) {
|
| 204 |
+
/*
|
| 205 |
+
* fp = x*x/(1+y)/4, fm = x*x/(1-y)/4, and
|
| 206 |
+
* A = 1 (inexactly).
|
| 207 |
+
*/
|
| 208 |
+
*rx = x / sqrt((1 - y) * (1 + y));
|
| 209 |
+
} else { /* if (y > 1) */
|
| 210 |
+
/*
|
| 211 |
+
* A-1 = y-1 (inexactly).
|
| 212 |
+
*/
|
| 213 |
+
*rx = log1p((y - 1) + sqrt((y - 1) * (y + 1)));
|
| 214 |
+
}
|
| 215 |
+
} else {
|
| 216 |
+
*rx = log(A + sqrt(A * A - 1));
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
*new_y = y;
|
| 220 |
+
|
| 221 |
+
if (y < FOUR_SQRT_MIN) {
|
| 222 |
+
/*
|
| 223 |
+
* Avoid a possible underflow caused by y/A. For casinh this
|
| 224 |
+
* would be legitimate, but will be picked up by invoking atan2
|
| 225 |
+
* later on. For cacos this would not be legitimate.
|
| 226 |
+
*/
|
| 227 |
+
*B_is_usable = 0;
|
| 228 |
+
*sqrt_A2my2 = A * (2 / DBL_EPSILON);
|
| 229 |
+
*new_y = y * (2 / DBL_EPSILON);
|
| 230 |
+
return;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/* B = (|z+I| - |z-I|) / 2 = y/A */
|
| 234 |
+
*B = y / A;
|
| 235 |
+
*B_is_usable = 1;
|
| 236 |
+
|
| 237 |
+
if (*B > B_crossover) {
|
| 238 |
+
*B_is_usable = 0;
|
| 239 |
+
/*
|
| 240 |
+
* Amy = fp + fm, where fp = f(x, y+1), and fm = f(x, y-1).
|
| 241 |
+
* sqrt_A2my2 = sqrt(Amy*(A+y))
|
| 242 |
+
*/
|
| 243 |
+
if (y == 1 && x < DBL_EPSILON / 128) {
|
| 244 |
+
/*
|
| 245 |
+
* fp is of order x^2, and fm = x/2.
|
| 246 |
+
* A = 1 (inexactly).
|
| 247 |
+
*/
|
| 248 |
+
*sqrt_A2my2 = sqrt(x) * sqrt((A + y) / 2);
|
| 249 |
+
} else if (x >= DBL_EPSILON * fabs(y - 1)) {
|
| 250 |
+
/*
|
| 251 |
+
* Underflow will not occur because
|
| 252 |
+
* x >= DBL_EPSILON/128 >= FOUR_SQRT_MIN
|
| 253 |
+
* and
|
| 254 |
+
* x >= DBL_EPSILON^2 >= FOUR_SQRT_MIN
|
| 255 |
+
*/
|
| 256 |
+
Amy = f(x, y + 1, R) + f(x, y - 1, S);
|
| 257 |
+
*sqrt_A2my2 = sqrt(Amy * (A + y));
|
| 258 |
+
} else if (y > 1) {
|
| 259 |
+
/*
|
| 260 |
+
* fp = x*x/(y+1)/4, fm = x*x/(y-1)/4, and
|
| 261 |
+
* A = y (inexactly).
|
| 262 |
+
*
|
| 263 |
+
* y < RECIP_EPSILON. So the following
|
| 264 |
+
* scaling should avoid any underflow problems.
|
| 265 |
+
*/
|
| 266 |
+
*sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON) * y /
|
| 267 |
+
sqrt((y + 1) * (y - 1));
|
| 268 |
+
*new_y = y * (4 / DBL_EPSILON / DBL_EPSILON);
|
| 269 |
+
} else { /* if (y < 1) */
|
| 270 |
+
/*
|
| 271 |
+
* fm = 1-y >= DBL_EPSILON, fp is of order x^2, and
|
| 272 |
+
* A = 1 (inexactly).
|
| 273 |
+
*/
|
| 274 |
+
*sqrt_A2my2 = sqrt((1 - y) * (1 + y));
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/*
|
| 280 |
+
* casinh(z) = z + O(z^3) as z -> 0
|
| 281 |
+
*
|
| 282 |
+
* casinh(z) = sign(x)*clog(sign(x)*z) + O(1/z^2) as z -> infinity
|
| 283 |
+
* The above formula works for the imaginary part as well, because
|
| 284 |
+
* Im(casinh(z)) = sign(x)*atan2(sign(x)*y, fabs(x)) + O(y/z^3)
|
| 285 |
+
* as z -> infinity, uniformly in y
|
| 286 |
+
*/
|
| 287 |
+
__host__ __device__ inline
|
| 288 |
+
complex<double> casinh(complex<double> z)
|
| 289 |
+
{
|
| 290 |
+
double x, y, ax, ay, rx, ry, B, sqrt_A2my2, new_y;
|
| 291 |
+
int B_is_usable;
|
| 292 |
+
complex<double> w;
|
| 293 |
+
const double RECIP_EPSILON = 1.0 / DBL_EPSILON;
|
| 294 |
+
const double m_ln2 = 6.9314718055994531e-1; /* 0x162e42fefa39ef.0p-53 */
|
| 295 |
+
x = z.real();
|
| 296 |
+
y = z.imag();
|
| 297 |
+
ax = fabs(x);
|
| 298 |
+
ay = fabs(y);
|
| 299 |
+
|
| 300 |
+
if (isnan(x) || isnan(y)) {
|
| 301 |
+
/* casinh(+-Inf + I*NaN) = +-Inf + I*NaN */
|
| 302 |
+
if (isinf(x))
|
| 303 |
+
return (complex<double>(x, y + y));
|
| 304 |
+
/* casinh(NaN + I*+-Inf) = opt(+-)Inf + I*NaN */
|
| 305 |
+
if (isinf(y))
|
| 306 |
+
return (complex<double>(y, x + x));
|
| 307 |
+
/* casinh(NaN + I*0) = NaN + I*0 */
|
| 308 |
+
if (y == 0)
|
| 309 |
+
return (complex<double>(x + x, y));
|
| 310 |
+
/*
|
| 311 |
+
* All other cases involving NaN return NaN + I*NaN.
|
| 312 |
+
* C99 leaves it optional whether to raise invalid if one of
|
| 313 |
+
* the arguments is not NaN, so we opt not to raise it.
|
| 314 |
+
*/
|
| 315 |
+
return (complex<double>(x + 0.0 + (y + 0.0), x + 0.0 + (y + 0.0)));
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
| 319 |
+
/* clog...() will raise inexact unless x or y is infinite. */
|
| 320 |
+
if (signbit(x) == 0)
|
| 321 |
+
w = clog_for_large_values(z) + m_ln2;
|
| 322 |
+
else
|
| 323 |
+
w = clog_for_large_values(-z) + m_ln2;
|
| 324 |
+
return (complex<double>(copysign(w.real(), x), copysign(w.imag(), y)));
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
/* Avoid spuriously raising inexact for z = 0. */
|
| 328 |
+
if (x == 0 && y == 0)
|
| 329 |
+
return (z);
|
| 330 |
+
|
| 331 |
+
/* All remaining cases are inexact. */
|
| 332 |
+
raise_inexact();
|
| 333 |
+
|
| 334 |
+
const double SQRT_6_EPSILON = 3.6500241499888571e-8; /* 0x13988e1409212e.0p-77 */
|
| 335 |
+
if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
|
| 336 |
+
return (z);
|
| 337 |
+
|
| 338 |
+
do_hard_work(ax, ay, &rx, &B_is_usable, &B, &sqrt_A2my2, &new_y);
|
| 339 |
+
if (B_is_usable)
|
| 340 |
+
ry = asin(B);
|
| 341 |
+
else
|
| 342 |
+
ry = atan2(new_y, sqrt_A2my2);
|
| 343 |
+
return (complex<double>(copysign(rx, x), copysign(ry, y)));
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
/*
|
| 347 |
+
* casin(z) = reverse(casinh(reverse(z)))
|
| 348 |
+
* where reverse(x + I*y) = y + I*x = I*conj(z).
|
| 349 |
+
*/
|
| 350 |
+
__host__ __device__ inline
|
| 351 |
+
complex<double> casin(complex<double> z)
|
| 352 |
+
{
|
| 353 |
+
complex<double> w = casinh(complex<double>(z.imag(), z.real()));
|
| 354 |
+
|
| 355 |
+
return (complex<double>(w.imag(), w.real()));
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
/*
|
| 359 |
+
* cacos(z) = PI/2 - casin(z)
|
| 360 |
+
* but do the computation carefully so cacos(z) is accurate when z is
|
| 361 |
+
* close to 1.
|
| 362 |
+
*
|
| 363 |
+
* cacos(z) = PI/2 - z + O(z^3) as z -> 0
|
| 364 |
+
*
|
| 365 |
+
* cacos(z) = -sign(y)*I*clog(z) + O(1/z^2) as z -> infinity
|
| 366 |
+
* The above formula works for the real part as well, because
|
| 367 |
+
* Re(cacos(z)) = atan2(fabs(y), x) + O(y/z^3)
|
| 368 |
+
* as z -> infinity, uniformly in y
|
| 369 |
+
*/
|
| 370 |
+
__host__ __device__ inline
|
| 371 |
+
complex<double> cacos(complex<double> z)
|
| 372 |
+
{
|
| 373 |
+
double x, y, ax, ay, rx, ry, B, sqrt_A2mx2, new_x;
|
| 374 |
+
int sx, sy;
|
| 375 |
+
int B_is_usable;
|
| 376 |
+
complex<double> w;
|
| 377 |
+
const double pio2_hi = 1.5707963267948966e0; /* 0x1921fb54442d18.0p-52 */
|
| 378 |
+
const volatile double pio2_lo = 6.1232339957367659e-17; /* 0x11a62633145c07.0p-106 */
|
| 379 |
+
const double m_ln2 = 6.9314718055994531e-1; /* 0x162e42fefa39ef.0p-53 */
|
| 380 |
+
|
| 381 |
+
x = z.real();
|
| 382 |
+
y = z.imag();
|
| 383 |
+
sx = signbit(x);
|
| 384 |
+
sy = signbit(y);
|
| 385 |
+
ax = fabs(x);
|
| 386 |
+
ay = fabs(y);
|
| 387 |
+
|
| 388 |
+
if (isnan(x) || isnan(y)) {
|
| 389 |
+
/* cacos(+-Inf + I*NaN) = NaN + I*opt(-)Inf */
|
| 390 |
+
if (isinf(x))
|
| 391 |
+
return (complex<double>(y + y, -infinity<double>()));
|
| 392 |
+
/* cacos(NaN + I*+-Inf) = NaN + I*-+Inf */
|
| 393 |
+
if (isinf(y))
|
| 394 |
+
return (complex<double>(x + x, -y));
|
| 395 |
+
/* cacos(0 + I*NaN) = PI/2 + I*NaN with inexact */
|
| 396 |
+
if (x == 0)
|
| 397 |
+
return (complex<double>(pio2_hi + pio2_lo, y + y));
|
| 398 |
+
/*
|
| 399 |
+
* All other cases involving NaN return NaN + I*NaN.
|
| 400 |
+
* C99 leaves it optional whether to raise invalid if one of
|
| 401 |
+
* the arguments is not NaN, so we opt not to raise it.
|
| 402 |
+
*/
|
| 403 |
+
return (complex<double>(x + 0.0 + (y + 0), x + 0.0 + (y + 0)));
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
const double RECIP_EPSILON = 1.0 / DBL_EPSILON;
|
| 407 |
+
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
| 408 |
+
/* clog...() will raise inexact unless x or y is infinite. */
|
| 409 |
+
w = clog_for_large_values(z);
|
| 410 |
+
rx = fabs(w.imag());
|
| 411 |
+
ry = w.real() + m_ln2;
|
| 412 |
+
if (sy == 0)
|
| 413 |
+
ry = -ry;
|
| 414 |
+
return (complex<double>(rx, ry));
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
/* Avoid spuriously raising inexact for z = 1. */
|
| 418 |
+
if (x == 1.0 && y == 0.0)
|
| 419 |
+
return (complex<double>(0, -y));
|
| 420 |
+
|
| 421 |
+
/* All remaining cases are inexact. */
|
| 422 |
+
raise_inexact();
|
| 423 |
+
|
| 424 |
+
const double SQRT_6_EPSILON = 3.6500241499888571e-8; /* 0x13988e1409212e.0p-77 */
|
| 425 |
+
if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
|
| 426 |
+
return (complex<double>(pio2_hi - (x - pio2_lo), -y));
|
| 427 |
+
|
| 428 |
+
do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x);
|
| 429 |
+
if (B_is_usable) {
|
| 430 |
+
if (sx == 0)
|
| 431 |
+
rx = acos(B);
|
| 432 |
+
else
|
| 433 |
+
rx = acos(-B);
|
| 434 |
+
} else {
|
| 435 |
+
if (sx == 0)
|
| 436 |
+
rx = atan2(sqrt_A2mx2, new_x);
|
| 437 |
+
else
|
| 438 |
+
rx = atan2(sqrt_A2mx2, -new_x);
|
| 439 |
+
}
|
| 440 |
+
if (sy == 0)
|
| 441 |
+
ry = -ry;
|
| 442 |
+
return (complex<double>(rx, ry));
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
/*
|
| 446 |
+
* cacosh(z) = I*cacos(z) or -I*cacos(z)
|
| 447 |
+
* where the sign is chosen so Re(cacosh(z)) >= 0.
|
| 448 |
+
*/
|
| 449 |
+
__host__ __device__ inline
|
| 450 |
+
complex<double> cacosh(complex<double> z)
|
| 451 |
+
{
|
| 452 |
+
complex<double> w;
|
| 453 |
+
double rx, ry;
|
| 454 |
+
|
| 455 |
+
w = cacos(z);
|
| 456 |
+
rx = w.real();
|
| 457 |
+
ry = w.imag();
|
| 458 |
+
/* cacosh(NaN + I*NaN) = NaN + I*NaN */
|
| 459 |
+
if (isnan(rx) && isnan(ry))
|
| 460 |
+
return (complex<double>(ry, rx));
|
| 461 |
+
/* cacosh(NaN + I*+-Inf) = +Inf + I*NaN */
|
| 462 |
+
/* cacosh(+-Inf + I*NaN) = +Inf + I*NaN */
|
| 463 |
+
if (isnan(rx))
|
| 464 |
+
return (complex<double>(fabs(ry), rx));
|
| 465 |
+
/* cacosh(0 + I*NaN) = NaN + I*NaN */
|
| 466 |
+
if (isnan(ry))
|
| 467 |
+
return (complex<double>(ry, ry));
|
| 468 |
+
return (complex<double>(fabs(ry), copysign(rx, z.imag())));
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
/*
|
| 472 |
+
* Optimized version of clog() for |z| finite and larger than ~RECIP_EPSILON.
|
| 473 |
+
*/
|
| 474 |
+
__host__ __device__ inline
|
| 475 |
+
complex<double> clog_for_large_values(complex<double> z)
|
| 476 |
+
{
|
| 477 |
+
double x, y;
|
| 478 |
+
double ax, ay, t;
|
| 479 |
+
const double m_e = 2.7182818284590452e0; /* 0x15bf0a8b145769.0p-51 */
|
| 480 |
+
|
| 481 |
+
x = z.real();
|
| 482 |
+
y = z.imag();
|
| 483 |
+
ax = fabs(x);
|
| 484 |
+
ay = fabs(y);
|
| 485 |
+
if (ax < ay) {
|
| 486 |
+
t = ax;
|
| 487 |
+
ax = ay;
|
| 488 |
+
ay = t;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
/*
|
| 492 |
+
* Avoid overflow in hypot() when x and y are both very large.
|
| 493 |
+
* Divide x and y by E, and then add 1 to the logarithm. This depends
|
| 494 |
+
* on E being larger than sqrt(2).
|
| 495 |
+
* Dividing by E causes an insignificant loss of accuracy; however
|
| 496 |
+
* this method is still poor since it is uneccessarily slow.
|
| 497 |
+
*/
|
| 498 |
+
if (ax > DBL_MAX / 2)
|
| 499 |
+
return (complex<double>(log(hypot(x / m_e, y / m_e)) + 1, atan2(y, x)));
|
| 500 |
+
|
| 501 |
+
/*
|
| 502 |
+
* Avoid overflow when x or y is large. Avoid underflow when x or
|
| 503 |
+
* y is small.
|
| 504 |
+
*/
|
| 505 |
+
const double QUARTER_SQRT_MAX = 5.966672584960165394632772e-154; /* = 0x1p509; <= sqrt(DBL_MAX) / 4 */
|
| 506 |
+
const double SQRT_MIN = 1.491668146240041348658193e-154; /* = 0x1p-511; >= sqrt(DBL_MIN) */
|
| 507 |
+
if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN)
|
| 508 |
+
return (complex<double>(log(hypot(x, y)), atan2(y, x)));
|
| 509 |
+
|
| 510 |
+
return (complex<double>(log(ax * ax + ay * ay) / 2, atan2(y, x)));
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
/*
|
| 514 |
+
* =================
|
| 515 |
+
* | catanh, catan |
|
| 516 |
+
* =================
|
| 517 |
+
*/
|
| 518 |
+
|
| 519 |
+
/*
|
| 520 |
+
* sum_squares(x,y) = x*x + y*y (or just x*x if y*y would underflow).
|
| 521 |
+
* Assumes x*x and y*y will not overflow.
|
| 522 |
+
* Assumes x and y are finite.
|
| 523 |
+
* Assumes y is non-negative.
|
| 524 |
+
* Assumes fabs(x) >= DBL_EPSILON.
|
| 525 |
+
*/
|
| 526 |
+
__host__ __device__
|
| 527 |
+
inline double sum_squares(double x, double y)
|
| 528 |
+
{
|
| 529 |
+
const double SQRT_MIN = 1.491668146240041348658193e-154; /* = 0x1p-511; >= sqrt(DBL_MIN) */
|
| 530 |
+
/* Avoid underflow when y is small. */
|
| 531 |
+
if (y < SQRT_MIN)
|
| 532 |
+
return (x * x);
|
| 533 |
+
|
| 534 |
+
return (x * x + y * y);
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
/*
|
| 538 |
+
* real_part_reciprocal(x, y) = Re(1/(x+I*y)) = x/(x*x + y*y).
|
| 539 |
+
* Assumes x and y are not NaN, and one of x and y is larger than
|
| 540 |
+
* RECIP_EPSILON. We avoid unwarranted underflow. It is important to not use
|
| 541 |
+
* the code creal(1/z), because the imaginary part may produce an unwanted
|
| 542 |
+
* underflow.
|
| 543 |
+
* This is only called in a context where inexact is always raised before
|
| 544 |
+
* the call, so no effort is made to avoid or force inexact.
|
| 545 |
+
*/
|
| 546 |
+
__host__ __device__
|
| 547 |
+
inline double real_part_reciprocal(double x, double y)
|
| 548 |
+
{
|
| 549 |
+
double scale;
|
| 550 |
+
uint32_t hx, hy;
|
| 551 |
+
int32_t ix, iy;
|
| 552 |
+
|
| 553 |
+
/*
|
| 554 |
+
* This code is inspired by the C99 document n1124.pdf, Section G.5.1,
|
| 555 |
+
* example 2.
|
| 556 |
+
*/
|
| 557 |
+
get_high_word(hx, x);
|
| 558 |
+
ix = hx & 0x7ff00000;
|
| 559 |
+
get_high_word(hy, y);
|
| 560 |
+
iy = hy & 0x7ff00000;
|
| 561 |
+
//#define BIAS (DBL_MAX_EXP - 1)
|
| 562 |
+
const int BIAS = DBL_MAX_EXP - 1;
|
| 563 |
+
/* XXX more guard digits are useful iff there is extra precision. */
|
| 564 |
+
//#define CUTOFF (DBL_MANT_DIG / 2 + 1) /* just half or 1 guard digit */
|
| 565 |
+
const int CUTOFF = (DBL_MANT_DIG / 2 + 1);
|
| 566 |
+
if (ix - iy >= CUTOFF << 20 || isinf(x))
|
| 567 |
+
return (1 / x); /* +-Inf -> +-0 is special */
|
| 568 |
+
if (iy - ix >= CUTOFF << 20)
|
| 569 |
+
return (x / y / y); /* should avoid double div, but hard */
|
| 570 |
+
if (ix <= (BIAS + DBL_MAX_EXP / 2 - CUTOFF) << 20)
|
| 571 |
+
return (x / (x * x + y * y));
|
| 572 |
+
scale = 1;
|
| 573 |
+
set_high_word(scale, 0x7ff00000 - ix); /* 2**(1-ilogb(x)) */
|
| 574 |
+
x *= scale;
|
| 575 |
+
y *= scale;
|
| 576 |
+
return (x / (x * x + y * y) * scale);
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
/*
|
| 581 |
+
* catanh(z) = log((1+z)/(1-z)) / 2
|
| 582 |
+
* = log1p(4*x / |z-1|^2) / 4
|
| 583 |
+
* + I * atan2(2*y, (1-x)*(1+x)-y*y) / 2
|
| 584 |
+
*
|
| 585 |
+
* catanh(z) = z + O(z^3) as z -> 0
|
| 586 |
+
*
|
| 587 |
+
* catanh(z) = 1/z + sign(y)*I*PI/2 + O(1/z^3) as z -> infinity
|
| 588 |
+
* The above formula works for the real part as well, because
|
| 589 |
+
* Re(catanh(z)) = x/|z|^2 + O(x/z^4)
|
| 590 |
+
* as z -> infinity, uniformly in x
|
| 591 |
+
*/
|
| 592 |
+
#if THRUST_CPP_DIALECT >= 2011 || THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
|
| 593 |
+
__host__ __device__ inline
|
| 594 |
+
complex<double> catanh(complex<double> z)
|
| 595 |
+
{
|
| 596 |
+
double x, y, ax, ay, rx, ry;
|
| 597 |
+
const volatile double pio2_lo = 6.1232339957367659e-17; /* 0x11a62633145c07.0p-106 */
|
| 598 |
+
const double pio2_hi = 1.5707963267948966e0;/* 0x1921fb54442d18.0p-52 */
|
| 599 |
+
|
| 600 |
+
|
| 601 |
+
x = z.real();
|
| 602 |
+
y = z.imag();
|
| 603 |
+
ax = fabs(x);
|
| 604 |
+
ay = fabs(y);
|
| 605 |
+
|
| 606 |
+
/* This helps handle many cases. */
|
| 607 |
+
if (y == 0 && ax <= 1)
|
| 608 |
+
return (complex<double>(atanh(x), y));
|
| 609 |
+
|
| 610 |
+
/* To ensure the same accuracy as atan(), and to filter out z = 0. */
|
| 611 |
+
if (x == 0)
|
| 612 |
+
return (complex<double>(x, atan(y)));
|
| 613 |
+
|
| 614 |
+
if (isnan(x) || isnan(y)) {
|
| 615 |
+
/* catanh(+-Inf + I*NaN) = +-0 + I*NaN */
|
| 616 |
+
if (isinf(x))
|
| 617 |
+
return (complex<double>(copysign(0.0, x), y + y));
|
| 618 |
+
/* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */
|
| 619 |
+
if (isinf(y))
|
| 620 |
+
return (complex<double>(copysign(0.0, x),
|
| 621 |
+
copysign(pio2_hi + pio2_lo, y)));
|
| 622 |
+
/*
|
| 623 |
+
* All other cases involving NaN return NaN + I*NaN.
|
| 624 |
+
* C99 leaves it optional whether to raise invalid if one of
|
| 625 |
+
* the arguments is not NaN, so we opt not to raise it.
|
| 626 |
+
*/
|
| 627 |
+
return (complex<double>(x + 0.0 + (y + 0), x + 0.0 + (y + 0)));
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
const double RECIP_EPSILON = 1.0 / DBL_EPSILON;
|
| 631 |
+
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON)
|
| 632 |
+
return (complex<double>(real_part_reciprocal(x, y),
|
| 633 |
+
copysign(pio2_hi + pio2_lo, y)));
|
| 634 |
+
|
| 635 |
+
const double SQRT_3_EPSILON = 2.5809568279517849e-8; /* 0x1bb67ae8584caa.0p-78 */
|
| 636 |
+
if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) {
|
| 637 |
+
/*
|
| 638 |
+
* z = 0 was filtered out above. All other cases must raise
|
| 639 |
+
* inexact, but this is the only only that needs to do it
|
| 640 |
+
* explicitly.
|
| 641 |
+
*/
|
| 642 |
+
raise_inexact();
|
| 643 |
+
return (z);
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
const double m_ln2 = 6.9314718055994531e-1; /* 0x162e42fefa39ef.0p-53 */
|
| 647 |
+
if (ax == 1 && ay < DBL_EPSILON)
|
| 648 |
+
rx = (m_ln2 - log(ay)) / 2;
|
| 649 |
+
else
|
| 650 |
+
rx = log1p(4 * ax / sum_squares(ax - 1, ay)) / 4;
|
| 651 |
+
|
| 652 |
+
if (ax == 1)
|
| 653 |
+
ry = atan2(2.0, -ay) / 2;
|
| 654 |
+
else if (ay < DBL_EPSILON)
|
| 655 |
+
ry = atan2(2 * ay, (1 - ax) * (1 + ax)) / 2;
|
| 656 |
+
else
|
| 657 |
+
ry = atan2(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2;
|
| 658 |
+
|
| 659 |
+
return (complex<double>(copysign(rx, x), copysign(ry, y)));
|
| 660 |
+
}
|
| 661 |
+
|
| 662 |
+
/*
|
| 663 |
+
* catan(z) = reverse(catanh(reverse(z)))
|
| 664 |
+
* where reverse(x + I*y) = y + I*x = I*conj(z).
|
| 665 |
+
*/
|
| 666 |
+
__host__ __device__ inline
|
| 667 |
+
complex<double>catan(complex<double> z)
|
| 668 |
+
{
|
| 669 |
+
complex<double> w = catanh(complex<double>(z.imag(), z.real()));
|
| 670 |
+
return (complex<double>(w.imag(), w.real()));
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
#endif
|
| 674 |
+
|
| 675 |
+
} // namespace complex
|
| 676 |
+
|
| 677 |
+
} // namespace detail
|
| 678 |
+
|
| 679 |
+
|
| 680 |
+
template <typename ValueType>
|
| 681 |
+
__host__ __device__
|
| 682 |
+
inline complex<ValueType> acos(const complex<ValueType>& z){
|
| 683 |
+
const complex<ValueType> ret = thrust::asin(z);
|
| 684 |
+
const ValueType pi = ValueType(3.14159265358979323846);
|
| 685 |
+
return complex<ValueType>(pi/2 - ret.real(),-ret.imag());
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
|
| 689 |
+
template <typename ValueType>
|
| 690 |
+
__host__ __device__
|
| 691 |
+
inline complex<ValueType> asin(const complex<ValueType>& z){
|
| 692 |
+
const complex<ValueType> i(0,1);
|
| 693 |
+
return -i*asinh(i*z);
|
| 694 |
+
}
|
| 695 |
+
|
| 696 |
+
template <typename ValueType>
|
| 697 |
+
__host__ __device__
|
| 698 |
+
inline complex<ValueType> atan(const complex<ValueType>& z){
|
| 699 |
+
const complex<ValueType> i(0,1);
|
| 700 |
+
return -i*thrust::atanh(i*z);
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
|
| 704 |
+
template <typename ValueType>
|
| 705 |
+
__host__ __device__
|
| 706 |
+
inline complex<ValueType> acosh(const complex<ValueType>& z){
|
| 707 |
+
thrust::complex<ValueType> ret((z.real() - z.imag()) * (z.real() + z.imag()) - ValueType(1.0),
|
| 708 |
+
ValueType(2.0) * z.real() * z.imag());
|
| 709 |
+
ret = thrust::sqrt(ret);
|
| 710 |
+
if (z.real() < ValueType(0.0)){
|
| 711 |
+
ret = -ret;
|
| 712 |
+
}
|
| 713 |
+
ret += z;
|
| 714 |
+
ret = thrust::log(ret);
|
| 715 |
+
if (ret.real() < ValueType(0.0)){
|
| 716 |
+
ret = -ret;
|
| 717 |
+
}
|
| 718 |
+
return ret;
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
template <typename ValueType>
|
| 722 |
+
__host__ __device__
|
| 723 |
+
inline complex<ValueType> asinh(const complex<ValueType>& z){
|
| 724 |
+
return thrust::log(thrust::sqrt(z*z+ValueType(1))+z);
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
template <typename ValueType>
|
| 728 |
+
__host__ __device__
|
| 729 |
+
inline complex<ValueType> atanh(const complex<ValueType>& z){
|
| 730 |
+
ValueType imag2 = z.imag() * z.imag();
|
| 731 |
+
ValueType n = ValueType(1.0) + z.real();
|
| 732 |
+
n = imag2 + n * n;
|
| 733 |
+
|
| 734 |
+
ValueType d = ValueType(1.0) - z.real();
|
| 735 |
+
d = imag2 + d * d;
|
| 736 |
+
complex<ValueType> ret(ValueType(0.25) * (std::log(n) - std::log(d)),0);
|
| 737 |
+
|
| 738 |
+
d = ValueType(1.0) - z.real() * z.real() - imag2;
|
| 739 |
+
|
| 740 |
+
ret.imag(ValueType(0.5) * std::atan2(ValueType(2.0) * z.imag(), d));
|
| 741 |
+
return ret;
|
| 742 |
+
}
|
| 743 |
+
|
| 744 |
+
template <>
|
| 745 |
+
__host__ __device__
|
| 746 |
+
inline complex<double> acos(const complex<double>& z){
|
| 747 |
+
return detail::complex::cacos(z);
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
template <>
|
| 751 |
+
__host__ __device__
|
| 752 |
+
inline complex<double> asin(const complex<double>& z){
|
| 753 |
+
return detail::complex::casin(z);
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
#if THRUST_CPP_DIALECT >= 2011 || THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
|
| 757 |
+
template <>
|
| 758 |
+
__host__ __device__
|
| 759 |
+
inline complex<double> atan(const complex<double>& z){
|
| 760 |
+
return detail::complex::catan(z);
|
| 761 |
+
}
|
| 762 |
+
#endif
|
| 763 |
+
|
| 764 |
+
template <>
|
| 765 |
+
__host__ __device__
|
| 766 |
+
inline complex<double> acosh(const complex<double>& z){
|
| 767 |
+
return detail::complex::cacosh(z);
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
|
| 771 |
+
template <>
|
| 772 |
+
__host__ __device__
|
| 773 |
+
inline complex<double> asinh(const complex<double>& z){
|
| 774 |
+
return detail::complex::casinh(z);
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
#if THRUST_CPP_DIALECT >= 2011 || THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
|
| 778 |
+
template <>
|
| 779 |
+
__host__ __device__
|
| 780 |
+
inline complex<double> atanh(const complex<double>& z){
|
| 781 |
+
return detail::complex::catanh(z);
|
| 782 |
+
}
|
| 783 |
+
#endif
|
| 784 |
+
|
| 785 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/catrigf.h
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* Adapted from FreeBSD by Filipe Maia <filipe.c.maia@gmail.com>:
|
| 46 |
+
* freebsd/lib/msun/src/catrig.c
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#pragma once
|
| 50 |
+
|
| 51 |
+
#include <thrust/complex.h>
|
| 52 |
+
#include <thrust/detail/complex/math_private.h>
|
| 53 |
+
#include <thrust/detail/config.h>
|
| 54 |
+
#include <cfloat>
|
| 55 |
+
#include <cmath>
|
| 56 |
+
|
| 57 |
+
THRUST_NAMESPACE_BEGIN
|
| 58 |
+
namespace detail{
|
| 59 |
+
namespace complex{
|
| 60 |
+
|
| 61 |
+
using thrust::complex;
|
| 62 |
+
|
| 63 |
+
__host__ __device__ inline
|
| 64 |
+
complex<float> clog_for_large_values(complex<float> z);
|
| 65 |
+
|
| 66 |
+
/*
|
| 67 |
+
* The algorithm is very close to that in "Implementing the complex arcsine
|
| 68 |
+
* and arccosine functions using exception handling" by T. E. Hull, Thomas F.
|
| 69 |
+
* Fairgrieve, and Ping Tak Peter Tang, published in ACM Transactions on
|
| 70 |
+
* Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335,
|
| 71 |
+
* http://dl.acm.org/citation.cfm?id=275324.
|
| 72 |
+
*
|
| 73 |
+
* See catrig.c for complete comments.
|
| 74 |
+
*
|
| 75 |
+
* XXX comments were removed automatically, and even short ones on the right
|
| 76 |
+
* of statements were removed (all of them), contrary to normal style. Only
|
| 77 |
+
* a few comments on the right of declarations remain.
|
| 78 |
+
*/
|
| 79 |
+
|
| 80 |
+
__host__ __device__
|
| 81 |
+
inline float
|
| 82 |
+
f(float a, float b, float hypot_a_b)
|
| 83 |
+
{
|
| 84 |
+
if (b < 0.0f)
|
| 85 |
+
return ((hypot_a_b - b) / 2.0f);
|
| 86 |
+
if (b == 0.0f)
|
| 87 |
+
return (a / 2.0f);
|
| 88 |
+
return (a * a / (hypot_a_b + b) / 2.0f);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/*
|
| 92 |
+
* All the hard work is contained in this function.
|
| 93 |
+
* x and y are assumed positive or zero, and less than RECIP_EPSILON.
|
| 94 |
+
* Upon return:
|
| 95 |
+
* rx = Re(casinh(z)) = -Im(cacos(y + I*x)).
|
| 96 |
+
* B_is_usable is set to 1 if the value of B is usable.
|
| 97 |
+
* If B_is_usable is set to 0, sqrt_A2my2 = sqrt(A*A - y*y), and new_y = y.
|
| 98 |
+
* If returning sqrt_A2my2 has potential to result in an underflow, it is
|
| 99 |
+
* rescaled, and new_y is similarly rescaled.
|
| 100 |
+
*/
|
| 101 |
+
__host__ __device__
|
| 102 |
+
inline void
|
| 103 |
+
do_hard_work(float x, float y, float *rx, int *B_is_usable, float *B,
|
| 104 |
+
float *sqrt_A2my2, float *new_y)
|
| 105 |
+
{
|
| 106 |
+
float R, S, A; /* A, B, R, and S are as in Hull et al. */
|
| 107 |
+
float Am1, Amy; /* A-1, A-y. */
|
| 108 |
+
const float A_crossover = 10; /* Hull et al suggest 1.5, but 10 works better */
|
| 109 |
+
const float FOUR_SQRT_MIN = 4.336808689942017736029811e-19f;; /* =0x1p-61; >= 4 * sqrt(FLT_MIN) */
|
| 110 |
+
const float B_crossover = 0.6417f; /* suggested by Hull et al */
|
| 111 |
+
R = hypotf(x, y + 1);
|
| 112 |
+
S = hypotf(x, y - 1);
|
| 113 |
+
|
| 114 |
+
A = (R + S) / 2;
|
| 115 |
+
if (A < 1)
|
| 116 |
+
A = 1;
|
| 117 |
+
|
| 118 |
+
if (A < A_crossover) {
|
| 119 |
+
if (y == 1 && x < FLT_EPSILON * FLT_EPSILON / 128) {
|
| 120 |
+
*rx = sqrtf(x);
|
| 121 |
+
} else if (x >= FLT_EPSILON * fabsf(y - 1)) {
|
| 122 |
+
Am1 = f(x, 1 + y, R) + f(x, 1 - y, S);
|
| 123 |
+
*rx = log1pf(Am1 + sqrtf(Am1 * (A + 1)));
|
| 124 |
+
} else if (y < 1) {
|
| 125 |
+
*rx = x / sqrtf((1 - y) * (1 + y));
|
| 126 |
+
} else {
|
| 127 |
+
*rx = log1pf((y - 1) + sqrtf((y - 1) * (y + 1)));
|
| 128 |
+
}
|
| 129 |
+
} else {
|
| 130 |
+
*rx = logf(A + sqrtf(A * A - 1));
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
*new_y = y;
|
| 134 |
+
|
| 135 |
+
if (y < FOUR_SQRT_MIN) {
|
| 136 |
+
*B_is_usable = 0;
|
| 137 |
+
*sqrt_A2my2 = A * (2 / FLT_EPSILON);
|
| 138 |
+
*new_y = y * (2 / FLT_EPSILON);
|
| 139 |
+
return;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
*B = y / A;
|
| 143 |
+
*B_is_usable = 1;
|
| 144 |
+
|
| 145 |
+
if (*B > B_crossover) {
|
| 146 |
+
*B_is_usable = 0;
|
| 147 |
+
if (y == 1 && x < FLT_EPSILON / 128) {
|
| 148 |
+
*sqrt_A2my2 = sqrtf(x) * sqrtf((A + y) / 2);
|
| 149 |
+
} else if (x >= FLT_EPSILON * fabsf(y - 1)) {
|
| 150 |
+
Amy = f(x, y + 1, R) + f(x, y - 1, S);
|
| 151 |
+
*sqrt_A2my2 = sqrtf(Amy * (A + y));
|
| 152 |
+
} else if (y > 1) {
|
| 153 |
+
*sqrt_A2my2 = x * (4 / FLT_EPSILON / FLT_EPSILON) * y /
|
| 154 |
+
sqrtf((y + 1) * (y - 1));
|
| 155 |
+
*new_y = y * (4 / FLT_EPSILON / FLT_EPSILON);
|
| 156 |
+
} else {
|
| 157 |
+
*sqrt_A2my2 = sqrtf((1 - y) * (1 + y));
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
__host__ __device__ inline
|
| 164 |
+
complex<float>
|
| 165 |
+
casinhf(complex<float> z)
|
| 166 |
+
{
|
| 167 |
+
float x, y, ax, ay, rx, ry, B, sqrt_A2my2, new_y;
|
| 168 |
+
int B_is_usable;
|
| 169 |
+
complex<float> w;
|
| 170 |
+
const float RECIP_EPSILON = 1.0f / FLT_EPSILON;
|
| 171 |
+
const float m_ln2 = 6.9314718055994531e-1f; /* 0x162e42fefa39ef.0p-53 */
|
| 172 |
+
x = z.real();
|
| 173 |
+
y = z.imag();
|
| 174 |
+
ax = fabsf(x);
|
| 175 |
+
ay = fabsf(y);
|
| 176 |
+
|
| 177 |
+
if (isnan(x) || isnan(y)) {
|
| 178 |
+
if (isinf(x))
|
| 179 |
+
return (complex<float>(x, y + y));
|
| 180 |
+
if (isinf(y))
|
| 181 |
+
return (complex<float>(y, x + x));
|
| 182 |
+
if (y == 0)
|
| 183 |
+
return (complex<float>(x + x, y));
|
| 184 |
+
return (complex<float>(x + 0.0f + (y + 0), x + 0.0f + (y + 0)));
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
| 188 |
+
if (signbit(x) == 0)
|
| 189 |
+
w = clog_for_large_values(z) + m_ln2;
|
| 190 |
+
else
|
| 191 |
+
w = clog_for_large_values(-z) + m_ln2;
|
| 192 |
+
return (complex<float>(copysignf(w.real(), x),
|
| 193 |
+
copysignf(w.imag(), y)));
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
if (x == 0 && y == 0)
|
| 197 |
+
return (z);
|
| 198 |
+
|
| 199 |
+
raise_inexact();
|
| 200 |
+
|
| 201 |
+
const float SQRT_6_EPSILON = 8.4572793338e-4f; /* 0xddb3d7.0p-34 */
|
| 202 |
+
if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
|
| 203 |
+
return (z);
|
| 204 |
+
|
| 205 |
+
do_hard_work(ax, ay, &rx, &B_is_usable, &B, &sqrt_A2my2, &new_y);
|
| 206 |
+
if (B_is_usable)
|
| 207 |
+
ry = asinf(B);
|
| 208 |
+
else
|
| 209 |
+
ry = atan2f(new_y, sqrt_A2my2);
|
| 210 |
+
return (complex<float>(copysignf(rx, x), copysignf(ry, y)));
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
__host__ __device__ inline
|
| 214 |
+
complex<float> casinf(complex<float> z)
|
| 215 |
+
{
|
| 216 |
+
complex<float> w = casinhf(complex<float>(z.imag(), z.real()));
|
| 217 |
+
|
| 218 |
+
return (complex<float>(w.imag(), w.real()));
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
__host__ __device__ inline
|
| 222 |
+
complex<float> cacosf(complex<float> z)
|
| 223 |
+
{
|
| 224 |
+
float x, y, ax, ay, rx, ry, B, sqrt_A2mx2, new_x;
|
| 225 |
+
int sx, sy;
|
| 226 |
+
int B_is_usable;
|
| 227 |
+
complex<float> w;
|
| 228 |
+
const float pio2_hi = 1.5707963267948966e0f; /* 0x1921fb54442d18.0p-52 */
|
| 229 |
+
const volatile float pio2_lo = 6.1232339957367659e-17f; /* 0x11a62633145c07.0p-106 */
|
| 230 |
+
const float m_ln2 = 6.9314718055994531e-1f; /* 0x162e42fefa39ef.0p-53 */
|
| 231 |
+
|
| 232 |
+
x = z.real();
|
| 233 |
+
y = z.imag();
|
| 234 |
+
sx = signbit(x);
|
| 235 |
+
sy = signbit(y);
|
| 236 |
+
ax = fabsf(x);
|
| 237 |
+
ay = fabsf(y);
|
| 238 |
+
|
| 239 |
+
if (isnan(x) || isnan(y)) {
|
| 240 |
+
if (isinf(x))
|
| 241 |
+
return (complex<float>(y + y, -infinity<float>()));
|
| 242 |
+
if (isinf(y))
|
| 243 |
+
return (complex<float>(x + x, -y));
|
| 244 |
+
if (x == 0)
|
| 245 |
+
return (complex<float>(pio2_hi + pio2_lo, y + y));
|
| 246 |
+
return (complex<float>(x + 0.0f + (y + 0), x + 0.0f + (y + 0)));
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
const float RECIP_EPSILON = 1.0f / FLT_EPSILON;
|
| 250 |
+
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
| 251 |
+
w = clog_for_large_values(z);
|
| 252 |
+
rx = fabsf(w.imag());
|
| 253 |
+
ry = w.real() + m_ln2;
|
| 254 |
+
if (sy == 0)
|
| 255 |
+
ry = -ry;
|
| 256 |
+
return (complex<float>(rx, ry));
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
if (x == 1 && y == 0)
|
| 260 |
+
return (complex<float>(0, -y));
|
| 261 |
+
|
| 262 |
+
raise_inexact();
|
| 263 |
+
|
| 264 |
+
const float SQRT_6_EPSILON = 8.4572793338e-4f; /* 0xddb3d7.0p-34 */
|
| 265 |
+
if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
|
| 266 |
+
return (complex<float>(pio2_hi - (x - pio2_lo), -y));
|
| 267 |
+
|
| 268 |
+
do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x);
|
| 269 |
+
if (B_is_usable) {
|
| 270 |
+
if (sx == 0)
|
| 271 |
+
rx = acosf(B);
|
| 272 |
+
else
|
| 273 |
+
rx = acosf(-B);
|
| 274 |
+
} else {
|
| 275 |
+
if (sx == 0)
|
| 276 |
+
rx = atan2f(sqrt_A2mx2, new_x);
|
| 277 |
+
else
|
| 278 |
+
rx = atan2f(sqrt_A2mx2, -new_x);
|
| 279 |
+
}
|
| 280 |
+
if (sy == 0)
|
| 281 |
+
ry = -ry;
|
| 282 |
+
return (complex<float>(rx, ry));
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
__host__ __device__ inline
|
| 286 |
+
complex<float> cacoshf(complex<float> z)
|
| 287 |
+
{
|
| 288 |
+
complex<float> w;
|
| 289 |
+
float rx, ry;
|
| 290 |
+
|
| 291 |
+
w = cacosf(z);
|
| 292 |
+
rx = w.real();
|
| 293 |
+
ry = w.imag();
|
| 294 |
+
/* cacosh(NaN + I*NaN) = NaN + I*NaN */
|
| 295 |
+
if (isnan(rx) && isnan(ry))
|
| 296 |
+
return (complex<float>(ry, rx));
|
| 297 |
+
/* cacosh(NaN + I*+-Inf) = +Inf + I*NaN */
|
| 298 |
+
/* cacosh(+-Inf + I*NaN) = +Inf + I*NaN */
|
| 299 |
+
if (isnan(rx))
|
| 300 |
+
return (complex<float>(fabsf(ry), rx));
|
| 301 |
+
/* cacosh(0 + I*NaN) = NaN + I*NaN */
|
| 302 |
+
if (isnan(ry))
|
| 303 |
+
return (complex<float>(ry, ry));
|
| 304 |
+
return (complex<float>(fabsf(ry), copysignf(rx, z.imag())));
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
/*
|
| 308 |
+
* Optimized version of clog() for |z| finite and larger than ~RECIP_EPSILON.
|
| 309 |
+
*/
|
| 310 |
+
__host__ __device__ inline
|
| 311 |
+
complex<float> clog_for_large_values(complex<float> z)
|
| 312 |
+
{
|
| 313 |
+
float x, y;
|
| 314 |
+
float ax, ay, t;
|
| 315 |
+
const float m_e = 2.7182818284590452e0f; /* 0x15bf0a8b145769.0p-51 */
|
| 316 |
+
|
| 317 |
+
x = z.real();
|
| 318 |
+
y = z.imag();
|
| 319 |
+
ax = fabsf(x);
|
| 320 |
+
ay = fabsf(y);
|
| 321 |
+
if (ax < ay) {
|
| 322 |
+
t = ax;
|
| 323 |
+
ax = ay;
|
| 324 |
+
ay = t;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
if (ax > FLT_MAX / 2)
|
| 328 |
+
return (complex<float>(logf(hypotf(x / m_e, y / m_e)) + 1,
|
| 329 |
+
atan2f(y, x)));
|
| 330 |
+
|
| 331 |
+
const float QUARTER_SQRT_MAX = 2.3058430092136939520000000e+18f; /* = 0x1p61; <= sqrt(FLT_MAX) / 4 */
|
| 332 |
+
const float SQRT_MIN = 1.084202172485504434007453e-19f; /* 0x1p-63; >= sqrt(FLT_MIN) */
|
| 333 |
+
if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN)
|
| 334 |
+
return (complex<float>(logf(hypotf(x, y)), atan2f(y, x)));
|
| 335 |
+
|
| 336 |
+
return (complex<float>(logf(ax * ax + ay * ay) / 2, atan2f(y, x)));
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
/*
|
| 340 |
+
* =================
|
| 341 |
+
* | catanh, catan |
|
| 342 |
+
* =================
|
| 343 |
+
*/
|
| 344 |
+
|
| 345 |
+
/*
|
| 346 |
+
* sum_squares(x,y) = x*x + y*y (or just x*x if y*y would underflow).
|
| 347 |
+
* Assumes x*x and y*y will not overflow.
|
| 348 |
+
* Assumes x and y are finite.
|
| 349 |
+
* Assumes y is non-negative.
|
| 350 |
+
* Assumes fabsf(x) >= FLT_EPSILON.
|
| 351 |
+
*/
|
| 352 |
+
__host__ __device__
|
| 353 |
+
inline float sum_squares(float x, float y)
|
| 354 |
+
{
|
| 355 |
+
const float SQRT_MIN = 1.084202172485504434007453e-19f; /* 0x1p-63; >= sqrt(FLT_MIN) */
|
| 356 |
+
/* Avoid underflow when y is small. */
|
| 357 |
+
if (y < SQRT_MIN)
|
| 358 |
+
return (x * x);
|
| 359 |
+
|
| 360 |
+
return (x * x + y * y);
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
__host__ __device__
|
| 364 |
+
inline float real_part_reciprocal(float x, float y)
|
| 365 |
+
{
|
| 366 |
+
float scale;
|
| 367 |
+
uint32_t hx, hy;
|
| 368 |
+
int32_t ix, iy;
|
| 369 |
+
|
| 370 |
+
get_float_word(hx, x);
|
| 371 |
+
ix = hx & 0x7f800000;
|
| 372 |
+
get_float_word(hy, y);
|
| 373 |
+
iy = hy & 0x7f800000;
|
| 374 |
+
//#define BIAS (FLT_MAX_EXP - 1)
|
| 375 |
+
const int BIAS = FLT_MAX_EXP - 1;
|
| 376 |
+
//#define CUTOFF (FLT_MANT_DIG / 2 + 1)
|
| 377 |
+
const int CUTOFF = (FLT_MANT_DIG / 2 + 1);
|
| 378 |
+
if (ix - iy >= CUTOFF << 23 || isinf(x))
|
| 379 |
+
return (1 / x);
|
| 380 |
+
if (iy - ix >= CUTOFF << 23)
|
| 381 |
+
return (x / y / y);
|
| 382 |
+
if (ix <= (BIAS + FLT_MAX_EXP / 2 - CUTOFF) << 23)
|
| 383 |
+
return (x / (x * x + y * y));
|
| 384 |
+
set_float_word(scale, 0x7f800000 - ix);
|
| 385 |
+
x *= scale;
|
| 386 |
+
y *= scale;
|
| 387 |
+
return (x / (x * x + y * y) * scale);
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
#if THRUST_CPP_DIALECT >= 2011 || THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
|
| 391 |
+
__host__ __device__ inline
|
| 392 |
+
complex<float> catanhf(complex<float> z)
|
| 393 |
+
{
|
| 394 |
+
float x, y, ax, ay, rx, ry;
|
| 395 |
+
const volatile float pio2_lo = 6.1232339957367659e-17f; /* 0x11a62633145c07.0p-106 */
|
| 396 |
+
const float pio2_hi = 1.5707963267948966e0f;/* 0x1921fb54442d18.0p-52 */
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
x = z.real();
|
| 400 |
+
y = z.imag();
|
| 401 |
+
ax = fabsf(x);
|
| 402 |
+
ay = fabsf(y);
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
if (y == 0 && ax <= 1)
|
| 406 |
+
return (complex<float>(atanhf(x), y));
|
| 407 |
+
|
| 408 |
+
if (x == 0)
|
| 409 |
+
return (complex<float>(x, atanf(y)));
|
| 410 |
+
|
| 411 |
+
if (isnan(x) || isnan(y)) {
|
| 412 |
+
if (isinf(x))
|
| 413 |
+
return (complex<float>(copysignf(0, x), y + y));
|
| 414 |
+
if (isinf(y))
|
| 415 |
+
return (complex<float>(copysignf(0, x),
|
| 416 |
+
copysignf(pio2_hi + pio2_lo, y)));
|
| 417 |
+
return (complex<float>(x + 0.0f + (y + 0.0f), x + 0.0f + (y + 0.0f)));
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
const float RECIP_EPSILON = 1.0f / FLT_EPSILON;
|
| 421 |
+
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON)
|
| 422 |
+
return (complex<float>(real_part_reciprocal(x, y),
|
| 423 |
+
copysignf(pio2_hi + pio2_lo, y)));
|
| 424 |
+
|
| 425 |
+
const float SQRT_3_EPSILON = 5.9801995673e-4f; /* 0x9cc471.0p-34 */
|
| 426 |
+
if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) {
|
| 427 |
+
raise_inexact();
|
| 428 |
+
return (z);
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
const float m_ln2 = 6.9314718056e-1f; /* 0xb17218.0p-24 */
|
| 432 |
+
if (ax == 1 && ay < FLT_EPSILON)
|
| 433 |
+
rx = (m_ln2 - logf(ay)) / 2;
|
| 434 |
+
else
|
| 435 |
+
rx = log1pf(4 * ax / sum_squares(ax - 1, ay)) / 4;
|
| 436 |
+
|
| 437 |
+
if (ax == 1)
|
| 438 |
+
ry = atan2f(2, -ay) / 2;
|
| 439 |
+
else if (ay < FLT_EPSILON)
|
| 440 |
+
ry = atan2f(2 * ay, (1 - ax) * (1 + ax)) / 2;
|
| 441 |
+
else
|
| 442 |
+
ry = atan2f(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2;
|
| 443 |
+
|
| 444 |
+
return (complex<float>(copysignf(rx, x), copysignf(ry, y)));
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
__host__ __device__ inline
|
| 448 |
+
complex<float>catanf(complex<float> z){
|
| 449 |
+
complex<float> w = catanhf(complex<float>(z.imag(), z.real()));
|
| 450 |
+
return (complex<float>(w.imag(), w.real()));
|
| 451 |
+
}
|
| 452 |
+
#endif
|
| 453 |
+
|
| 454 |
+
} // namespace complex
|
| 455 |
+
|
| 456 |
+
} // namespace detail
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
template <>
|
| 460 |
+
__host__ __device__
|
| 461 |
+
inline complex<float> acos(const complex<float>& z){
|
| 462 |
+
return detail::complex::cacosf(z);
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
template <>
|
| 466 |
+
__host__ __device__
|
| 467 |
+
inline complex<float> asin(const complex<float>& z){
|
| 468 |
+
return detail::complex::casinf(z);
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
#if THRUST_CPP_DIALECT >= 2011 || THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
|
| 472 |
+
template <>
|
| 473 |
+
__host__ __device__
|
| 474 |
+
inline complex<float> atan(const complex<float>& z){
|
| 475 |
+
return detail::complex::catanf(z);
|
| 476 |
+
}
|
| 477 |
+
#endif
|
| 478 |
+
|
| 479 |
+
template <>
|
| 480 |
+
__host__ __device__
|
| 481 |
+
inline complex<float> acosh(const complex<float>& z){
|
| 482 |
+
return detail::complex::cacoshf(z);
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
template <>
|
| 487 |
+
__host__ __device__
|
| 488 |
+
inline complex<float> asinh(const complex<float>& z){
|
| 489 |
+
return detail::complex::casinhf(z);
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
#if THRUST_CPP_DIALECT >= 2011 || THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
|
| 493 |
+
template <>
|
| 494 |
+
__host__ __device__
|
| 495 |
+
inline complex<float> atanh(const complex<float>& z){
|
| 496 |
+
return detail::complex::catanhf(z);
|
| 497 |
+
}
|
| 498 |
+
#endif
|
| 499 |
+
|
| 500 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ccosh.h
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice unmodified, this list of conditions, and the following
|
| 27 |
+
* disclaimer.
|
| 28 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 29 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 30 |
+
* documentation and/or other materials provided with the distribution.
|
| 31 |
+
*
|
| 32 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 33 |
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 34 |
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 35 |
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 36 |
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 37 |
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 38 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 39 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 40 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 41 |
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSD:
|
| 45 |
+
* lib/msun/src/s_ccosh.c
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
#pragma once
|
| 49 |
+
|
| 50 |
+
#include <thrust/detail/config.h>
|
| 51 |
+
|
| 52 |
+
#include <thrust/complex.h>
|
| 53 |
+
#include <thrust/detail/complex/math_private.h>
|
| 54 |
+
|
| 55 |
+
THRUST_NAMESPACE_BEGIN
|
| 56 |
+
namespace detail{
|
| 57 |
+
namespace complex{
|
| 58 |
+
|
| 59 |
+
/*
|
| 60 |
+
* Hyperbolic cosine of a complex argument z = x + i y.
|
| 61 |
+
*
|
| 62 |
+
* cosh(z) = cosh(x+iy)
|
| 63 |
+
* = cosh(x) cos(y) + i sinh(x) sin(y).
|
| 64 |
+
*
|
| 65 |
+
* Exceptional values are noted in the comments within the source code.
|
| 66 |
+
* These values and the return value were taken from n1124.pdf.
|
| 67 |
+
*/
|
| 68 |
+
|
| 69 |
+
__host__ __device__ inline
|
| 70 |
+
thrust::complex<double> ccosh(const thrust::complex<double>& z){
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
const double huge = 8.98846567431157953864652595395e+307; // 0x1p1023
|
| 74 |
+
double x, y, h;
|
| 75 |
+
uint32_t hx, hy, ix, iy, lx, ly;
|
| 76 |
+
|
| 77 |
+
x = z.real();
|
| 78 |
+
y = z.imag();
|
| 79 |
+
|
| 80 |
+
extract_words(hx, lx, x);
|
| 81 |
+
extract_words(hy, ly, y);
|
| 82 |
+
|
| 83 |
+
ix = 0x7fffffff & hx;
|
| 84 |
+
iy = 0x7fffffff & hy;
|
| 85 |
+
|
| 86 |
+
/* Handle the nearly-non-exceptional cases where x and y are finite. */
|
| 87 |
+
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
|
| 88 |
+
if ((iy | ly) == 0)
|
| 89 |
+
return (thrust::complex<double>(::cosh(x), x * y));
|
| 90 |
+
if (ix < 0x40360000) /* small x: normal case */
|
| 91 |
+
return (thrust::complex<double>(::cosh(x) * ::cos(y), ::sinh(x) * ::sin(y)));
|
| 92 |
+
|
| 93 |
+
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
|
| 94 |
+
if (ix < 0x40862e42) {
|
| 95 |
+
/* x < 710: exp(|x|) won't overflow */
|
| 96 |
+
h = ::exp(::fabs(x)) * 0.5;
|
| 97 |
+
return (thrust::complex<double>(h * cos(y), copysign(h, x) * sin(y)));
|
| 98 |
+
} else if (ix < 0x4096bbaa) {
|
| 99 |
+
/* x < 1455: scale to avoid overflow */
|
| 100 |
+
thrust::complex<double> z_;
|
| 101 |
+
z_ = ldexp_cexp(thrust::complex<double>(fabs(x), y), -1);
|
| 102 |
+
return (thrust::complex<double>(z_.real(), z_.imag() * copysign(1.0, x)));
|
| 103 |
+
} else {
|
| 104 |
+
/* x >= 1455: the result always overflows */
|
| 105 |
+
h = huge * x;
|
| 106 |
+
return (thrust::complex<double>(h * h * cos(y), h * sin(y)));
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/*
|
| 111 |
+
* cosh(+-0 +- I Inf) = dNaN + I sign(d(+-0, dNaN))0.
|
| 112 |
+
* The sign of 0 in the result is unspecified. Choice = normally
|
| 113 |
+
* the same as dNaN. Raise the invalid floating-point exception.
|
| 114 |
+
*
|
| 115 |
+
* cosh(+-0 +- I NaN) = d(NaN) + I sign(d(+-0, NaN))0.
|
| 116 |
+
* The sign of 0 in the result is unspecified. Choice = normally
|
| 117 |
+
* the same as d(NaN).
|
| 118 |
+
*/
|
| 119 |
+
if ((ix | lx) == 0 && iy >= 0x7ff00000)
|
| 120 |
+
return (thrust::complex<double>(y - y, copysign(0.0, x * (y - y))));
|
| 121 |
+
|
| 122 |
+
/*
|
| 123 |
+
* cosh(+-Inf +- I 0) = +Inf + I (+-)(+-)0.
|
| 124 |
+
*
|
| 125 |
+
* cosh(NaN +- I 0) = d(NaN) + I sign(d(NaN, +-0))0.
|
| 126 |
+
* The sign of 0 in the result is unspecified.
|
| 127 |
+
*/
|
| 128 |
+
if ((iy | ly) == 0 && ix >= 0x7ff00000) {
|
| 129 |
+
if (((hx & 0xfffff) | lx) == 0)
|
| 130 |
+
return (thrust::complex<double>(x * x, copysign(0.0, x) * y));
|
| 131 |
+
return (thrust::complex<double>(x * x, copysign(0.0, (x + x) * y)));
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
/*
|
| 135 |
+
* cosh(x +- I Inf) = dNaN + I dNaN.
|
| 136 |
+
* Raise the invalid floating-point exception for finite nonzero x.
|
| 137 |
+
*
|
| 138 |
+
* cosh(x + I NaN) = d(NaN) + I d(NaN).
|
| 139 |
+
* Optionally raises the invalid floating-point exception for finite
|
| 140 |
+
* nonzero x. Choice = don't raise (except for signaling NaNs).
|
| 141 |
+
*/
|
| 142 |
+
if (ix < 0x7ff00000 && iy >= 0x7ff00000)
|
| 143 |
+
return (thrust::complex<double>(y - y, x * (y - y)));
|
| 144 |
+
|
| 145 |
+
/*
|
| 146 |
+
* cosh(+-Inf + I NaN) = +Inf + I d(NaN).
|
| 147 |
+
*
|
| 148 |
+
* cosh(+-Inf +- I Inf) = +Inf + I dNaN.
|
| 149 |
+
* The sign of Inf in the result is unspecified. Choice = always +.
|
| 150 |
+
* Raise the invalid floating-point exception.
|
| 151 |
+
*
|
| 152 |
+
* cosh(+-Inf + I y) = +Inf cos(y) +- I Inf sin(y)
|
| 153 |
+
*/
|
| 154 |
+
if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) {
|
| 155 |
+
if (iy >= 0x7ff00000)
|
| 156 |
+
return (thrust::complex<double>(x * x, x * (y - y)));
|
| 157 |
+
return (thrust::complex<double>((x * x) * cos(y), x * sin(y)));
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/*
|
| 161 |
+
* cosh(NaN + I NaN) = d(NaN) + I d(NaN).
|
| 162 |
+
*
|
| 163 |
+
* cosh(NaN +- I Inf) = d(NaN) + I d(NaN).
|
| 164 |
+
* Optionally raises the invalid floating-point exception.
|
| 165 |
+
* Choice = raise.
|
| 166 |
+
*
|
| 167 |
+
* cosh(NaN + I y) = d(NaN) + I d(NaN).
|
| 168 |
+
* Optionally raises the invalid floating-point exception for finite
|
| 169 |
+
* nonzero y. Choice = don't raise (except for signaling NaNs).
|
| 170 |
+
*/
|
| 171 |
+
return (thrust::complex<double>((x * x) * (y - y), (x + x) * (y - y)));
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
__host__ __device__ inline
|
| 176 |
+
thrust::complex<double> ccos(const thrust::complex<double>& z){
|
| 177 |
+
/* ccos(z) = ccosh(I * z) */
|
| 178 |
+
return (ccosh(thrust::complex<double>(-z.imag(), z.real())));
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
} // namespace complex
|
| 182 |
+
|
| 183 |
+
} // namespace detail
|
| 184 |
+
|
| 185 |
+
template <typename ValueType>
|
| 186 |
+
__host__ __device__
|
| 187 |
+
inline complex<ValueType> cos(const complex<ValueType>& z){
|
| 188 |
+
const ValueType re = z.real();
|
| 189 |
+
const ValueType im = z.imag();
|
| 190 |
+
return complex<ValueType>(std::cos(re) * std::cosh(im),
|
| 191 |
+
-std::sin(re) * std::sinh(im));
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
template <typename ValueType>
|
| 195 |
+
__host__ __device__
|
| 196 |
+
inline complex<ValueType> cosh(const complex<ValueType>& z){
|
| 197 |
+
const ValueType re = z.real();
|
| 198 |
+
const ValueType im = z.imag();
|
| 199 |
+
return complex<ValueType>(std::cosh(re) * std::cos(im),
|
| 200 |
+
std::sinh(re) * std::sin(im));
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
template <>
|
| 204 |
+
__host__ __device__
|
| 205 |
+
inline thrust::complex<double> cos(const thrust::complex<double>& z){
|
| 206 |
+
return detail::complex::ccos(z);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
template <>
|
| 210 |
+
__host__ __device__
|
| 211 |
+
inline thrust::complex<double> cosh(const thrust::complex<double>& z){
|
| 212 |
+
return detail::complex::ccosh(z);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ccoshf.h
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice unmodified, this list of conditions, and the following
|
| 27 |
+
* disclaimer.
|
| 28 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 29 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 30 |
+
* documentation and/or other materials provided with the distribution.
|
| 31 |
+
*
|
| 32 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 33 |
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 34 |
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 35 |
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 36 |
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 37 |
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 38 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 39 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 40 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 41 |
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSD:
|
| 45 |
+
* lib/msun/src/s_ccoshf.c
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
#pragma once
|
| 50 |
+
|
| 51 |
+
#include <thrust/detail/config.h>
|
| 52 |
+
|
| 53 |
+
#include <thrust/complex.h>
|
| 54 |
+
#include <thrust/detail/complex/math_private.h>
|
| 55 |
+
|
| 56 |
+
THRUST_NAMESPACE_BEGIN
|
| 57 |
+
namespace detail{
|
| 58 |
+
namespace complex{
|
| 59 |
+
|
| 60 |
+
using thrust::complex;
|
| 61 |
+
|
| 62 |
+
__host__ __device__ inline
|
| 63 |
+
complex<float> ccoshf(const complex<float>& z){
|
| 64 |
+
float x, y, h;
|
| 65 |
+
uint32_t hx, hy, ix, iy;
|
| 66 |
+
const float huge = 1.70141183460469231731687303716e+38; //0x1p127;
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
x = z.real();
|
| 70 |
+
y = z.imag();
|
| 71 |
+
|
| 72 |
+
get_float_word(hx, x);
|
| 73 |
+
get_float_word(hy, y);
|
| 74 |
+
|
| 75 |
+
ix = 0x7fffffff & hx;
|
| 76 |
+
iy = 0x7fffffff & hy;
|
| 77 |
+
if (ix < 0x7f800000 && iy < 0x7f800000) {
|
| 78 |
+
if (iy == 0){
|
| 79 |
+
return (complex<float>(coshf(x), x * y));
|
| 80 |
+
}
|
| 81 |
+
if (ix < 0x41100000){ /* small x: normal case */
|
| 82 |
+
return (complex<float>(coshf(x) * cosf(y), sinhf(x) * sinf(y)));
|
| 83 |
+
}
|
| 84 |
+
/* |x| >= 9, so cosh(x) ~= exp(|x|) */
|
| 85 |
+
if (ix < 0x42b17218) {
|
| 86 |
+
/* x < 88.7: expf(|x|) won't overflow */
|
| 87 |
+
h = expf(fabsf(x)) * 0.5f;
|
| 88 |
+
return (complex<float>(h * cosf(y), copysignf(h, x) * sinf(y)));
|
| 89 |
+
} else if (ix < 0x4340b1e7) {
|
| 90 |
+
/* x < 192.7: scale to avoid overflow */
|
| 91 |
+
thrust::complex<float> z_;
|
| 92 |
+
z_ = ldexp_cexpf(complex<float>(fabsf(x), y), -1);
|
| 93 |
+
return (complex<float>(z_.real(), z_.imag() * copysignf(1.0f, x)));
|
| 94 |
+
} else {
|
| 95 |
+
/* x >= 192.7: the result always overflows */
|
| 96 |
+
h = huge * x;
|
| 97 |
+
return (complex<float>(h * h * cosf(y), h * sinf(y)));
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
if (ix == 0 && iy >= 0x7f800000){
|
| 102 |
+
return (complex<float>(y - y, copysignf(0.0f, x * (y - y))));
|
| 103 |
+
}
|
| 104 |
+
if (iy == 0 && ix >= 0x7f800000) {
|
| 105 |
+
if ((hx & 0x7fffff) == 0)
|
| 106 |
+
return (complex<float>(x * x, copysignf(0.0f, x) * y));
|
| 107 |
+
return (complex<float>(x * x, copysignf(0.0f, (x + x) * y)));
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
if (ix < 0x7f800000 && iy >= 0x7f800000){
|
| 111 |
+
return (complex<float>(y - y, x * (y - y)));
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) {
|
| 115 |
+
if (iy >= 0x7f800000)
|
| 116 |
+
return (complex<float>(x * x, x * (y - y)));
|
| 117 |
+
return (complex<float>((x * x) * cosf(y), x * sinf(y)));
|
| 118 |
+
}
|
| 119 |
+
return (complex<float>((x * x) * (y - y), (x + x) * (y - y)));
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
__host__ __device__ inline
|
| 123 |
+
complex<float> ccosf(const complex<float>& z){
|
| 124 |
+
return (ccoshf(complex<float>(-z.imag(), z.real())));
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
} // namespace complex
|
| 128 |
+
|
| 129 |
+
} // namespace detail
|
| 130 |
+
|
| 131 |
+
template <>
|
| 132 |
+
__host__ __device__
|
| 133 |
+
inline complex<float> cos(const complex<float>& z){
|
| 134 |
+
return detail::complex::ccosf(z);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
template <>
|
| 138 |
+
__host__ __device__
|
| 139 |
+
inline complex<float> cosh(const complex<float>& z){
|
| 140 |
+
return detail::complex::ccoshf(z);
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cexp.h
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2011 David Schultz <das@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSD:
|
| 45 |
+
* lib/msun/src/s_cexp.c
|
| 46 |
+
* lib/msun/src/k_exp.c
|
| 47 |
+
*
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#pragma once
|
| 51 |
+
|
| 52 |
+
#include <thrust/detail/config.h>
|
| 53 |
+
|
| 54 |
+
#include <thrust/complex.h>
|
| 55 |
+
#include <thrust/detail/complex/math_private.h>
|
| 56 |
+
|
| 57 |
+
THRUST_NAMESPACE_BEGIN
|
| 58 |
+
namespace detail{
|
| 59 |
+
namespace complex{
|
| 60 |
+
/*
|
| 61 |
+
* Compute exp(x), scaled to avoid spurious overflow. An exponent is
|
| 62 |
+
* returned separately in 'expt'.
|
| 63 |
+
*
|
| 64 |
+
* Input: ln(DBL_MAX) <= x < ln(2 * DBL_MAX / DBL_MIN_DENORM) ~= 1454.91
|
| 65 |
+
* Output: 2**1023 <= y < 2**1024
|
| 66 |
+
*/
|
| 67 |
+
__host__ __device__ inline
|
| 68 |
+
double frexp_exp(double x, int *expt){
|
| 69 |
+
const uint32_t k = 1799; /* constant for reduction */
|
| 70 |
+
const double kln2 = 1246.97177782734161156; /* k * ln2 */
|
| 71 |
+
|
| 72 |
+
double exp_x;
|
| 73 |
+
uint32_t hx;
|
| 74 |
+
|
| 75 |
+
/*
|
| 76 |
+
* We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to
|
| 77 |
+
* minimize |exp(kln2) - 2**k|. We also scale the exponent of
|
| 78 |
+
* exp_x to MAX_EXP so that the result can be multiplied by
|
| 79 |
+
* a tiny number without losing accuracy due to denormalization.
|
| 80 |
+
*/
|
| 81 |
+
exp_x = exp(x - kln2);
|
| 82 |
+
get_high_word(hx, exp_x);
|
| 83 |
+
*expt = (hx >> 20) - (0x3ff + 1023) + k;
|
| 84 |
+
set_high_word(exp_x, (hx & 0xfffff) | ((0x3ff + 1023) << 20));
|
| 85 |
+
return (exp_x);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
__host__ __device__ inline
|
| 90 |
+
complex<double> ldexp_cexp(complex<double> z, int expt){
|
| 91 |
+
double x, y, exp_x, scale1, scale2;
|
| 92 |
+
int ex_expt, half_expt;
|
| 93 |
+
|
| 94 |
+
x = z.real();
|
| 95 |
+
y = z.imag();
|
| 96 |
+
exp_x = frexp_exp(x, &ex_expt);
|
| 97 |
+
expt += ex_expt;
|
| 98 |
+
|
| 99 |
+
/*
|
| 100 |
+
* Arrange so that scale1 * scale2 == 2**expt. We use this to
|
| 101 |
+
* compensate for scalbn being horrendously slow.
|
| 102 |
+
*/
|
| 103 |
+
half_expt = expt / 2;
|
| 104 |
+
insert_words(scale1, (0x3ff + half_expt) << 20, 0);
|
| 105 |
+
half_expt = expt - half_expt;
|
| 106 |
+
insert_words(scale2, (0x3ff + half_expt) << 20, 0);
|
| 107 |
+
|
| 108 |
+
return (complex<double>(cos(y) * exp_x * scale1 * scale2,
|
| 109 |
+
sin(y) * exp_x * scale1 * scale2));
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
__host__ __device__ inline
|
| 114 |
+
complex<double> cexp(const complex<double>& z){
|
| 115 |
+
double x, y, exp_x;
|
| 116 |
+
uint32_t hx, hy, lx, ly;
|
| 117 |
+
|
| 118 |
+
const uint32_t
|
| 119 |
+
exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */
|
| 120 |
+
cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
x = z.real();
|
| 124 |
+
y = z.imag();
|
| 125 |
+
|
| 126 |
+
extract_words(hy, ly, y);
|
| 127 |
+
hy &= 0x7fffffff;
|
| 128 |
+
|
| 129 |
+
/* cexp(x + I 0) = exp(x) + I 0 */
|
| 130 |
+
if ((hy | ly) == 0)
|
| 131 |
+
return (complex<double>(exp(x), y));
|
| 132 |
+
extract_words(hx, lx, x);
|
| 133 |
+
/* cexp(0 + I y) = cos(y) + I sin(y) */
|
| 134 |
+
if (((hx & 0x7fffffff) | lx) == 0)
|
| 135 |
+
return (complex<double>(cos(y), sin(y)));
|
| 136 |
+
|
| 137 |
+
if (hy >= 0x7ff00000) {
|
| 138 |
+
if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) {
|
| 139 |
+
/* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */
|
| 140 |
+
return (complex<double>(y - y, y - y));
|
| 141 |
+
} else if (hx & 0x80000000) {
|
| 142 |
+
/* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */
|
| 143 |
+
return (complex<double>(0.0, 0.0));
|
| 144 |
+
} else {
|
| 145 |
+
/* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */
|
| 146 |
+
return (complex<double>(x, y - y));
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
if (hx >= exp_ovfl && hx <= cexp_ovfl) {
|
| 151 |
+
/*
|
| 152 |
+
* x is between 709.7 and 1454.3, so we must scale to avoid
|
| 153 |
+
* overflow in exp(x).
|
| 154 |
+
*/
|
| 155 |
+
return (ldexp_cexp(z, 0));
|
| 156 |
+
} else {
|
| 157 |
+
/*
|
| 158 |
+
* Cases covered here:
|
| 159 |
+
* - x < exp_ovfl and exp(x) won't overflow (common case)
|
| 160 |
+
* - x > cexp_ovfl, so exp(x) * s overflows for all s > 0
|
| 161 |
+
* - x = +-Inf (generated by exp())
|
| 162 |
+
* - x = NaN (spurious inexact exception from y)
|
| 163 |
+
*/
|
| 164 |
+
exp_x = std::exp(x);
|
| 165 |
+
return (complex<double>(exp_x * cos(y), exp_x * sin(y)));
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
} // namespace complex
|
| 170 |
+
|
| 171 |
+
} // namespace detail
|
| 172 |
+
|
| 173 |
+
template <typename ValueType>
|
| 174 |
+
__host__ __device__
|
| 175 |
+
inline complex<ValueType> exp(const complex<ValueType>& z){
|
| 176 |
+
return polar(std::exp(z.real()),z.imag());
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
template <>
|
| 180 |
+
__host__ __device__
|
| 181 |
+
inline complex<double> exp(const complex<double>& z){
|
| 182 |
+
return detail::complex::cexp(z);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cexpf.h
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2011 David Schultz <das@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSD:
|
| 45 |
+
* lib/msun/src/s_cexpf.c
|
| 46 |
+
* lib/msun/src/k_exp.c
|
| 47 |
+
*
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#pragma once
|
| 51 |
+
|
| 52 |
+
#include <thrust/detail/config.h>
|
| 53 |
+
|
| 54 |
+
#include <thrust/complex.h>
|
| 55 |
+
#include <thrust/detail/complex/math_private.h>
|
| 56 |
+
|
| 57 |
+
THRUST_NAMESPACE_BEGIN
|
| 58 |
+
namespace detail{
|
| 59 |
+
namespace complex{
|
| 60 |
+
|
| 61 |
+
__host__ __device__ inline
|
| 62 |
+
float frexp_expf(float x, int *expt){
|
| 63 |
+
const uint32_t k = 235; /* constant for reduction */
|
| 64 |
+
const float kln2 = 162.88958740F; /* k * ln2 */
|
| 65 |
+
|
| 66 |
+
// should this be a double instead?
|
| 67 |
+
float exp_x;
|
| 68 |
+
uint32_t hx;
|
| 69 |
+
|
| 70 |
+
exp_x = expf(x - kln2);
|
| 71 |
+
get_float_word(hx, exp_x);
|
| 72 |
+
*expt = (hx >> 23) - (0x7f + 127) + k;
|
| 73 |
+
set_float_word(exp_x, (hx & 0x7fffff) | ((0x7f + 127) << 23));
|
| 74 |
+
return (exp_x);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
__host__ __device__ inline
|
| 78 |
+
complex<float>
|
| 79 |
+
ldexp_cexpf(complex<float> z, int expt)
|
| 80 |
+
{
|
| 81 |
+
float x, y, exp_x, scale1, scale2;
|
| 82 |
+
int ex_expt, half_expt;
|
| 83 |
+
|
| 84 |
+
x = z.real();
|
| 85 |
+
y = z.imag();
|
| 86 |
+
exp_x = frexp_expf(x, &ex_expt);
|
| 87 |
+
expt += ex_expt;
|
| 88 |
+
|
| 89 |
+
half_expt = expt / 2;
|
| 90 |
+
set_float_word(scale1, (0x7f + half_expt) << 23);
|
| 91 |
+
half_expt = expt - half_expt;
|
| 92 |
+
set_float_word(scale2, (0x7f + half_expt) << 23);
|
| 93 |
+
|
| 94 |
+
return (complex<float>(std::cos(y) * exp_x * scale1 * scale2,
|
| 95 |
+
std::sin(y) * exp_x * scale1 * scale2));
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
__host__ __device__ inline
|
| 99 |
+
complex<float> cexpf(const complex<float>& z){
|
| 100 |
+
float x, y, exp_x;
|
| 101 |
+
uint32_t hx, hy;
|
| 102 |
+
|
| 103 |
+
const uint32_t
|
| 104 |
+
exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */
|
| 105 |
+
cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
|
| 106 |
+
|
| 107 |
+
x = z.real();
|
| 108 |
+
y = z.imag();
|
| 109 |
+
|
| 110 |
+
get_float_word(hy, y);
|
| 111 |
+
hy &= 0x7fffffff;
|
| 112 |
+
|
| 113 |
+
/* cexp(x + I 0) = exp(x) + I 0 */
|
| 114 |
+
if (hy == 0)
|
| 115 |
+
return (complex<float>(std::exp(x), y));
|
| 116 |
+
get_float_word(hx, x);
|
| 117 |
+
/* cexp(0 + I y) = cos(y) + I sin(y) */
|
| 118 |
+
if ((hx & 0x7fffffff) == 0){
|
| 119 |
+
return (complex<float>(std::cos(y), std::sin(y)));
|
| 120 |
+
}
|
| 121 |
+
if (hy >= 0x7f800000) {
|
| 122 |
+
if ((hx & 0x7fffffff) != 0x7f800000) {
|
| 123 |
+
/* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */
|
| 124 |
+
return (complex<float>(y - y, y - y));
|
| 125 |
+
} else if (hx & 0x80000000) {
|
| 126 |
+
/* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */
|
| 127 |
+
return (complex<float>(0.0, 0.0));
|
| 128 |
+
} else {
|
| 129 |
+
/* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */
|
| 130 |
+
return (complex<float>(x, y - y));
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
if (hx >= exp_ovfl && hx <= cexp_ovfl) {
|
| 135 |
+
/*
|
| 136 |
+
* x is between 88.7 and 192, so we must scale to avoid
|
| 137 |
+
* overflow in expf(x).
|
| 138 |
+
*/
|
| 139 |
+
return (ldexp_cexpf(z, 0));
|
| 140 |
+
} else {
|
| 141 |
+
/*
|
| 142 |
+
* Cases covered here:
|
| 143 |
+
* - x < exp_ovfl and exp(x) won't overflow (common case)
|
| 144 |
+
* - x > cexp_ovfl, so exp(x) * s overflows for all s > 0
|
| 145 |
+
* - x = +-Inf (generated by exp())
|
| 146 |
+
* - x = NaN (spurious inexact exception from y)
|
| 147 |
+
*/
|
| 148 |
+
exp_x = std::exp(x);
|
| 149 |
+
return (complex<float>(exp_x * std::cos(y), exp_x * std::sin(y)));
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
} // namespace complex
|
| 154 |
+
|
| 155 |
+
} // namespace detail
|
| 156 |
+
|
| 157 |
+
template <>
|
| 158 |
+
__host__ __device__
|
| 159 |
+
inline complex<float> exp(const complex<float>& z){
|
| 160 |
+
return detail::complex::cexpf(z);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/clog.h
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2021 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSDs msun:*/
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
#pragma once
|
| 48 |
+
|
| 49 |
+
#include <thrust/detail/config.h>
|
| 50 |
+
|
| 51 |
+
#include <thrust/complex.h>
|
| 52 |
+
#include <thrust/detail/complex/math_private.h>
|
| 53 |
+
|
| 54 |
+
THRUST_NAMESPACE_BEGIN
|
| 55 |
+
namespace detail{
|
| 56 |
+
namespace complex{
|
| 57 |
+
|
| 58 |
+
using thrust::complex;
|
| 59 |
+
|
| 60 |
+
/* round down to 18 = 54/3 bits */
|
| 61 |
+
__host__ __device__ inline
|
| 62 |
+
double trim(double x){
|
| 63 |
+
uint32_t hi;
|
| 64 |
+
get_high_word(hi, x);
|
| 65 |
+
insert_words(x, hi &0xfffffff8, 0);
|
| 66 |
+
return x;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
__host__ __device__ inline
|
| 71 |
+
complex<double> clog(const complex<double>& z){
|
| 72 |
+
|
| 73 |
+
// Adapted from FreeBSDs msun
|
| 74 |
+
double x, y;
|
| 75 |
+
double ax, ay;
|
| 76 |
+
double x0, y0, x1, y1, x2, y2, t, hm1;
|
| 77 |
+
double val[12];
|
| 78 |
+
int i, sorted;
|
| 79 |
+
const double e = 2.7182818284590452354;
|
| 80 |
+
|
| 81 |
+
x = z.real();
|
| 82 |
+
y = z.imag();
|
| 83 |
+
|
| 84 |
+
/* Handle NaNs using the general formula to mix them right. */
|
| 85 |
+
if (x != x || y != y){
|
| 86 |
+
return (complex<double>(std::log(norm(z)), std::atan2(y, x)));
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
ax = std::abs(x);
|
| 90 |
+
ay = std::abs(y);
|
| 91 |
+
if (ax < ay) {
|
| 92 |
+
t = ax;
|
| 93 |
+
ax = ay;
|
| 94 |
+
ay = t;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/*
|
| 98 |
+
* To avoid unnecessary overflow, if x and y are very large, divide x
|
| 99 |
+
* and y by M_E, and then add 1 to the logarithm. This depends on
|
| 100 |
+
* M_E being larger than sqrt(2).
|
| 101 |
+
* There is a potential loss of accuracy caused by dividing by M_E,
|
| 102 |
+
* but this case should happen extremely rarely.
|
| 103 |
+
*/
|
| 104 |
+
// if (ay > 5e307){
|
| 105 |
+
// For high values of ay -> hypotf(DBL_MAX,ay) = inf
|
| 106 |
+
// We expect that for values at or below ay = 5e307 this should not happen
|
| 107 |
+
if (ay > 5e307){
|
| 108 |
+
return (complex<double>(std::log(hypot(x / e, y / e)) + 1.0, std::atan2(y, x)));
|
| 109 |
+
}
|
| 110 |
+
if (ax == 1.) {
|
| 111 |
+
if (ay < 1e-150){
|
| 112 |
+
return (complex<double>((ay * 0.5) * ay, std::atan2(y, x)));
|
| 113 |
+
}
|
| 114 |
+
return (complex<double>(log1p(ay * ay) * 0.5, std::atan2(y, x)));
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/*
|
| 118 |
+
* Because atan2 and hypot conform to C99, this also covers all the
|
| 119 |
+
* edge cases when x or y are 0 or infinite.
|
| 120 |
+
*/
|
| 121 |
+
if (ax < 1e-50 || ay < 1e-50 || ax > 1e50 || ay > 1e50){
|
| 122 |
+
return (complex<double>(std::log(hypot(x, y)), std::atan2(y, x)));
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/*
|
| 126 |
+
* From this point on, we don't need to worry about underflow or
|
| 127 |
+
* overflow in calculating ax*ax or ay*ay.
|
| 128 |
+
*/
|
| 129 |
+
|
| 130 |
+
/* Some easy cases. */
|
| 131 |
+
|
| 132 |
+
if (ax >= 1.0){
|
| 133 |
+
return (complex<double>(log1p((ax-1)*(ax+1) + ay*ay) * 0.5, atan2(y, x)));
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
if (ax*ax + ay*ay <= 0.7){
|
| 137 |
+
return (complex<double>(std::log(ax*ax + ay*ay) * 0.5, std::atan2(y, x)));
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/*
|
| 141 |
+
* Take extra care so that ULP of real part is small if hypot(x,y) is
|
| 142 |
+
* moderately close to 1.
|
| 143 |
+
*/
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
x0 = trim(ax);
|
| 147 |
+
ax = ax-x0;
|
| 148 |
+
x1 = trim(ax);
|
| 149 |
+
x2 = ax-x1;
|
| 150 |
+
y0 = trim(ay);
|
| 151 |
+
ay = ay-y0;
|
| 152 |
+
y1 = trim(ay);
|
| 153 |
+
y2 = ay-y1;
|
| 154 |
+
|
| 155 |
+
val[0] = x0*x0;
|
| 156 |
+
val[1] = y0*y0;
|
| 157 |
+
val[2] = 2*x0*x1;
|
| 158 |
+
val[3] = 2*y0*y1;
|
| 159 |
+
val[4] = x1*x1;
|
| 160 |
+
val[5] = y1*y1;
|
| 161 |
+
val[6] = 2*x0*x2;
|
| 162 |
+
val[7] = 2*y0*y2;
|
| 163 |
+
val[8] = 2*x1*x2;
|
| 164 |
+
val[9] = 2*y1*y2;
|
| 165 |
+
val[10] = x2*x2;
|
| 166 |
+
val[11] = y2*y2;
|
| 167 |
+
|
| 168 |
+
/* Bubble sort. */
|
| 169 |
+
|
| 170 |
+
do {
|
| 171 |
+
sorted = 1;
|
| 172 |
+
for (i=0;i<11;i++) {
|
| 173 |
+
if (val[i] < val[i+1]) {
|
| 174 |
+
sorted = 0;
|
| 175 |
+
t = val[i];
|
| 176 |
+
val[i] = val[i+1];
|
| 177 |
+
val[i+1] = t;
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
} while (!sorted);
|
| 181 |
+
|
| 182 |
+
hm1 = -1;
|
| 183 |
+
for (i=0;i<12;i++){
|
| 184 |
+
hm1 += val[i];
|
| 185 |
+
}
|
| 186 |
+
return (complex<double>(0.5 * log1p(hm1), atan2(y, x)));
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
} // namespace complex
|
| 190 |
+
|
| 191 |
+
} // namespace detail
|
| 192 |
+
|
| 193 |
+
template <typename ValueType>
|
| 194 |
+
__host__ __device__
|
| 195 |
+
inline complex<ValueType> log(const complex<ValueType>& z){
|
| 196 |
+
return complex<ValueType>(std::log(thrust::abs(z)),thrust::arg(z));
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
template <>
|
| 200 |
+
__host__ __device__
|
| 201 |
+
inline complex<double> log(const complex<double>& z){
|
| 202 |
+
return detail::complex::clog(z);
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
template <typename ValueType>
|
| 206 |
+
__host__ __device__
|
| 207 |
+
inline complex<ValueType> log10(const complex<ValueType>& z){
|
| 208 |
+
// Using the explicit literal prevents compile time warnings in
|
| 209 |
+
// devices that don't support doubles
|
| 210 |
+
return thrust::log(z)/ValueType(2.30258509299404568402);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
THRUST_NAMESPACE_END
|
| 214 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/clogf.h
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2021 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSDs msun:*/
|
| 45 |
+
|
| 46 |
+
#pragma once
|
| 47 |
+
|
| 48 |
+
#include <thrust/detail/config.h>
|
| 49 |
+
|
| 50 |
+
#include <thrust/complex.h>
|
| 51 |
+
#include <thrust/detail/complex/math_private.h>
|
| 52 |
+
|
| 53 |
+
THRUST_NAMESPACE_BEGIN
|
| 54 |
+
namespace detail{
|
| 55 |
+
namespace complex{
|
| 56 |
+
|
| 57 |
+
using thrust::complex;
|
| 58 |
+
|
| 59 |
+
/* round down to 8 = 24/3 bits */
|
| 60 |
+
__host__ __device__ inline
|
| 61 |
+
float trim(float x){
|
| 62 |
+
uint32_t hx;
|
| 63 |
+
get_float_word(hx, x);
|
| 64 |
+
hx &= 0xffff0000;
|
| 65 |
+
float ret;
|
| 66 |
+
set_float_word(ret,hx);
|
| 67 |
+
return ret;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
__host__ __device__ inline
|
| 72 |
+
complex<float> clogf(const complex<float>& z){
|
| 73 |
+
|
| 74 |
+
// Adapted from FreeBSDs msun
|
| 75 |
+
float x, y;
|
| 76 |
+
float ax, ay;
|
| 77 |
+
float x0, y0, x1, y1, x2, y2, t, hm1;
|
| 78 |
+
float val[12];
|
| 79 |
+
int i, sorted;
|
| 80 |
+
const float e = 2.7182818284590452354f;
|
| 81 |
+
|
| 82 |
+
x = z.real();
|
| 83 |
+
y = z.imag();
|
| 84 |
+
|
| 85 |
+
/* Handle NaNs using the general formula to mix them right. */
|
| 86 |
+
if (x != x || y != y){
|
| 87 |
+
return (complex<float>(std::log(norm(z)), std::atan2(y, x)));
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
ax = std::abs(x);
|
| 91 |
+
ay = std::abs(y);
|
| 92 |
+
if (ax < ay) {
|
| 93 |
+
t = ax;
|
| 94 |
+
ax = ay;
|
| 95 |
+
ay = t;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/*
|
| 99 |
+
* To avoid unnecessary overflow, if x and y are very large, divide x
|
| 100 |
+
* and y by M_E, and then add 1 to the logarithm. This depends on
|
| 101 |
+
* M_E being larger than sqrt(2).
|
| 102 |
+
* There is a potential loss of accuracy caused by dividing by M_E,
|
| 103 |
+
* but this case should happen extremely rarely.
|
| 104 |
+
*/
|
| 105 |
+
// For high values of ay -> hypotf(FLT_MAX,ay) = inf
|
| 106 |
+
// We expect that for values at or below ay = 1e34f this should not happen
|
| 107 |
+
if (ay > 1e34f){
|
| 108 |
+
return (complex<float>(std::log(hypotf(x / e, y / e)) + 1.0f, std::atan2(y, x)));
|
| 109 |
+
}
|
| 110 |
+
if (ax == 1.f) {
|
| 111 |
+
if (ay < 1e-19f){
|
| 112 |
+
return (complex<float>((ay * 0.5f) * ay, std::atan2(y, x)));
|
| 113 |
+
}
|
| 114 |
+
return (complex<float>(log1pf(ay * ay) * 0.5f, std::atan2(y, x)));
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/*
|
| 118 |
+
* Because atan2 and hypot conform to C99, this also covers all the
|
| 119 |
+
* edge cases when x or y are 0 or infinite.
|
| 120 |
+
*/
|
| 121 |
+
if (ax < 1e-6f || ay < 1e-6f || ax > 1e6f || ay > 1e6f){
|
| 122 |
+
return (complex<float>(std::log(hypotf(x, y)), std::atan2(y, x)));
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/*
|
| 126 |
+
* From this point on, we don't need to worry about underflow or
|
| 127 |
+
* overflow in calculating ax*ax or ay*ay.
|
| 128 |
+
*/
|
| 129 |
+
|
| 130 |
+
/* Some easy cases. */
|
| 131 |
+
|
| 132 |
+
if (ax >= 1.0f){
|
| 133 |
+
return (complex<float>(log1pf((ax-1.f)*(ax+1.f) + ay*ay) * 0.5f, atan2(y, x)));
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
if (ax*ax + ay*ay <= 0.7f){
|
| 137 |
+
return (complex<float>(std::log(ax*ax + ay*ay) * 0.5f, std::atan2(y, x)));
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/*
|
| 141 |
+
* Take extra care so that ULP of real part is small if hypot(x,y) is
|
| 142 |
+
* moderately close to 1.
|
| 143 |
+
*/
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
x0 = trim(ax);
|
| 147 |
+
ax = ax-x0;
|
| 148 |
+
x1 = trim(ax);
|
| 149 |
+
x2 = ax-x1;
|
| 150 |
+
y0 = trim(ay);
|
| 151 |
+
ay = ay-y0;
|
| 152 |
+
y1 = trim(ay);
|
| 153 |
+
y2 = ay-y1;
|
| 154 |
+
|
| 155 |
+
val[0] = x0*x0;
|
| 156 |
+
val[1] = y0*y0;
|
| 157 |
+
val[2] = 2*x0*x1;
|
| 158 |
+
val[3] = 2*y0*y1;
|
| 159 |
+
val[4] = x1*x1;
|
| 160 |
+
val[5] = y1*y1;
|
| 161 |
+
val[6] = 2*x0*x2;
|
| 162 |
+
val[7] = 2*y0*y2;
|
| 163 |
+
val[8] = 2*x1*x2;
|
| 164 |
+
val[9] = 2*y1*y2;
|
| 165 |
+
val[10] = x2*x2;
|
| 166 |
+
val[11] = y2*y2;
|
| 167 |
+
|
| 168 |
+
/* Bubble sort. */
|
| 169 |
+
|
| 170 |
+
do {
|
| 171 |
+
sorted = 1;
|
| 172 |
+
for (i=0;i<11;i++) {
|
| 173 |
+
if (val[i] < val[i+1]) {
|
| 174 |
+
sorted = 0;
|
| 175 |
+
t = val[i];
|
| 176 |
+
val[i] = val[i+1];
|
| 177 |
+
val[i+1] = t;
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
} while (!sorted);
|
| 181 |
+
|
| 182 |
+
hm1 = -1;
|
| 183 |
+
for (i=0;i<12;i++){
|
| 184 |
+
hm1 += val[i];
|
| 185 |
+
}
|
| 186 |
+
return (complex<float>(0.5f * log1pf(hm1), atan2(y, x)));
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
} // namespace complex
|
| 190 |
+
|
| 191 |
+
} // namespace detail
|
| 192 |
+
|
| 193 |
+
template <>
|
| 194 |
+
__host__ __device__
|
| 195 |
+
inline complex<float> log(const complex<float>& z){
|
| 196 |
+
return detail::complex::clogf(z);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
THRUST_NAMESPACE_END
|
| 200 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/complex.inl
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2021 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <thrust/detail/config.h>
|
| 21 |
+
|
| 22 |
+
#include <thrust/complex.h>
|
| 23 |
+
#include <thrust/type_traits/is_trivially_relocatable.h>
|
| 24 |
+
|
| 25 |
+
THRUST_NAMESPACE_BEGIN
|
| 26 |
+
|
| 27 |
+
/* --- Constructors --- */
|
| 28 |
+
|
| 29 |
+
#if THRUST_CPP_DIALECT < 2011
|
| 30 |
+
template <typename T>
|
| 31 |
+
__host__ __device__
|
| 32 |
+
complex<T>::complex()
|
| 33 |
+
{
|
| 34 |
+
real(T());
|
| 35 |
+
imag(T());
|
| 36 |
+
}
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
template <typename T>
|
| 40 |
+
__host__ __device__
|
| 41 |
+
complex<T>::complex(const T& re)
|
| 42 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 43 |
+
// Initialize the storage in the member initializer list using C++ unicorn
|
| 44 |
+
// initialization. This allows `complex<T const>` to work.
|
| 45 |
+
: data{re, T()}
|
| 46 |
+
{}
|
| 47 |
+
#else
|
| 48 |
+
{
|
| 49 |
+
real(re);
|
| 50 |
+
imag(T());
|
| 51 |
+
}
|
| 52 |
+
#endif
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
template <typename T>
|
| 56 |
+
__host__ __device__
|
| 57 |
+
complex<T>::complex(const T& re, const T& im)
|
| 58 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 59 |
+
// Initialize the storage in the member initializer list using C++ unicorn
|
| 60 |
+
// initialization. This allows `complex<T const>` to work.
|
| 61 |
+
: data{re, im}
|
| 62 |
+
{}
|
| 63 |
+
#else
|
| 64 |
+
{
|
| 65 |
+
real(re);
|
| 66 |
+
imag(im);
|
| 67 |
+
}
|
| 68 |
+
#endif
|
| 69 |
+
|
| 70 |
+
#if THRUST_CPP_DIALECT < 2011
|
| 71 |
+
template <typename T>
|
| 72 |
+
__host__ __device__
|
| 73 |
+
complex<T>::complex(const complex<T>& z)
|
| 74 |
+
{
|
| 75 |
+
real(z.real());
|
| 76 |
+
imag(z.imag());
|
| 77 |
+
}
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
template <typename T>
|
| 81 |
+
template <typename U>
|
| 82 |
+
__host__ __device__
|
| 83 |
+
complex<T>::complex(const complex<U>& z)
|
| 84 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 85 |
+
// Initialize the storage in the member initializer list using C++ unicorn
|
| 86 |
+
// initialization. This allows `complex<T const>` to work.
|
| 87 |
+
// We do a functional-style cast here to suppress conversion warnings.
|
| 88 |
+
: data{T(z.real()), T(z.imag())}
|
| 89 |
+
{}
|
| 90 |
+
#else
|
| 91 |
+
{
|
| 92 |
+
real(T(z.real()));
|
| 93 |
+
imag(T(z.imag()));
|
| 94 |
+
}
|
| 95 |
+
#endif
|
| 96 |
+
|
| 97 |
+
template <typename T>
|
| 98 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 99 |
+
complex<T>::complex(const std::complex<T>& z)
|
| 100 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 101 |
+
// Initialize the storage in the member initializer list using C++ unicorn
|
| 102 |
+
// initialization. This allows `complex<T const>` to work.
|
| 103 |
+
: data{THRUST_STD_COMPLEX_REAL(z), THRUST_STD_COMPLEX_IMAG(z)}
|
| 104 |
+
{}
|
| 105 |
+
#else
|
| 106 |
+
{
|
| 107 |
+
real(THRUST_STD_COMPLEX_REAL(z));
|
| 108 |
+
imag(THRUST_STD_COMPLEX_IMAG(z));
|
| 109 |
+
}
|
| 110 |
+
#endif
|
| 111 |
+
|
| 112 |
+
template <typename T>
|
| 113 |
+
template <typename U>
|
| 114 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 115 |
+
complex<T>::complex(const std::complex<U>& z)
|
| 116 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 117 |
+
// Initialize the storage in the member initializer list using C++ unicorn
|
| 118 |
+
// initialization. This allows `complex<T const>` to work.
|
| 119 |
+
// We do a functional-style cast here to suppress conversion warnings.
|
| 120 |
+
: data{T(THRUST_STD_COMPLEX_REAL(z)), T(THRUST_STD_COMPLEX_IMAG(z))}
|
| 121 |
+
{}
|
| 122 |
+
#else
|
| 123 |
+
{
|
| 124 |
+
real(T(THRUST_STD_COMPLEX_REAL(z)));
|
| 125 |
+
imag(T(THRUST_STD_COMPLEX_IMAG(z)));
|
| 126 |
+
}
|
| 127 |
+
#endif
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
/* --- Assignment Operators --- */
|
| 132 |
+
|
| 133 |
+
template <typename T>
|
| 134 |
+
__host__ __device__
|
| 135 |
+
complex<T>& complex<T>::operator=(const T& re)
|
| 136 |
+
{
|
| 137 |
+
real(re);
|
| 138 |
+
imag(T());
|
| 139 |
+
return *this;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
#if THRUST_CPP_DIALECT < 2011
|
| 143 |
+
template <typename T>
|
| 144 |
+
__host__ __device__
|
| 145 |
+
complex<T>& complex<T>::operator=(const complex<T>& z)
|
| 146 |
+
{
|
| 147 |
+
real(z.real());
|
| 148 |
+
imag(z.imag());
|
| 149 |
+
return *this;
|
| 150 |
+
}
|
| 151 |
+
#endif
|
| 152 |
+
|
| 153 |
+
template <typename T>
|
| 154 |
+
template <typename U>
|
| 155 |
+
__host__ __device__
|
| 156 |
+
complex<T>& complex<T>::operator=(const complex<U>& z)
|
| 157 |
+
{
|
| 158 |
+
real(T(z.real()));
|
| 159 |
+
imag(T(z.imag()));
|
| 160 |
+
return *this;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
template <typename T>
|
| 164 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 165 |
+
complex<T>& complex<T>::operator=(const std::complex<T>& z)
|
| 166 |
+
{
|
| 167 |
+
real(THRUST_STD_COMPLEX_REAL(z));
|
| 168 |
+
imag(THRUST_STD_COMPLEX_IMAG(z));
|
| 169 |
+
return *this;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
template <typename T>
|
| 173 |
+
template <typename U>
|
| 174 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 175 |
+
complex<T>& complex<T>::operator=(const std::complex<U>& z)
|
| 176 |
+
{
|
| 177 |
+
real(T(THRUST_STD_COMPLEX_REAL(z)));
|
| 178 |
+
imag(T(THRUST_STD_COMPLEX_IMAG(z)));
|
| 179 |
+
return *this;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
/* --- Compound Assignment Operators --- */
|
| 185 |
+
|
| 186 |
+
template <typename T>
|
| 187 |
+
template <typename U>
|
| 188 |
+
__host__ __device__
|
| 189 |
+
complex<T>& complex<T>::operator+=(const complex<U>& z)
|
| 190 |
+
{
|
| 191 |
+
*this = *this + z;
|
| 192 |
+
return *this;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
template <typename T>
|
| 196 |
+
template <typename U>
|
| 197 |
+
__host__ __device__
|
| 198 |
+
complex<T>& complex<T>::operator-=(const complex<U>& z)
|
| 199 |
+
{
|
| 200 |
+
*this = *this - z;
|
| 201 |
+
return *this;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
template <typename T>
|
| 205 |
+
template <typename U>
|
| 206 |
+
__host__ __device__
|
| 207 |
+
complex<T>& complex<T>::operator*=(const complex<U>& z)
|
| 208 |
+
{
|
| 209 |
+
*this = *this * z;
|
| 210 |
+
return *this;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
template <typename T>
|
| 214 |
+
template <typename U>
|
| 215 |
+
__host__ __device__
|
| 216 |
+
complex<T>& complex<T>::operator/=(const complex<U>& z)
|
| 217 |
+
{
|
| 218 |
+
*this = *this / z;
|
| 219 |
+
return *this;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
template <typename T>
|
| 223 |
+
template <typename U>
|
| 224 |
+
__host__ __device__
|
| 225 |
+
complex<T>& complex<T>::operator+=(const U& z)
|
| 226 |
+
{
|
| 227 |
+
*this = *this + z;
|
| 228 |
+
return *this;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
template <typename T>
|
| 232 |
+
template <typename U>
|
| 233 |
+
__host__ __device__
|
| 234 |
+
complex<T>& complex<T>::operator-=(const U& z)
|
| 235 |
+
{
|
| 236 |
+
*this = *this - z;
|
| 237 |
+
return *this;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
template <typename T>
|
| 241 |
+
template <typename U>
|
| 242 |
+
__host__ __device__
|
| 243 |
+
complex<T>& complex<T>::operator*=(const U& z)
|
| 244 |
+
{
|
| 245 |
+
*this = *this * z;
|
| 246 |
+
return *this;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
template <typename T>
|
| 250 |
+
template <typename U>
|
| 251 |
+
__host__ __device__
|
| 252 |
+
complex<T>& complex<T>::operator/=(const U& z)
|
| 253 |
+
{
|
| 254 |
+
*this = *this / z;
|
| 255 |
+
return *this;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
/* --- Equality Operators --- */
|
| 261 |
+
|
| 262 |
+
template <typename T0, typename T1>
|
| 263 |
+
__host__ __device__
|
| 264 |
+
bool operator==(const complex<T0>& x, const complex<T1>& y)
|
| 265 |
+
{
|
| 266 |
+
return x.real() == y.real() && x.imag() == y.imag();
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
template <typename T0, typename T1>
|
| 270 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 271 |
+
bool operator==(const complex<T0>& x, const std::complex<T1>& y)
|
| 272 |
+
{
|
| 273 |
+
return x.real() == THRUST_STD_COMPLEX_REAL(y) && x.imag() == THRUST_STD_COMPLEX_IMAG(y);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
template <typename T0, typename T1>
|
| 277 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 278 |
+
bool operator==(const std::complex<T0>& x, const complex<T1>& y)
|
| 279 |
+
{
|
| 280 |
+
return THRUST_STD_COMPLEX_REAL(x) == y.real() && THRUST_STD_COMPLEX_IMAG(x) == y.imag();
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
template <typename T0, typename T1>
|
| 284 |
+
__host__ __device__
|
| 285 |
+
bool operator==(const T0& x, const complex<T1>& y)
|
| 286 |
+
{
|
| 287 |
+
return x == y.real() && y.imag() == T1();
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
template <typename T0, typename T1>
|
| 291 |
+
__host__ __device__
|
| 292 |
+
bool operator==(const complex<T0>& x, const T1& y)
|
| 293 |
+
{
|
| 294 |
+
return x.real() == y && x.imag() == T1();
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
template <typename T0, typename T1>
|
| 298 |
+
__host__ __device__
|
| 299 |
+
bool operator!=(const complex<T0>& x, const complex<T1>& y)
|
| 300 |
+
{
|
| 301 |
+
return !(x == y);
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
template <typename T0, typename T1>
|
| 305 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 306 |
+
bool operator!=(const complex<T0>& x, const std::complex<T1>& y)
|
| 307 |
+
{
|
| 308 |
+
return !(x == y);
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
template <typename T0, typename T1>
|
| 312 |
+
__host__ THRUST_STD_COMPLEX_DEVICE
|
| 313 |
+
bool operator!=(const std::complex<T0>& x, const complex<T1>& y)
|
| 314 |
+
{
|
| 315 |
+
return !(x == y);
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
template <typename T0, typename T1>
|
| 319 |
+
__host__ __device__
|
| 320 |
+
bool operator!=(const T0& x, const complex<T1>& y)
|
| 321 |
+
{
|
| 322 |
+
return !(x == y);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
template <typename T0, typename T1>
|
| 326 |
+
__host__ __device__
|
| 327 |
+
bool operator!=(const complex<T0>& x, const T1& y)
|
| 328 |
+
{
|
| 329 |
+
return !(x == y);
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
template <typename T>
|
| 333 |
+
struct proclaim_trivially_relocatable<complex<T> > : thrust::true_type {};
|
| 334 |
+
|
| 335 |
+
THRUST_NAMESPACE_END
|
| 336 |
+
|
| 337 |
+
#include <thrust/detail/complex/arithmetic.h>
|
| 338 |
+
#include <thrust/detail/complex/cproj.h>
|
| 339 |
+
#include <thrust/detail/complex/cexp.h>
|
| 340 |
+
#include <thrust/detail/complex/cexpf.h>
|
| 341 |
+
#include <thrust/detail/complex/clog.h>
|
| 342 |
+
#include <thrust/detail/complex/clogf.h>
|
| 343 |
+
#include <thrust/detail/complex/cpow.h>
|
| 344 |
+
#include <thrust/detail/complex/ccosh.h>
|
| 345 |
+
#include <thrust/detail/complex/ccoshf.h>
|
| 346 |
+
#include <thrust/detail/complex/csinh.h>
|
| 347 |
+
#include <thrust/detail/complex/csinhf.h>
|
| 348 |
+
#include <thrust/detail/complex/ctanh.h>
|
| 349 |
+
#include <thrust/detail/complex/ctanhf.h>
|
| 350 |
+
#include <thrust/detail/complex/csqrt.h>
|
| 351 |
+
#include <thrust/detail/complex/csqrtf.h>
|
| 352 |
+
#include <thrust/detail/complex/catrig.h>
|
| 353 |
+
#include <thrust/detail/complex/catrigf.h>
|
| 354 |
+
#include <thrust/detail/complex/stream.h>
|
| 355 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cpow.h
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <thrust/detail/config.h>
|
| 21 |
+
|
| 22 |
+
#include <thrust/complex.h>
|
| 23 |
+
#include <thrust/detail/type_traits.h>
|
| 24 |
+
|
| 25 |
+
THRUST_NAMESPACE_BEGIN
|
| 26 |
+
|
| 27 |
+
template <typename T0, typename T1>
|
| 28 |
+
__host__ __device__
|
| 29 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 30 |
+
pow(const complex<T0>& x, const complex<T1>& y)
|
| 31 |
+
{
|
| 32 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 33 |
+
return exp(log(complex<T>(x)) * complex<T>(y));
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
template <typename T0, typename T1>
|
| 37 |
+
__host__ __device__
|
| 38 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 39 |
+
pow(const complex<T0>& x, const T1& y)
|
| 40 |
+
{
|
| 41 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 42 |
+
return exp(log(complex<T>(x)) * T(y));
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
template <typename T0, typename T1>
|
| 46 |
+
__host__ __device__
|
| 47 |
+
complex<typename detail::promoted_numerical_type<T0, T1>::type>
|
| 48 |
+
pow(const T0& x, const complex<T1>& y)
|
| 49 |
+
{
|
| 50 |
+
typedef typename detail::promoted_numerical_type<T0, T1>::type T;
|
| 51 |
+
// Find `log` by ADL.
|
| 52 |
+
using std::log;
|
| 53 |
+
return exp(log(T(x)) * complex<T>(y));
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
THRUST_NAMESPACE_END
|
| 57 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/cproj.h
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <thrust/detail/config.h>
|
| 21 |
+
|
| 22 |
+
#include <thrust/complex.h>
|
| 23 |
+
#include <thrust/detail/complex/math_private.h>
|
| 24 |
+
#include <cmath>
|
| 25 |
+
|
| 26 |
+
THRUST_NAMESPACE_BEGIN
|
| 27 |
+
namespace detail{
|
| 28 |
+
namespace complex{
|
| 29 |
+
__host__ __device__
|
| 30 |
+
inline complex<float> cprojf(const complex<float>& z){
|
| 31 |
+
if(!isinf(z.real()) && !isinf(z.imag())){
|
| 32 |
+
return z;
|
| 33 |
+
}else{
|
| 34 |
+
// std::numeric_limits<T>::infinity() doesn't run on the GPU
|
| 35 |
+
return complex<float>(infinity<float>(), copysignf(0.0, z.imag()));
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
__host__ __device__
|
| 40 |
+
inline complex<double> cproj(const complex<double>& z){
|
| 41 |
+
if(!isinf(z.real()) && !isinf(z.imag())){
|
| 42 |
+
return z;
|
| 43 |
+
}else{
|
| 44 |
+
// std::numeric_limits<T>::infinity() doesn't run on the GPU
|
| 45 |
+
return complex<double>(infinity<double>(), copysign(0.0, z.imag()));
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
template <typename T>
|
| 54 |
+
__host__ __device__
|
| 55 |
+
inline thrust::complex<T> proj(const thrust::complex<T>& z){
|
| 56 |
+
return detail::complex::cproj(z);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
template <>
|
| 61 |
+
__host__ __device__
|
| 62 |
+
inline thrust::complex<double> proj(const thrust::complex<double>& z){
|
| 63 |
+
return detail::complex::cproj(z);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
template <>
|
| 67 |
+
__host__ __device__
|
| 68 |
+
inline thrust::complex<float> proj(const thrust::complex<float>& z){
|
| 69 |
+
return detail::complex::cprojf(z);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csinh.h
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice unmodified, this list of conditions, and the following
|
| 27 |
+
* disclaimer.
|
| 28 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 29 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 30 |
+
* documentation and/or other materials provided with the distribution.
|
| 31 |
+
*
|
| 32 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 33 |
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 34 |
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 35 |
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 36 |
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 37 |
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 38 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 39 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 40 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 41 |
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSD:
|
| 45 |
+
* lib/msun/src/s_csinh.c
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
#pragma once
|
| 50 |
+
|
| 51 |
+
#include <thrust/detail/config.h>
|
| 52 |
+
|
| 53 |
+
#include <thrust/complex.h>
|
| 54 |
+
#include <thrust/detail/complex/math_private.h>
|
| 55 |
+
|
| 56 |
+
THRUST_NAMESPACE_BEGIN
|
| 57 |
+
namespace detail{
|
| 58 |
+
namespace complex{
|
| 59 |
+
|
| 60 |
+
using thrust::complex;
|
| 61 |
+
|
| 62 |
+
__host__ __device__ inline
|
| 63 |
+
complex<double> csinh(const complex<double>& z){
|
| 64 |
+
double x, y, h;
|
| 65 |
+
uint32_t hx, hy, ix, iy, lx, ly;
|
| 66 |
+
const double huge = 8.98846567431157953864652595395e+307; // 0x1p1023;
|
| 67 |
+
|
| 68 |
+
x = z.real();
|
| 69 |
+
y = z.imag();
|
| 70 |
+
|
| 71 |
+
extract_words(hx, lx, x);
|
| 72 |
+
extract_words(hy, ly, y);
|
| 73 |
+
|
| 74 |
+
ix = 0x7fffffff & hx;
|
| 75 |
+
iy = 0x7fffffff & hy;
|
| 76 |
+
|
| 77 |
+
/* Handle the nearly-non-exceptional cases where x and y are finite. */
|
| 78 |
+
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
|
| 79 |
+
if ((iy | ly) == 0)
|
| 80 |
+
return (complex<double>(sinh(x), y));
|
| 81 |
+
if (ix < 0x40360000) /* small x: normal case */
|
| 82 |
+
return (complex<double>(sinh(x) * cos(y), cosh(x) * sin(y)));
|
| 83 |
+
|
| 84 |
+
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
|
| 85 |
+
if (ix < 0x40862e42) {
|
| 86 |
+
/* x < 710: exp(|x|) won't overflow */
|
| 87 |
+
h = exp(fabs(x)) * 0.5;
|
| 88 |
+
return (complex<double>(copysign(h, x) * cos(y), h * sin(y)));
|
| 89 |
+
} else if (ix < 0x4096bbaa) {
|
| 90 |
+
/* x < 1455: scale to avoid overflow */
|
| 91 |
+
complex<double> z_ = ldexp_cexp(complex<double>(fabs(x), y), -1);
|
| 92 |
+
return (complex<double>(z_.real() * copysign(1.0, x), z_.imag()));
|
| 93 |
+
} else {
|
| 94 |
+
/* x >= 1455: the result always overflows */
|
| 95 |
+
h = huge * x;
|
| 96 |
+
return (complex<double>(h * cos(y), h * h * sin(y)));
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/*
|
| 101 |
+
* sinh(+-0 +- I Inf) = sign(d(+-0, dNaN))0 + I dNaN.
|
| 102 |
+
* The sign of 0 in the result is unspecified. Choice = normally
|
| 103 |
+
* the same as dNaN. Raise the invalid floating-point exception.
|
| 104 |
+
*
|
| 105 |
+
* sinh(+-0 +- I NaN) = sign(d(+-0, NaN))0 + I d(NaN).
|
| 106 |
+
* The sign of 0 in the result is unspecified. Choice = normally
|
| 107 |
+
* the same as d(NaN).
|
| 108 |
+
*/
|
| 109 |
+
if ((ix | lx) == 0 && iy >= 0x7ff00000)
|
| 110 |
+
return (complex<double>(copysign(0.0, x * (y - y)), y - y));
|
| 111 |
+
|
| 112 |
+
/*
|
| 113 |
+
* sinh(+-Inf +- I 0) = +-Inf + I +-0.
|
| 114 |
+
*
|
| 115 |
+
* sinh(NaN +- I 0) = d(NaN) + I +-0.
|
| 116 |
+
*/
|
| 117 |
+
if ((iy | ly) == 0 && ix >= 0x7ff00000) {
|
| 118 |
+
if (((hx & 0xfffff) | lx) == 0)
|
| 119 |
+
return (complex<double>(x, y));
|
| 120 |
+
return (complex<double>(x, copysign(0.0, y)));
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/*
|
| 124 |
+
* sinh(x +- I Inf) = dNaN + I dNaN.
|
| 125 |
+
* Raise the invalid floating-point exception for finite nonzero x.
|
| 126 |
+
*
|
| 127 |
+
* sinh(x + I NaN) = d(NaN) + I d(NaN).
|
| 128 |
+
* Optionally raises the invalid floating-point exception for finite
|
| 129 |
+
* nonzero x. Choice = don't raise (except for signaling NaNs).
|
| 130 |
+
*/
|
| 131 |
+
if (ix < 0x7ff00000 && iy >= 0x7ff00000)
|
| 132 |
+
return (complex<double>(y - y, x * (y - y)));
|
| 133 |
+
|
| 134 |
+
/*
|
| 135 |
+
* sinh(+-Inf + I NaN) = +-Inf + I d(NaN).
|
| 136 |
+
* The sign of Inf in the result is unspecified. Choice = normally
|
| 137 |
+
* the same as d(NaN).
|
| 138 |
+
*
|
| 139 |
+
* sinh(+-Inf +- I Inf) = +Inf + I dNaN.
|
| 140 |
+
* The sign of Inf in the result is unspecified. Choice = always +.
|
| 141 |
+
* Raise the invalid floating-point exception.
|
| 142 |
+
*
|
| 143 |
+
* sinh(+-Inf + I y) = +-Inf cos(y) + I Inf sin(y)
|
| 144 |
+
*/
|
| 145 |
+
if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) {
|
| 146 |
+
if (iy >= 0x7ff00000)
|
| 147 |
+
return (complex<double>(x * x, x * (y - y)));
|
| 148 |
+
return (complex<double>(x * cos(y), infinity<double>() * sin(y)));
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/*
|
| 152 |
+
* sinh(NaN + I NaN) = d(NaN) + I d(NaN).
|
| 153 |
+
*
|
| 154 |
+
* sinh(NaN +- I Inf) = d(NaN) + I d(NaN).
|
| 155 |
+
* Optionally raises the invalid floating-point exception.
|
| 156 |
+
* Choice = raise.
|
| 157 |
+
*
|
| 158 |
+
* sinh(NaN + I y) = d(NaN) + I d(NaN).
|
| 159 |
+
* Optionally raises the invalid floating-point exception for finite
|
| 160 |
+
* nonzero y. Choice = don't raise (except for signaling NaNs).
|
| 161 |
+
*/
|
| 162 |
+
return (complex<double>((x * x) * (y - y), (x + x) * (y - y)));
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
__host__ __device__ inline
|
| 166 |
+
complex<double> csin(complex<double> z){
|
| 167 |
+
/* csin(z) = -I * csinh(I * z) */
|
| 168 |
+
z = csinh(complex<double>(-z.imag(), z.real()));
|
| 169 |
+
return (complex<double>(z.imag(), -z.real()));
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
} // namespace complex
|
| 173 |
+
|
| 174 |
+
} // namespace detail
|
| 175 |
+
|
| 176 |
+
template <typename ValueType>
|
| 177 |
+
__host__ __device__
|
| 178 |
+
inline complex<ValueType> sin(const complex<ValueType>& z){
|
| 179 |
+
const ValueType re = z.real();
|
| 180 |
+
const ValueType im = z.imag();
|
| 181 |
+
return complex<ValueType>(std::sin(re) * std::cosh(im),
|
| 182 |
+
std::cos(re) * std::sinh(im));
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
template <typename ValueType>
|
| 187 |
+
__host__ __device__
|
| 188 |
+
inline complex<ValueType> sinh(const complex<ValueType>& z){
|
| 189 |
+
const ValueType re = z.real();
|
| 190 |
+
const ValueType im = z.imag();
|
| 191 |
+
return complex<ValueType>(std::sinh(re) * std::cos(im),
|
| 192 |
+
std::cosh(re) * std::sin(im));
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
template <>
|
| 196 |
+
__host__ __device__
|
| 197 |
+
inline complex<double> sin(const complex<double>& z){
|
| 198 |
+
return detail::complex::csin(z);
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
template <>
|
| 202 |
+
__host__ __device__
|
| 203 |
+
inline complex<double> sinh(const complex<double>& z){
|
| 204 |
+
return detail::complex::csinh(z);
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csinhf.h
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice unmodified, this list of conditions, and the following
|
| 27 |
+
* disclaimer.
|
| 28 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 29 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 30 |
+
* documentation and/or other materials provided with the distribution.
|
| 31 |
+
*
|
| 32 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 33 |
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 34 |
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 35 |
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 36 |
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 37 |
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 38 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 39 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 40 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 41 |
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/* adapted from FreeBSD:
|
| 45 |
+
* lib/msun/src/s_csinhf.c
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
#pragma once
|
| 50 |
+
|
| 51 |
+
#include <thrust/detail/config.h>
|
| 52 |
+
|
| 53 |
+
#include <thrust/complex.h>
|
| 54 |
+
#include <thrust/detail/complex/math_private.h>
|
| 55 |
+
|
| 56 |
+
THRUST_NAMESPACE_BEGIN
|
| 57 |
+
namespace detail{
|
| 58 |
+
namespace complex{
|
| 59 |
+
|
| 60 |
+
using thrust::complex;
|
| 61 |
+
|
| 62 |
+
__host__ __device__ inline
|
| 63 |
+
complex<float> csinhf(const complex<float>& z){
|
| 64 |
+
|
| 65 |
+
float x, y, h;
|
| 66 |
+
uint32_t hx, hy, ix, iy;
|
| 67 |
+
|
| 68 |
+
const float huge = 1.70141183460469231731687303716e+38; //0x1p127;
|
| 69 |
+
|
| 70 |
+
x = z.real();
|
| 71 |
+
y = z.imag();
|
| 72 |
+
|
| 73 |
+
get_float_word(hx, x);
|
| 74 |
+
get_float_word(hy, y);
|
| 75 |
+
|
| 76 |
+
ix = 0x7fffffff & hx;
|
| 77 |
+
iy = 0x7fffffff & hy;
|
| 78 |
+
|
| 79 |
+
if (ix < 0x7f800000 && iy < 0x7f800000) {
|
| 80 |
+
if (iy == 0)
|
| 81 |
+
return (complex<float>(sinhf(x), y));
|
| 82 |
+
if (ix < 0x41100000) /* small x: normal case */
|
| 83 |
+
return (complex<float>(sinhf(x) * cosf(y), coshf(x) * sinf(y)));
|
| 84 |
+
|
| 85 |
+
/* |x| >= 9, so cosh(x) ~= exp(|x|) */
|
| 86 |
+
if (ix < 0x42b17218) {
|
| 87 |
+
/* x < 88.7: expf(|x|) won't overflow */
|
| 88 |
+
h = expf(fabsf(x)) * 0.5f;
|
| 89 |
+
return (complex<float>(copysignf(h, x) * cosf(y), h * sinf(y)));
|
| 90 |
+
} else if (ix < 0x4340b1e7) {
|
| 91 |
+
/* x < 192.7: scale to avoid overflow */
|
| 92 |
+
complex<float> z_ = ldexp_cexpf(complex<float>(fabsf(x), y), -1);
|
| 93 |
+
return (complex<float>(z_.real() * copysignf(1.0f, x), z_.imag()));
|
| 94 |
+
} else {
|
| 95 |
+
/* x >= 192.7: the result always overflows */
|
| 96 |
+
h = huge * x;
|
| 97 |
+
return (complex<float>(h * cosf(y), h * h * sinf(y)));
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
if (ix == 0 && iy >= 0x7f800000)
|
| 102 |
+
return (complex<float>(copysignf(0, x * (y - y)), y - y));
|
| 103 |
+
|
| 104 |
+
if (iy == 0 && ix >= 0x7f800000) {
|
| 105 |
+
if ((hx & 0x7fffff) == 0)
|
| 106 |
+
return (complex<float>(x, y));
|
| 107 |
+
return (complex<float>(x, copysignf(0.0f, y)));
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
if (ix < 0x7f800000 && iy >= 0x7f800000)
|
| 111 |
+
return (complex<float>(y - y, x * (y - y)));
|
| 112 |
+
|
| 113 |
+
if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) {
|
| 114 |
+
if (iy >= 0x7f800000)
|
| 115 |
+
return (complex<float>(x * x, x * (y - y)));
|
| 116 |
+
return (complex<float>(x * cosf(y), infinity<float>() * sinf(y)));
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
return (complex<float>((x * x) * (y - y), (x + x) * (y - y)));
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
__host__ __device__ inline
|
| 123 |
+
complex<float> csinf(complex<float> z){
|
| 124 |
+
z = csinhf(complex<float>(-z.imag(), z.real()));
|
| 125 |
+
return (complex<float>(z.imag(), -z.real()));
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
} // namespace complex
|
| 129 |
+
|
| 130 |
+
} // namespace detail
|
| 131 |
+
|
| 132 |
+
template <>
|
| 133 |
+
__host__ __device__
|
| 134 |
+
inline complex<float> sin(const complex<float>& z){
|
| 135 |
+
return detail::complex::csinf(z);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
template <>
|
| 139 |
+
__host__ __device__
|
| 140 |
+
inline complex<float> sinh(const complex<float>& z){
|
| 141 |
+
return detail::complex::csinhf(z);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csqrt.h
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2007 David Schultz <das@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* Adapted from FreeBSD by Filipe Maia <filipe.c.maia@gmail.com>:
|
| 46 |
+
* freebsd/lib/msun/src/s_csqrt.c
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
#pragma once
|
| 51 |
+
|
| 52 |
+
#include <thrust/detail/config.h>
|
| 53 |
+
|
| 54 |
+
#include <thrust/complex.h>
|
| 55 |
+
#include <thrust/detail/complex/math_private.h>
|
| 56 |
+
#include <cmath>
|
| 57 |
+
|
| 58 |
+
THRUST_NAMESPACE_BEGIN
|
| 59 |
+
namespace detail{
|
| 60 |
+
namespace complex{
|
| 61 |
+
|
| 62 |
+
using thrust::complex;
|
| 63 |
+
|
| 64 |
+
__host__ __device__ inline
|
| 65 |
+
complex<double> csqrt(const complex<double>& z){
|
| 66 |
+
complex<double> result;
|
| 67 |
+
double a, b;
|
| 68 |
+
double t;
|
| 69 |
+
int scale;
|
| 70 |
+
|
| 71 |
+
/* We risk spurious overflow for components >= DBL_MAX / (1 + sqrt(2)). */
|
| 72 |
+
const double THRESH = 7.446288774449766337959726e+307;
|
| 73 |
+
|
| 74 |
+
a = z.real();
|
| 75 |
+
b = z.imag();
|
| 76 |
+
|
| 77 |
+
/* Handle special cases. */
|
| 78 |
+
if (z == 0.0)
|
| 79 |
+
return (complex<double>(0.0, b));
|
| 80 |
+
if (isinf(b))
|
| 81 |
+
return (complex<double>(infinity<double>(), b));
|
| 82 |
+
if (isnan(a)) {
|
| 83 |
+
t = (b - b) / (b - b); /* raise invalid if b is not a NaN */
|
| 84 |
+
return (complex<double>(a, t)); /* return NaN + NaN i */
|
| 85 |
+
}
|
| 86 |
+
if (isinf(a)) {
|
| 87 |
+
/*
|
| 88 |
+
* csqrt(inf + NaN i) = inf + NaN i
|
| 89 |
+
* csqrt(inf + y i) = inf + 0 i
|
| 90 |
+
* csqrt(-inf + NaN i) = NaN +- inf i
|
| 91 |
+
* csqrt(-inf + y i) = 0 + inf i
|
| 92 |
+
*/
|
| 93 |
+
if (signbit(a))
|
| 94 |
+
return (complex<double>(fabs(b - b), copysign(a, b)));
|
| 95 |
+
else
|
| 96 |
+
return (complex<double>(a, copysign(b - b, b)));
|
| 97 |
+
}
|
| 98 |
+
/*
|
| 99 |
+
* The remaining special case (b is NaN) is handled just fine by
|
| 100 |
+
* the normal code path below.
|
| 101 |
+
*/
|
| 102 |
+
|
| 103 |
+
// DBL_MIN*2
|
| 104 |
+
const double low_thresh = 4.450147717014402766180465e-308;
|
| 105 |
+
scale = 0;
|
| 106 |
+
|
| 107 |
+
if (fabs(a) >= THRESH || fabs(b) >= THRESH) {
|
| 108 |
+
/* Scale to avoid overflow. */
|
| 109 |
+
a *= 0.25;
|
| 110 |
+
b *= 0.25;
|
| 111 |
+
scale = 1;
|
| 112 |
+
}else if (fabs(a) <= low_thresh && fabs(b) <= low_thresh) {
|
| 113 |
+
/* Scale to avoid underflow. */
|
| 114 |
+
a *= 4.0;
|
| 115 |
+
b *= 4.0;
|
| 116 |
+
scale = 2;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
/* Algorithm 312, CACM vol 10, Oct 1967. */
|
| 121 |
+
if (a >= 0.0) {
|
| 122 |
+
t = sqrt((a + hypot(a, b)) * 0.5);
|
| 123 |
+
result = complex<double>(t, b / (2 * t));
|
| 124 |
+
} else {
|
| 125 |
+
t = sqrt((-a + hypot(a, b)) * 0.5);
|
| 126 |
+
result = complex<double>(fabs(b) / (2 * t), copysign(t, b));
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/* Rescale. */
|
| 130 |
+
if (scale == 1)
|
| 131 |
+
return (result * 2.0);
|
| 132 |
+
else if (scale == 2)
|
| 133 |
+
return (result * 0.5);
|
| 134 |
+
else
|
| 135 |
+
return (result);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
} // namespace complex
|
| 139 |
+
|
| 140 |
+
} // namespace detail
|
| 141 |
+
|
| 142 |
+
template <typename ValueType>
|
| 143 |
+
__host__ __device__
|
| 144 |
+
inline complex<ValueType> sqrt(const complex<ValueType>& z){
|
| 145 |
+
return thrust::polar(std::sqrt(thrust::abs(z)),thrust::arg(z)/ValueType(2));
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
template <>
|
| 149 |
+
__host__ __device__
|
| 150 |
+
inline complex<double> sqrt(const complex<double>& z){
|
| 151 |
+
return detail::complex::csqrt(z);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/csqrtf.h
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2007 David Schultz <das@FreeBSD.ORG>
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice, this list of conditions and the following disclaimer.
|
| 27 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 28 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 29 |
+
* documentation and/or other materials provided with the distribution.
|
| 30 |
+
*
|
| 31 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
| 32 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 33 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 34 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
| 37 |
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 38 |
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 39 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 40 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 41 |
+
* SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* Adapted from FreeBSD by Filipe Maia <filipe.c.maia@gmail.com>:
|
| 46 |
+
* freebsd/lib/msun/src/s_csqrt.c
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
#pragma once
|
| 51 |
+
|
| 52 |
+
#include <thrust/detail/config.h>
|
| 53 |
+
|
| 54 |
+
#include <thrust/complex.h>
|
| 55 |
+
#include <thrust/detail/complex/math_private.h>
|
| 56 |
+
#include <cmath>
|
| 57 |
+
|
| 58 |
+
THRUST_NAMESPACE_BEGIN
|
| 59 |
+
namespace detail{
|
| 60 |
+
namespace complex{
|
| 61 |
+
|
| 62 |
+
using thrust::complex;
|
| 63 |
+
|
| 64 |
+
__host__ __device__ inline
|
| 65 |
+
complex<float> csqrtf(const complex<float>& z){
|
| 66 |
+
float a = z.real(), b = z.imag();
|
| 67 |
+
float t;
|
| 68 |
+
int scale;
|
| 69 |
+
complex<float> result;
|
| 70 |
+
|
| 71 |
+
/* We risk spurious overflow for components >= FLT_MAX / (1 + sqrt(2)). */
|
| 72 |
+
const float THRESH = 1.40949553037932e+38f;
|
| 73 |
+
|
| 74 |
+
/* Handle special cases. */
|
| 75 |
+
if (z == 0.0f)
|
| 76 |
+
return (complex<float>(0, b));
|
| 77 |
+
if (isinf(b))
|
| 78 |
+
return (complex<float>(infinity<float>(), b));
|
| 79 |
+
if (isnan(a)) {
|
| 80 |
+
t = (b - b) / (b - b); /* raise invalid if b is not a NaN */
|
| 81 |
+
return (complex<float>(a, t)); /* return NaN + NaN i */
|
| 82 |
+
}
|
| 83 |
+
if (isinf(a)) {
|
| 84 |
+
/*
|
| 85 |
+
* csqrtf(inf + NaN i) = inf + NaN i
|
| 86 |
+
* csqrtf(inf + y i) = inf + 0 i
|
| 87 |
+
* csqrtf(-inf + NaN i) = NaN +- inf i
|
| 88 |
+
* csqrtf(-inf + y i) = 0 + inf i
|
| 89 |
+
*/
|
| 90 |
+
if (signbit(a))
|
| 91 |
+
return (complex<float>(fabsf(b - b), copysignf(a, b)));
|
| 92 |
+
else
|
| 93 |
+
return (complex<float>(a, copysignf(b - b, b)));
|
| 94 |
+
}
|
| 95 |
+
/*
|
| 96 |
+
* The remaining special case (b is NaN) is handled just fine by
|
| 97 |
+
* the normal code path below.
|
| 98 |
+
*/
|
| 99 |
+
|
| 100 |
+
/*
|
| 101 |
+
* Unlike in the FreeBSD code we'll avoid using double precision as
|
| 102 |
+
* not all hardware supports it.
|
| 103 |
+
*/
|
| 104 |
+
|
| 105 |
+
// FLT_MIN*2
|
| 106 |
+
const float low_thresh = 2.35098870164458e-38f;
|
| 107 |
+
scale = 0;
|
| 108 |
+
|
| 109 |
+
if (fabsf(a) >= THRESH || fabsf(b) >= THRESH) {
|
| 110 |
+
/* Scale to avoid overflow. */
|
| 111 |
+
a *= 0.25f;
|
| 112 |
+
b *= 0.25f;
|
| 113 |
+
scale = 1;
|
| 114 |
+
}else if (fabsf(a) <= low_thresh && fabsf(b) <= low_thresh) {
|
| 115 |
+
/* Scale to avoid underflow. */
|
| 116 |
+
a *= 4.f;
|
| 117 |
+
b *= 4.f;
|
| 118 |
+
scale = 2;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/* Algorithm 312, CACM vol 10, Oct 1967. */
|
| 122 |
+
if (a >= 0.0f) {
|
| 123 |
+
t = sqrtf((a + hypotf(a, b)) * 0.5f);
|
| 124 |
+
result = complex<float>(t, b / (2.0f * t));
|
| 125 |
+
} else {
|
| 126 |
+
t = sqrtf((-a + hypotf(a, b)) * 0.5f);
|
| 127 |
+
result = complex<float>(fabsf(b) / (2.0f * t), copysignf(t, b));
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/* Rescale. */
|
| 131 |
+
if (scale == 1)
|
| 132 |
+
return (result * 2.0f);
|
| 133 |
+
else if (scale == 2)
|
| 134 |
+
return (result * 0.5f);
|
| 135 |
+
else
|
| 136 |
+
return (result);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
} // namespace complex
|
| 140 |
+
|
| 141 |
+
} // namespace detail
|
| 142 |
+
|
| 143 |
+
template <>
|
| 144 |
+
__host__ __device__
|
| 145 |
+
inline complex<float> sqrt(const complex<float>& z){
|
| 146 |
+
return detail::complex::csqrtf(z);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ctanh.h
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2011 David Schultz
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice unmodified, this list of conditions, and the following
|
| 27 |
+
* disclaimer.
|
| 28 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 29 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 30 |
+
* documentation and/or other materials provided with the distribution.
|
| 31 |
+
*
|
| 32 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 33 |
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 34 |
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 35 |
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 36 |
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 37 |
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 38 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 39 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 40 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 41 |
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* Adapted from FreeBSD by Filipe Maia <filipe.c.maia@gmail.com>:
|
| 46 |
+
* freebsd/lib/msun/src/s_ctanh.c
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
/*
|
| 50 |
+
* Hyperbolic tangent of a complex argument z = x + i y.
|
| 51 |
+
*
|
| 52 |
+
* The algorithm is from:
|
| 53 |
+
*
|
| 54 |
+
* W. Kahan. Branch Cuts for Complex Elementary Functions or Much
|
| 55 |
+
* Ado About Nothing's Sign Bit. In The State of the Art in
|
| 56 |
+
* Numerical Analysis, pp. 165 ff. Iserles and Powell, eds., 1987.
|
| 57 |
+
*
|
| 58 |
+
* Method:
|
| 59 |
+
*
|
| 60 |
+
* Let t = tan(x)
|
| 61 |
+
* beta = 1/cos^2(y)
|
| 62 |
+
* s = sinh(x)
|
| 63 |
+
* rho = cosh(x)
|
| 64 |
+
*
|
| 65 |
+
* We have:
|
| 66 |
+
*
|
| 67 |
+
* tanh(z) = sinh(z) / cosh(z)
|
| 68 |
+
*
|
| 69 |
+
* sinh(x) cos(y) + i cosh(x) sin(y)
|
| 70 |
+
* = ---------------------------------
|
| 71 |
+
* cosh(x) cos(y) + i sinh(x) sin(y)
|
| 72 |
+
*
|
| 73 |
+
* cosh(x) sinh(x) / cos^2(y) + i tan(y)
|
| 74 |
+
* = -------------------------------------
|
| 75 |
+
* 1 + sinh^2(x) / cos^2(y)
|
| 76 |
+
*
|
| 77 |
+
* beta rho s + i t
|
| 78 |
+
* = ----------------
|
| 79 |
+
* 1 + beta s^2
|
| 80 |
+
*
|
| 81 |
+
* Modifications:
|
| 82 |
+
*
|
| 83 |
+
* I omitted the original algorithm's handling of overflow in tan(x) after
|
| 84 |
+
* verifying with nearpi.c that this can't happen in IEEE single or double
|
| 85 |
+
* precision. I also handle large x differently.
|
| 86 |
+
*/
|
| 87 |
+
|
| 88 |
+
#pragma once
|
| 89 |
+
|
| 90 |
+
#include <thrust/detail/config.h>
|
| 91 |
+
|
| 92 |
+
#include <thrust/complex.h>
|
| 93 |
+
#include <thrust/detail/complex/math_private.h>
|
| 94 |
+
#include <cmath>
|
| 95 |
+
|
| 96 |
+
THRUST_NAMESPACE_BEGIN
|
| 97 |
+
namespace detail{
|
| 98 |
+
namespace complex{
|
| 99 |
+
|
| 100 |
+
using thrust::complex;
|
| 101 |
+
|
| 102 |
+
__host__ __device__ inline
|
| 103 |
+
complex<double> ctanh(const complex<double>& z){
|
| 104 |
+
double x, y;
|
| 105 |
+
double t, beta, s, rho, denom;
|
| 106 |
+
uint32_t hx, ix, lx;
|
| 107 |
+
|
| 108 |
+
x = z.real();
|
| 109 |
+
y = z.imag();
|
| 110 |
+
|
| 111 |
+
extract_words(hx, lx, x);
|
| 112 |
+
ix = hx & 0x7fffffff;
|
| 113 |
+
|
| 114 |
+
/*
|
| 115 |
+
* ctanh(NaN + i 0) = NaN + i 0
|
| 116 |
+
*
|
| 117 |
+
* ctanh(NaN + i y) = NaN + i NaN for y != 0
|
| 118 |
+
*
|
| 119 |
+
* The imaginary part has the sign of x*sin(2*y), but there's no
|
| 120 |
+
* special effort to get this right.
|
| 121 |
+
*
|
| 122 |
+
* ctanh(+-Inf +- i Inf) = +-1 +- 0
|
| 123 |
+
*
|
| 124 |
+
* ctanh(+-Inf + i y) = +-1 + 0 sin(2y) for y finite
|
| 125 |
+
*
|
| 126 |
+
* The imaginary part of the sign is unspecified. This special
|
| 127 |
+
* case is only needed to avoid a spurious invalid exception when
|
| 128 |
+
* y is infinite.
|
| 129 |
+
*/
|
| 130 |
+
if (ix >= 0x7ff00000) {
|
| 131 |
+
if ((ix & 0xfffff) | lx) /* x is NaN */
|
| 132 |
+
return (complex<double>(x, (y == 0 ? y : x * y)));
|
| 133 |
+
set_high_word(x, hx - 0x40000000); /* x = copysign(1, x) */
|
| 134 |
+
return (complex<double>(x, copysign(0.0, isinf(y) ? y : sin(y) * cos(y))));
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/*
|
| 138 |
+
* ctanh(x + i NAN) = NaN + i NaN
|
| 139 |
+
* ctanh(x +- i Inf) = NaN + i NaN
|
| 140 |
+
*/
|
| 141 |
+
if (!isfinite(y))
|
| 142 |
+
return (complex<double>(y - y, y - y));
|
| 143 |
+
|
| 144 |
+
/*
|
| 145 |
+
* ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the
|
| 146 |
+
* approximation sinh^2(huge) ~= exp(2*huge) / 4.
|
| 147 |
+
* We use a modified formula to avoid spurious overflow.
|
| 148 |
+
*/
|
| 149 |
+
if (ix >= 0x40360000) { /* x >= 22 */
|
| 150 |
+
double exp_mx = exp(-fabs(x));
|
| 151 |
+
return (complex<double>(copysign(1.0, x),
|
| 152 |
+
4.0 * sin(y) * cos(y) * exp_mx * exp_mx));
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
/* Kahan's algorithm */
|
| 156 |
+
t = tan(y);
|
| 157 |
+
beta = 1.0 + t * t; /* = 1 / cos^2(y) */
|
| 158 |
+
s = sinh(x);
|
| 159 |
+
rho = sqrt(1.0 + s * s); /* = cosh(x) */
|
| 160 |
+
denom = 1.0 + beta * s * s;
|
| 161 |
+
return (complex<double>((beta * rho * s) / denom, t / denom));
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
__host__ __device__ inline
|
| 165 |
+
complex<double> ctan(complex<double> z){
|
| 166 |
+
/* ctan(z) = -I * ctanh(I * z) */
|
| 167 |
+
z = ctanh(complex<double>(-z.imag(), z.real()));
|
| 168 |
+
return (complex<double>(z.imag(), -z.real()));
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
} // namespace complex
|
| 172 |
+
|
| 173 |
+
} // namespace detail
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
template <typename ValueType>
|
| 177 |
+
__host__ __device__
|
| 178 |
+
inline complex<ValueType> tan(const complex<ValueType>& z){
|
| 179 |
+
return sin(z)/cos(z);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
template <typename ValueType>
|
| 183 |
+
__host__ __device__
|
| 184 |
+
inline complex<ValueType> tanh(const complex<ValueType>& z){
|
| 185 |
+
// This implementation seems better than the simple sin/cos
|
| 186 |
+
return (thrust::exp(ValueType(2)*z)-ValueType(1))/
|
| 187 |
+
(thrust::exp(ValueType(2)*z)+ValueType(1));
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
template <>
|
| 191 |
+
__host__ __device__
|
| 192 |
+
inline complex<double> tan(const complex<double>& z){
|
| 193 |
+
return detail::complex::ctan(z);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
template <>
|
| 197 |
+
__host__ __device__
|
| 198 |
+
inline complex<double> tanh(const complex<double>& z){
|
| 199 |
+
return detail::complex::ctanh(z);
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/ctanhf.h
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*-
|
| 19 |
+
* Copyright (c) 2011 David Schultz
|
| 20 |
+
* All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Redistribution and use in source and binary forms, with or without
|
| 23 |
+
* modification, are permitted provided that the following conditions
|
| 24 |
+
* are met:
|
| 25 |
+
* 1. Redistributions of source code must retain the above copyright
|
| 26 |
+
* notice unmodified, this list of conditions, and the following
|
| 27 |
+
* disclaimer.
|
| 28 |
+
* 2. Redistributions in binary form must reproduce the above copyright
|
| 29 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 30 |
+
* documentation and/or other materials provided with the distribution.
|
| 31 |
+
*
|
| 32 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 33 |
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 34 |
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 35 |
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 36 |
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 37 |
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 38 |
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 39 |
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 40 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 41 |
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* Adapted from FreeBSD by Filipe Maia, filipe.c.maia@gmail.com:
|
| 46 |
+
* freebsd/lib/msun/src/s_ctanhf.c
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
/*
|
| 50 |
+
* Hyperbolic tangent of a complex argument z. See ctanh.c for details.
|
| 51 |
+
*/
|
| 52 |
+
|
| 53 |
+
#pragma once
|
| 54 |
+
|
| 55 |
+
#include <thrust/detail/config.h>
|
| 56 |
+
|
| 57 |
+
#include <thrust/complex.h>
|
| 58 |
+
#include <thrust/detail/complex/math_private.h>
|
| 59 |
+
#include <cmath>
|
| 60 |
+
|
| 61 |
+
THRUST_NAMESPACE_BEGIN
|
| 62 |
+
namespace detail{
|
| 63 |
+
namespace complex{
|
| 64 |
+
|
| 65 |
+
using thrust::complex;
|
| 66 |
+
|
| 67 |
+
__host__ __device__ inline
|
| 68 |
+
complex<float> ctanhf(const complex<float>& z){
|
| 69 |
+
float x, y;
|
| 70 |
+
float t, beta, s, rho, denom;
|
| 71 |
+
uint32_t hx, ix;
|
| 72 |
+
|
| 73 |
+
x = z.real();
|
| 74 |
+
y = z.imag();
|
| 75 |
+
|
| 76 |
+
get_float_word(hx, x);
|
| 77 |
+
ix = hx & 0x7fffffff;
|
| 78 |
+
|
| 79 |
+
if (ix >= 0x7f800000) {
|
| 80 |
+
if (ix & 0x7fffff)
|
| 81 |
+
return (complex<float>(x, (y == 0.0f ? y : x * y)));
|
| 82 |
+
set_float_word(x, hx - 0x40000000);
|
| 83 |
+
return (complex<float>(x,
|
| 84 |
+
copysignf(0, isinf(y) ? y : sinf(y) * cosf(y))));
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
if (!isfinite(y))
|
| 88 |
+
return (complex<float>(y - y, y - y));
|
| 89 |
+
|
| 90 |
+
if (ix >= 0x41300000) { /* x >= 11 */
|
| 91 |
+
float exp_mx = expf(-fabsf(x));
|
| 92 |
+
return (complex<float>(copysignf(1.0f, x),
|
| 93 |
+
4.0f * sinf(y) * cosf(y) * exp_mx * exp_mx));
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
t = tanf(y);
|
| 97 |
+
beta = 1.0f + t * t;
|
| 98 |
+
s = sinhf(x);
|
| 99 |
+
rho = sqrtf(1.0f + s * s);
|
| 100 |
+
denom = 1.0f + beta * s * s;
|
| 101 |
+
return (complex<float>((beta * rho * s) / denom, t / denom));
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
__host__ __device__ inline
|
| 105 |
+
complex<float> ctanf(complex<float> z){
|
| 106 |
+
z = ctanhf(complex<float>(-z.imag(), z.real()));
|
| 107 |
+
return (complex<float>(z.imag(), -z.real()));
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
} // namespace complex
|
| 111 |
+
|
| 112 |
+
} // namespace detail
|
| 113 |
+
|
| 114 |
+
template <>
|
| 115 |
+
__host__ __device__
|
| 116 |
+
inline complex<float> tan(const complex<float>& z){
|
| 117 |
+
return detail::complex::ctanf(z);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
template <>
|
| 121 |
+
__host__ __device__
|
| 122 |
+
inline complex<float> tanh(const complex<float>& z){
|
| 123 |
+
return detail::complex::ctanhf(z);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/math_private.h
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*
|
| 19 |
+
* ====================================================
|
| 20 |
+
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
| 21 |
+
*
|
| 22 |
+
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
| 23 |
+
* Permission to use, copy, modify, and distribute this
|
| 24 |
+
* software is freely granted, provided that this notice
|
| 25 |
+
* is preserved.
|
| 26 |
+
* ====================================================
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/* adapted from FreeBSD:
|
| 30 |
+
* lib/msun/src/math_private.h
|
| 31 |
+
*/
|
| 32 |
+
#pragma once
|
| 33 |
+
|
| 34 |
+
#include <thrust/detail/config.h>
|
| 35 |
+
#include <thrust/complex.h>
|
| 36 |
+
#include <thrust/detail/cstdint.h>
|
| 37 |
+
|
| 38 |
+
THRUST_NAMESPACE_BEGIN
|
| 39 |
+
namespace detail{
|
| 40 |
+
namespace complex{
|
| 41 |
+
|
| 42 |
+
using thrust::complex;
|
| 43 |
+
|
| 44 |
+
typedef union
|
| 45 |
+
{
|
| 46 |
+
float value;
|
| 47 |
+
uint32_t word;
|
| 48 |
+
} ieee_float_shape_type;
|
| 49 |
+
|
| 50 |
+
__host__ __device__
|
| 51 |
+
inline void get_float_word(uint32_t & i, float d){
|
| 52 |
+
ieee_float_shape_type gf_u;
|
| 53 |
+
gf_u.value = (d);
|
| 54 |
+
(i) = gf_u.word;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
__host__ __device__
|
| 58 |
+
inline void get_float_word(int32_t & i, float d){
|
| 59 |
+
ieee_float_shape_type gf_u;
|
| 60 |
+
gf_u.value = (d);
|
| 61 |
+
(i) = gf_u.word;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
__host__ __device__
|
| 65 |
+
inline void set_float_word(float & d, uint32_t i){
|
| 66 |
+
ieee_float_shape_type sf_u;
|
| 67 |
+
sf_u.word = (i);
|
| 68 |
+
(d) = sf_u.value;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// Assumes little endian ordering
|
| 72 |
+
typedef union
|
| 73 |
+
{
|
| 74 |
+
double value;
|
| 75 |
+
struct
|
| 76 |
+
{
|
| 77 |
+
uint32_t lsw;
|
| 78 |
+
uint32_t msw;
|
| 79 |
+
} parts;
|
| 80 |
+
struct
|
| 81 |
+
{
|
| 82 |
+
uint64_t w;
|
| 83 |
+
} xparts;
|
| 84 |
+
} ieee_double_shape_type;
|
| 85 |
+
|
| 86 |
+
__host__ __device__ inline
|
| 87 |
+
void get_high_word(uint32_t & i,double d){
|
| 88 |
+
ieee_double_shape_type gh_u;
|
| 89 |
+
gh_u.value = (d);
|
| 90 |
+
(i) = gh_u.parts.msw;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/* Set the more significant 32 bits of a double from an int. */
|
| 94 |
+
__host__ __device__ inline
|
| 95 |
+
void set_high_word(double & d, uint32_t v){
|
| 96 |
+
ieee_double_shape_type sh_u;
|
| 97 |
+
sh_u.value = (d);
|
| 98 |
+
sh_u.parts.msw = (v);
|
| 99 |
+
(d) = sh_u.value;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
__host__ __device__ inline
|
| 104 |
+
void insert_words(double & d, uint32_t ix0, uint32_t ix1){
|
| 105 |
+
ieee_double_shape_type iw_u;
|
| 106 |
+
iw_u.parts.msw = (ix0);
|
| 107 |
+
iw_u.parts.lsw = (ix1);
|
| 108 |
+
(d) = iw_u.value;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/* Get two 32 bit ints from a double. */
|
| 112 |
+
__host__ __device__ inline
|
| 113 |
+
void extract_words(uint32_t & ix0,uint32_t & ix1, double d){
|
| 114 |
+
ieee_double_shape_type ew_u;
|
| 115 |
+
ew_u.value = (d);
|
| 116 |
+
(ix0) = ew_u.parts.msw;
|
| 117 |
+
(ix1) = ew_u.parts.lsw;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/* Get two 32 bit ints from a double. */
|
| 121 |
+
__host__ __device__ inline
|
| 122 |
+
void extract_words(int32_t & ix0,int32_t & ix1, double d){
|
| 123 |
+
ieee_double_shape_type ew_u;
|
| 124 |
+
ew_u.value = (d);
|
| 125 |
+
(ix0) = ew_u.parts.msw;
|
| 126 |
+
(ix1) = ew_u.parts.lsw;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
} // namespace complex
|
| 130 |
+
|
| 131 |
+
} // namespace detail
|
| 132 |
+
|
| 133 |
+
THRUST_NAMESPACE_END
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
#include <thrust/detail/complex/c99math.h>
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/complex/stream.h
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2021 NVIDIA Corporation
|
| 3 |
+
* Copyright 2013 Filipe RNC Maia
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <thrust/detail/config.h>
|
| 21 |
+
|
| 22 |
+
#include <thrust/complex.h>
|
| 23 |
+
|
| 24 |
+
THRUST_NAMESPACE_BEGIN
|
| 25 |
+
template<typename ValueType,class charT, class traits>
|
| 26 |
+
std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& os, const complex<ValueType>& z)
|
| 27 |
+
{
|
| 28 |
+
os << '(' << z.real() << ',' << z.imag() << ')';
|
| 29 |
+
return os;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
template<typename ValueType, typename charT, class traits>
|
| 33 |
+
std::basic_istream<charT, traits>&
|
| 34 |
+
operator>>(std::basic_istream<charT, traits>& is, complex<ValueType>& z)
|
| 35 |
+
{
|
| 36 |
+
ValueType re, im;
|
| 37 |
+
|
| 38 |
+
charT ch;
|
| 39 |
+
is >> ch;
|
| 40 |
+
|
| 41 |
+
if(ch == '(')
|
| 42 |
+
{
|
| 43 |
+
is >> re >> ch;
|
| 44 |
+
if (ch == ',')
|
| 45 |
+
{
|
| 46 |
+
is >> im >> ch;
|
| 47 |
+
if (ch == ')')
|
| 48 |
+
{
|
| 49 |
+
z = complex<ValueType>(re, im);
|
| 50 |
+
}
|
| 51 |
+
else
|
| 52 |
+
{
|
| 53 |
+
is.setstate(std::ios_base::failbit);
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
else if (ch == ')')
|
| 57 |
+
{
|
| 58 |
+
z = re;
|
| 59 |
+
}
|
| 60 |
+
else
|
| 61 |
+
{
|
| 62 |
+
is.setstate(std::ios_base::failbit);
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
else
|
| 66 |
+
{
|
| 67 |
+
is.putback(ch);
|
| 68 |
+
is >> re;
|
| 69 |
+
z = re;
|
| 70 |
+
}
|
| 71 |
+
return is;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/config/debug.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#ifndef THRUST_DEBUG
|
| 20 |
+
# ifndef NDEBUG
|
| 21 |
+
# if defined(DEBUG) || defined(_DEBUG)
|
| 22 |
+
# define THRUST_DEBUG 1
|
| 23 |
+
# endif // (DEBUG || _DEBUG)
|
| 24 |
+
# endif // NDEBUG
|
| 25 |
+
#endif // THRUST_DEBUG
|
| 26 |
+
|
| 27 |
+
#if THRUST_DEBUG
|
| 28 |
+
# ifndef __THRUST_SYNCHRONOUS
|
| 29 |
+
# define __THRUST_SYNCHRONOUS 1
|
| 30 |
+
# endif // __THRUST_SYNCHRONOUS
|
| 31 |
+
#endif // THRUST_DEBUG
|
| 32 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/actor.h
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
// Portions of this code are derived from
|
| 18 |
+
//
|
| 19 |
+
// Manjunath Kudlur's Carbon library
|
| 20 |
+
//
|
| 21 |
+
// and
|
| 22 |
+
//
|
| 23 |
+
// Based on Boost.Phoenix v1.2
|
| 24 |
+
// Copyright (c) 2001-2002 Joel de Guzman
|
| 25 |
+
|
| 26 |
+
#pragma once
|
| 27 |
+
|
| 28 |
+
#include <thrust/detail/config.h>
|
| 29 |
+
#include <thrust/tuple.h>
|
| 30 |
+
#include <thrust/detail/functional/value.h>
|
| 31 |
+
#include <thrust/detail/functional/composite.h>
|
| 32 |
+
#include <thrust/detail/functional/operators/assignment_operator.h>
|
| 33 |
+
#include <thrust/detail/raw_reference_cast.h>
|
| 34 |
+
#include <thrust/detail/type_traits/result_of_adaptable_function.h>
|
| 35 |
+
|
| 36 |
+
THRUST_NAMESPACE_BEGIN
|
| 37 |
+
namespace detail
|
| 38 |
+
{
|
| 39 |
+
namespace functional
|
| 40 |
+
{
|
| 41 |
+
|
| 42 |
+
// eval_ref<T> is
|
| 43 |
+
// - T when T is a subclass of thrust::reference
|
| 44 |
+
// - T& otherwise
|
| 45 |
+
// This is used to let thrust::references pass through actor evaluations.
|
| 46 |
+
template <typename T>
|
| 47 |
+
using eval_ref = typename std::conditional<
|
| 48 |
+
thrust::detail::is_wrapped_reference<T>::value, T, T&>::type;
|
| 49 |
+
|
| 50 |
+
template<typename Action, typename Env>
|
| 51 |
+
struct apply_actor
|
| 52 |
+
{
|
| 53 |
+
typedef typename Action::template result<Env>::type type;
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
template<typename Eval>
|
| 57 |
+
struct actor
|
| 58 |
+
: Eval
|
| 59 |
+
{
|
| 60 |
+
typedef Eval eval_type;
|
| 61 |
+
|
| 62 |
+
__host__ __device__
|
| 63 |
+
constexpr actor();
|
| 64 |
+
|
| 65 |
+
__host__ __device__
|
| 66 |
+
actor(const Eval &base);
|
| 67 |
+
|
| 68 |
+
__host__ __device__
|
| 69 |
+
typename apply_actor<eval_type, thrust::null_type >::type
|
| 70 |
+
operator()(void) const;
|
| 71 |
+
|
| 72 |
+
template <typename... Ts>
|
| 73 |
+
__host__ __device__
|
| 74 |
+
typename apply_actor<eval_type, thrust::tuple<eval_ref<Ts>...>>::type
|
| 75 |
+
operator()(Ts&&... ts) const;
|
| 76 |
+
|
| 77 |
+
template<typename T>
|
| 78 |
+
__host__ __device__
|
| 79 |
+
typename assign_result<Eval,T>::type
|
| 80 |
+
operator=(const T &_1) const;
|
| 81 |
+
}; // end actor
|
| 82 |
+
|
| 83 |
+
// in general, as_actor should turn things into values
|
| 84 |
+
template<typename T>
|
| 85 |
+
struct as_actor
|
| 86 |
+
{
|
| 87 |
+
typedef value<T> type;
|
| 88 |
+
|
| 89 |
+
static inline __host__ __device__ type convert(const T &x)
|
| 90 |
+
{
|
| 91 |
+
return val(x);
|
| 92 |
+
} // end convert()
|
| 93 |
+
}; // end as_actor
|
| 94 |
+
|
| 95 |
+
// specialization for things which are already actors
|
| 96 |
+
template<typename Eval>
|
| 97 |
+
struct as_actor<actor<Eval> >
|
| 98 |
+
{
|
| 99 |
+
typedef actor<Eval> type;
|
| 100 |
+
|
| 101 |
+
static inline __host__ __device__ const type &convert(const actor<Eval> &x)
|
| 102 |
+
{
|
| 103 |
+
return x;
|
| 104 |
+
} // end convert()
|
| 105 |
+
}; // end as_actor
|
| 106 |
+
|
| 107 |
+
template<typename T>
|
| 108 |
+
typename as_actor<T>::type
|
| 109 |
+
__host__ __device__
|
| 110 |
+
make_actor(const T &x)
|
| 111 |
+
{
|
| 112 |
+
return as_actor<T>::convert(x);
|
| 113 |
+
} // end make_actor()
|
| 114 |
+
|
| 115 |
+
} // end functional
|
| 116 |
+
|
| 117 |
+
// provide specializations for result_of for nullary, unary, and binary invocations of actor
|
| 118 |
+
template<typename Eval>
|
| 119 |
+
struct result_of_adaptable_function<
|
| 120 |
+
thrust::detail::functional::actor<Eval>()
|
| 121 |
+
>
|
| 122 |
+
{
|
| 123 |
+
typedef typename thrust::detail::functional::apply_actor<
|
| 124 |
+
thrust::detail::functional::actor<Eval>,
|
| 125 |
+
thrust::null_type
|
| 126 |
+
>::type type;
|
| 127 |
+
}; // end result_of
|
| 128 |
+
|
| 129 |
+
template<typename Eval, typename Arg1>
|
| 130 |
+
struct result_of_adaptable_function<
|
| 131 |
+
thrust::detail::functional::actor<Eval>(Arg1)
|
| 132 |
+
>
|
| 133 |
+
{
|
| 134 |
+
typedef typename thrust::detail::functional::apply_actor<
|
| 135 |
+
thrust::detail::functional::actor<Eval>,
|
| 136 |
+
thrust::tuple<Arg1>
|
| 137 |
+
>::type type;
|
| 138 |
+
}; // end result_of
|
| 139 |
+
|
| 140 |
+
template<typename Eval, typename Arg1, typename Arg2>
|
| 141 |
+
struct result_of_adaptable_function<
|
| 142 |
+
thrust::detail::functional::actor<Eval>(Arg1,Arg2)
|
| 143 |
+
>
|
| 144 |
+
{
|
| 145 |
+
typedef typename thrust::detail::functional::apply_actor<
|
| 146 |
+
thrust::detail::functional::actor<Eval>,
|
| 147 |
+
thrust::tuple<Arg1,Arg2>
|
| 148 |
+
>::type type;
|
| 149 |
+
}; // end result_of
|
| 150 |
+
|
| 151 |
+
} // end detail
|
| 152 |
+
THRUST_NAMESPACE_END
|
| 153 |
+
|
| 154 |
+
#include <thrust/detail/functional/actor.inl>
|
| 155 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/actor.inl
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
// Portions of this code are derived from
|
| 18 |
+
//
|
| 19 |
+
// Manjunath Kudlur's Carbon library
|
| 20 |
+
//
|
| 21 |
+
// and
|
| 22 |
+
//
|
| 23 |
+
// Based on Boost.Phoenix v1.2
|
| 24 |
+
// Copyright (c) 2001-2002 Joel de Guzman
|
| 25 |
+
|
| 26 |
+
#pragma once
|
| 27 |
+
|
| 28 |
+
#include <thrust/detail/config.h>
|
| 29 |
+
#include <thrust/detail/functional/composite.h>
|
| 30 |
+
#include <thrust/detail/functional/operators/assignment_operator.h>
|
| 31 |
+
#include <thrust/functional.h>
|
| 32 |
+
#include <thrust/type_traits/logical_metafunctions.h>
|
| 33 |
+
|
| 34 |
+
#include <type_traits>
|
| 35 |
+
|
| 36 |
+
THRUST_NAMESPACE_BEGIN
|
| 37 |
+
|
| 38 |
+
namespace detail
|
| 39 |
+
{
|
| 40 |
+
namespace functional
|
| 41 |
+
{
|
| 42 |
+
|
| 43 |
+
template<typename Eval>
|
| 44 |
+
__host__ __device__
|
| 45 |
+
constexpr actor<Eval>
|
| 46 |
+
::actor()
|
| 47 |
+
: eval_type()
|
| 48 |
+
{}
|
| 49 |
+
|
| 50 |
+
template<typename Eval>
|
| 51 |
+
__host__ __device__
|
| 52 |
+
actor<Eval>
|
| 53 |
+
::actor(const Eval &base)
|
| 54 |
+
: eval_type(base)
|
| 55 |
+
{}
|
| 56 |
+
|
| 57 |
+
template<typename Eval>
|
| 58 |
+
__host__ __device__
|
| 59 |
+
typename apply_actor<
|
| 60 |
+
typename actor<Eval>::eval_type,
|
| 61 |
+
typename thrust::null_type
|
| 62 |
+
>::type
|
| 63 |
+
actor<Eval>
|
| 64 |
+
::operator()(void) const
|
| 65 |
+
{
|
| 66 |
+
return eval_type::eval(thrust::null_type());
|
| 67 |
+
} // end basic_environment::operator()
|
| 68 |
+
|
| 69 |
+
// actor::operator() needs to construct a tuple of references to its
|
| 70 |
+
// arguments. To make this work with thrust::reference<T>, we need to
|
| 71 |
+
// detect thrust proxy references and store them as T rather than T&.
|
| 72 |
+
// This check ensures that the forwarding references passed into
|
| 73 |
+
// actor::operator() are either:
|
| 74 |
+
// - T&& if and only if T is a thrust::reference<U>, or
|
| 75 |
+
// - T& for any other types.
|
| 76 |
+
// This struct provides a nicer diagnostic for when these conditions aren't
|
| 77 |
+
// met.
|
| 78 |
+
template <typename T>
|
| 79 |
+
using actor_check_ref_type =
|
| 80 |
+
thrust::detail::integral_constant<bool,
|
| 81 |
+
( std::is_lvalue_reference<T>::value ||
|
| 82 |
+
thrust::detail::is_wrapped_reference<T>::value )>;
|
| 83 |
+
|
| 84 |
+
template <typename... Ts>
|
| 85 |
+
using actor_check_ref_types =
|
| 86 |
+
thrust::conjunction<actor_check_ref_type<Ts>...>;
|
| 87 |
+
|
| 88 |
+
template<typename Eval>
|
| 89 |
+
template<typename... Ts>
|
| 90 |
+
__host__ __device__
|
| 91 |
+
typename apply_actor<typename actor<Eval>::eval_type,
|
| 92 |
+
thrust::tuple<eval_ref<Ts>...>>::type
|
| 93 |
+
actor<Eval>::operator()(Ts&&... ts) const
|
| 94 |
+
{
|
| 95 |
+
static_assert(actor_check_ref_types<Ts...>::value,
|
| 96 |
+
"Actor evaluations only support rvalue references to "
|
| 97 |
+
"thrust::reference subclasses.");
|
| 98 |
+
using tuple_type = thrust::tuple<eval_ref<Ts>...>;
|
| 99 |
+
return eval_type::eval(tuple_type(THRUST_FWD(ts)...));
|
| 100 |
+
} // end actor<Eval>::operator()
|
| 101 |
+
|
| 102 |
+
template<typename Eval>
|
| 103 |
+
template<typename T>
|
| 104 |
+
__host__ __device__
|
| 105 |
+
typename assign_result<Eval,T>::type
|
| 106 |
+
actor<Eval>
|
| 107 |
+
::operator=(const T& _1) const
|
| 108 |
+
{
|
| 109 |
+
return do_assign(*this,_1);
|
| 110 |
+
} // end actor::operator=()
|
| 111 |
+
|
| 112 |
+
} // end functional
|
| 113 |
+
} // end detail
|
| 114 |
+
THRUST_NAMESPACE_END
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/argument.h
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
// Portions of this code are derived from
|
| 18 |
+
//
|
| 19 |
+
// Manjunath Kudlur's Carbon library
|
| 20 |
+
//
|
| 21 |
+
// and
|
| 22 |
+
//
|
| 23 |
+
// Based on Boost.Phoenix v1.2
|
| 24 |
+
// Copyright (c) 2001-2002 Joel de Guzman
|
| 25 |
+
|
| 26 |
+
#pragma once
|
| 27 |
+
|
| 28 |
+
#include <thrust/detail/config.h>
|
| 29 |
+
#include <thrust/tuple.h>
|
| 30 |
+
|
| 31 |
+
THRUST_NAMESPACE_BEGIN
|
| 32 |
+
namespace detail
|
| 33 |
+
{
|
| 34 |
+
namespace functional
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
template<unsigned int i, typename Env>
|
| 38 |
+
struct argument_helper
|
| 39 |
+
{
|
| 40 |
+
typedef typename thrust::tuple_element<i,Env>::type type;
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
template<unsigned int i>
|
| 44 |
+
struct argument_helper<i,thrust::null_type>
|
| 45 |
+
{
|
| 46 |
+
typedef thrust::null_type type;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
template<unsigned int i>
|
| 51 |
+
class argument
|
| 52 |
+
{
|
| 53 |
+
public:
|
| 54 |
+
template<typename Env>
|
| 55 |
+
struct result
|
| 56 |
+
: argument_helper<i,Env>
|
| 57 |
+
{
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
__host__ __device__
|
| 61 |
+
constexpr argument(){}
|
| 62 |
+
|
| 63 |
+
template<typename Env>
|
| 64 |
+
__host__ __device__
|
| 65 |
+
typename result<Env>::type eval(const Env &e) const
|
| 66 |
+
{
|
| 67 |
+
return thrust::get<i>(e);
|
| 68 |
+
} // end eval()
|
| 69 |
+
}; // end argument
|
| 70 |
+
|
| 71 |
+
} // end functional
|
| 72 |
+
} // end detail
|
| 73 |
+
THRUST_NAMESPACE_END
|
| 74 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/composite.h
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
// Portions of this code are derived from
|
| 18 |
+
//
|
| 19 |
+
// Manjunath Kudlur's Carbon library
|
| 20 |
+
//
|
| 21 |
+
// and
|
| 22 |
+
//
|
| 23 |
+
// Based on Boost.Phoenix v1.2
|
| 24 |
+
// Copyright (c) 2001-2002 Joel de Guzman
|
| 25 |
+
|
| 26 |
+
#pragma once
|
| 27 |
+
|
| 28 |
+
#include <thrust/detail/config.h>
|
| 29 |
+
|
| 30 |
+
#include <thrust/detail/functional/actor.h>
|
| 31 |
+
#include <thrust/tuple.h>
|
| 32 |
+
|
| 33 |
+
THRUST_NAMESPACE_BEGIN
|
| 34 |
+
namespace detail
|
| 35 |
+
{
|
| 36 |
+
namespace functional
|
| 37 |
+
{
|
| 38 |
+
|
| 39 |
+
// XXX we should just take a single EvalTuple
|
| 40 |
+
template<typename Eval0,
|
| 41 |
+
typename Eval1 = thrust::null_type,
|
| 42 |
+
typename Eval2 = thrust::null_type,
|
| 43 |
+
typename Eval3 = thrust::null_type,
|
| 44 |
+
typename Eval4 = thrust::null_type,
|
| 45 |
+
typename Eval5 = thrust::null_type,
|
| 46 |
+
typename Eval6 = thrust::null_type,
|
| 47 |
+
typename Eval7 = thrust::null_type,
|
| 48 |
+
typename Eval8 = thrust::null_type,
|
| 49 |
+
typename Eval9 = thrust::null_type,
|
| 50 |
+
typename Eval10 = thrust::null_type>
|
| 51 |
+
class composite;
|
| 52 |
+
|
| 53 |
+
template<typename Eval0, typename Eval1>
|
| 54 |
+
class composite<
|
| 55 |
+
Eval0,
|
| 56 |
+
Eval1,
|
| 57 |
+
thrust::null_type,
|
| 58 |
+
thrust::null_type,
|
| 59 |
+
thrust::null_type,
|
| 60 |
+
thrust::null_type,
|
| 61 |
+
thrust::null_type,
|
| 62 |
+
thrust::null_type,
|
| 63 |
+
thrust::null_type,
|
| 64 |
+
thrust::null_type
|
| 65 |
+
>
|
| 66 |
+
{
|
| 67 |
+
public:
|
| 68 |
+
template<typename Env>
|
| 69 |
+
struct result
|
| 70 |
+
{
|
| 71 |
+
typedef typename Eval0::template result<
|
| 72 |
+
thrust::tuple<
|
| 73 |
+
typename Eval1::template result<Env>::type
|
| 74 |
+
>
|
| 75 |
+
>::type type;
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
__host__ __device__
|
| 79 |
+
composite(const Eval0 &e0, const Eval1 &e1)
|
| 80 |
+
: m_eval0(e0),
|
| 81 |
+
m_eval1(e1)
|
| 82 |
+
{}
|
| 83 |
+
|
| 84 |
+
template<typename Env>
|
| 85 |
+
__host__ __device__
|
| 86 |
+
typename result<Env>::type
|
| 87 |
+
eval(const Env &x) const
|
| 88 |
+
{
|
| 89 |
+
typename Eval1::template result<Env>::type result1 = m_eval1.eval(x);
|
| 90 |
+
return m_eval0.eval(thrust::tie(result1));
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
private:
|
| 94 |
+
Eval0 m_eval0;
|
| 95 |
+
Eval1 m_eval1;
|
| 96 |
+
}; // end composite<Eval0,Eval1>
|
| 97 |
+
|
| 98 |
+
template<typename Eval0, typename Eval1, typename Eval2>
|
| 99 |
+
class composite<
|
| 100 |
+
Eval0,
|
| 101 |
+
Eval1,
|
| 102 |
+
Eval2,
|
| 103 |
+
thrust::null_type,
|
| 104 |
+
thrust::null_type,
|
| 105 |
+
thrust::null_type,
|
| 106 |
+
thrust::null_type,
|
| 107 |
+
thrust::null_type,
|
| 108 |
+
thrust::null_type,
|
| 109 |
+
thrust::null_type
|
| 110 |
+
>
|
| 111 |
+
{
|
| 112 |
+
public:
|
| 113 |
+
template<typename Env>
|
| 114 |
+
struct result
|
| 115 |
+
{
|
| 116 |
+
typedef typename Eval0::template result<
|
| 117 |
+
thrust::tuple<
|
| 118 |
+
typename Eval1::template result<Env>::type,
|
| 119 |
+
typename Eval2::template result<Env>::type
|
| 120 |
+
>
|
| 121 |
+
>::type type;
|
| 122 |
+
};
|
| 123 |
+
|
| 124 |
+
__host__ __device__
|
| 125 |
+
composite(const Eval0 &e0, const Eval1 &e1, const Eval2 &e2)
|
| 126 |
+
: m_eval0(e0),
|
| 127 |
+
m_eval1(e1),
|
| 128 |
+
m_eval2(e2)
|
| 129 |
+
{}
|
| 130 |
+
|
| 131 |
+
template<typename Env>
|
| 132 |
+
__host__ __device__
|
| 133 |
+
typename result<Env>::type
|
| 134 |
+
eval(const Env &x) const
|
| 135 |
+
{
|
| 136 |
+
typename Eval1::template result<Env>::type result1 = m_eval1.eval(x);
|
| 137 |
+
typename Eval2::template result<Env>::type result2 = m_eval2.eval(x);
|
| 138 |
+
return m_eval0.eval(thrust::tie(result1,result2));
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
private:
|
| 142 |
+
Eval0 m_eval0;
|
| 143 |
+
Eval1 m_eval1;
|
| 144 |
+
Eval2 m_eval2;
|
| 145 |
+
}; // end composite<Eval0,Eval1,Eval2>
|
| 146 |
+
|
| 147 |
+
template<typename Eval0, typename Eval1>
|
| 148 |
+
__host__ __device__
|
| 149 |
+
actor<composite<Eval0,Eval1> > compose(const Eval0 &e0, const Eval1 &e1)
|
| 150 |
+
{
|
| 151 |
+
return actor<composite<Eval0,Eval1> >(composite<Eval0,Eval1>(e0,e1));
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
template<typename Eval0, typename Eval1, typename Eval2>
|
| 155 |
+
__host__ __device__
|
| 156 |
+
actor<composite<Eval0,Eval1,Eval2> > compose(const Eval0 &e0, const Eval1 &e1, const Eval2 &e2)
|
| 157 |
+
{
|
| 158 |
+
return actor<composite<Eval0,Eval1,Eval2> >(composite<Eval0,Eval1,Eval2>(e0,e1,e2));
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
} // end functional
|
| 162 |
+
} // end detail
|
| 163 |
+
THRUST_NAMESPACE_END
|
| 164 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/operators.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/functional/operators/arithmetic_operators.h>
|
| 21 |
+
#include <thrust/detail/functional/operators/relational_operators.h>
|
| 22 |
+
#include <thrust/detail/functional/operators/logical_operators.h>
|
| 23 |
+
#include <thrust/detail/functional/operators/bitwise_operators.h>
|
| 24 |
+
#include <thrust/detail/functional/operators/compound_assignment_operators.h>
|
| 25 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/operators/operator_adaptors.h
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/functional/argument.h>
|
| 21 |
+
#include <thrust/detail/type_deduction.h>
|
| 22 |
+
#include <thrust/tuple.h>
|
| 23 |
+
#include <thrust/detail/type_traits.h>
|
| 24 |
+
#include <thrust/type_traits/void_t.h>
|
| 25 |
+
|
| 26 |
+
#include <type_traits>
|
| 27 |
+
|
| 28 |
+
THRUST_NAMESPACE_BEGIN
|
| 29 |
+
namespace detail
|
| 30 |
+
{
|
| 31 |
+
namespace functional
|
| 32 |
+
{
|
| 33 |
+
|
| 34 |
+
// Adapts a transparent unary functor from functional.h (e.g. thrust::negate<>)
|
| 35 |
+
// into the Eval interface.
|
| 36 |
+
template <typename UnaryFunctor>
|
| 37 |
+
struct transparent_unary_operator
|
| 38 |
+
{
|
| 39 |
+
template <typename>
|
| 40 |
+
using operator_type = UnaryFunctor;
|
| 41 |
+
|
| 42 |
+
template <typename Env>
|
| 43 |
+
using argument =
|
| 44 |
+
typename thrust::detail::eval_if<
|
| 45 |
+
thrust::tuple_size<Env>::value != 1,
|
| 46 |
+
thrust::detail::identity_<thrust::null_type>,
|
| 47 |
+
thrust::detail::functional::argument_helper<0, Env>
|
| 48 |
+
>::type;
|
| 49 |
+
|
| 50 |
+
template <typename Env>
|
| 51 |
+
struct result_type_impl
|
| 52 |
+
{
|
| 53 |
+
using type = decltype(
|
| 54 |
+
std::declval<UnaryFunctor>()(std::declval<argument<Env>>()));
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
template <typename Env>
|
| 58 |
+
using result_type =
|
| 59 |
+
typename thrust::detail::eval_if<
|
| 60 |
+
std::is_same<thrust::null_type, argument<Env>>::value,
|
| 61 |
+
thrust::detail::identity_<thrust::null_type>,
|
| 62 |
+
result_type_impl<Env>
|
| 63 |
+
>::type;
|
| 64 |
+
|
| 65 |
+
template <typename Env>
|
| 66 |
+
struct result
|
| 67 |
+
{
|
| 68 |
+
using op_type = UnaryFunctor;
|
| 69 |
+
using type = result_type<Env>;
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
template <typename Env>
|
| 73 |
+
__host__ __device__
|
| 74 |
+
result_type<Env> eval(Env&& e) const
|
| 75 |
+
THRUST_RETURNS(UnaryFunctor{}(thrust::get<0>(THRUST_FWD(e))))
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
// Adapts a transparent binary functor from functional.h (e.g. thrust::less<>)
|
| 80 |
+
// into the Eval interface.
|
| 81 |
+
template <typename BinaryFunctor>
|
| 82 |
+
struct transparent_binary_operator
|
| 83 |
+
{
|
| 84 |
+
template <typename>
|
| 85 |
+
using operator_type = BinaryFunctor;
|
| 86 |
+
|
| 87 |
+
template <typename Env>
|
| 88 |
+
using first_argument =
|
| 89 |
+
typename thrust::detail::eval_if<
|
| 90 |
+
thrust::tuple_size<Env>::value != 2,
|
| 91 |
+
thrust::detail::identity_<thrust::null_type>,
|
| 92 |
+
thrust::detail::functional::argument_helper<0, Env>
|
| 93 |
+
>::type;
|
| 94 |
+
|
| 95 |
+
template <typename Env>
|
| 96 |
+
using second_argument =
|
| 97 |
+
typename thrust::detail::eval_if<
|
| 98 |
+
thrust::tuple_size<Env>::value != 2,
|
| 99 |
+
thrust::detail::identity_<thrust::null_type>,
|
| 100 |
+
thrust::detail::functional::argument_helper<1, Env>
|
| 101 |
+
>::type;
|
| 102 |
+
|
| 103 |
+
template <typename Env>
|
| 104 |
+
struct result_type_impl
|
| 105 |
+
{
|
| 106 |
+
using type = decltype(
|
| 107 |
+
std::declval<BinaryFunctor>()(std::declval<first_argument<Env>>(),
|
| 108 |
+
std::declval<second_argument<Env>>()));
|
| 109 |
+
};
|
| 110 |
+
|
| 111 |
+
template <typename Env>
|
| 112 |
+
using result_type =
|
| 113 |
+
typename thrust::detail::eval_if<
|
| 114 |
+
(std::is_same<thrust::null_type, first_argument<Env>>::value ||
|
| 115 |
+
std::is_same<thrust::null_type, second_argument<Env>>::value),
|
| 116 |
+
thrust::detail::identity_<thrust::null_type>,
|
| 117 |
+
result_type_impl<Env>
|
| 118 |
+
>::type;
|
| 119 |
+
|
| 120 |
+
template <typename Env>
|
| 121 |
+
struct result
|
| 122 |
+
{
|
| 123 |
+
using op_type = BinaryFunctor;
|
| 124 |
+
using type = result_type<Env>;
|
| 125 |
+
};
|
| 126 |
+
|
| 127 |
+
template <typename Env>
|
| 128 |
+
__host__ __device__
|
| 129 |
+
result_type<Env> eval(Env&& e) const
|
| 130 |
+
THRUST_RETURNS(BinaryFunctor{}(thrust::get<0>(e), thrust::get<1>(e)))
|
| 131 |
+
};
|
| 132 |
+
|
| 133 |
+
} // end functional
|
| 134 |
+
} // end detail
|
| 135 |
+
THRUST_NAMESPACE_END
|
| 136 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/placeholder.h
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/functional/actor.h>
|
| 21 |
+
#include <thrust/detail/functional/argument.h>
|
| 22 |
+
|
| 23 |
+
THRUST_NAMESPACE_BEGIN
|
| 24 |
+
namespace detail
|
| 25 |
+
{
|
| 26 |
+
namespace functional
|
| 27 |
+
{
|
| 28 |
+
|
| 29 |
+
template<unsigned int i>
|
| 30 |
+
struct placeholder
|
| 31 |
+
{
|
| 32 |
+
typedef actor<argument<i> > type;
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
} // end functional
|
| 36 |
+
} // end detail
|
| 37 |
+
THRUST_NAMESPACE_END
|
| 38 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/functional/value.h
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
// Portions of this code are derived from
|
| 18 |
+
//
|
| 19 |
+
// Manjunath Kudlur's Carbon library
|
| 20 |
+
//
|
| 21 |
+
// and
|
| 22 |
+
//
|
| 23 |
+
// Based on Boost.Phoenix v1.2
|
| 24 |
+
// Copyright (c) 2001-2002 Joel de Guzman
|
| 25 |
+
|
| 26 |
+
#pragma once
|
| 27 |
+
|
| 28 |
+
#include <thrust/detail/config.h>
|
| 29 |
+
#include <thrust/detail/functional/actor.h>
|
| 30 |
+
|
| 31 |
+
THRUST_NAMESPACE_BEGIN
|
| 32 |
+
namespace detail
|
| 33 |
+
{
|
| 34 |
+
namespace functional
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
template<typename Eval> struct actor;
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
template<typename T>
|
| 42 |
+
class value
|
| 43 |
+
{
|
| 44 |
+
public:
|
| 45 |
+
|
| 46 |
+
template<typename Env>
|
| 47 |
+
struct result
|
| 48 |
+
{
|
| 49 |
+
typedef T type;
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
__host__ __device__
|
| 53 |
+
value(const T &arg)
|
| 54 |
+
: m_val(arg)
|
| 55 |
+
{}
|
| 56 |
+
|
| 57 |
+
template<typename Env>
|
| 58 |
+
__host__ __device__
|
| 59 |
+
T eval(const Env &) const
|
| 60 |
+
{
|
| 61 |
+
return m_val;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
private:
|
| 65 |
+
T m_val;
|
| 66 |
+
}; // end value
|
| 67 |
+
|
| 68 |
+
template<typename T>
|
| 69 |
+
__host__ __device__
|
| 70 |
+
actor<value<T> > val(const T &x)
|
| 71 |
+
{
|
| 72 |
+
return value<T>(x);
|
| 73 |
+
} // end val()
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
} // end functional
|
| 77 |
+
} // end detail
|
| 78 |
+
THRUST_NAMESPACE_END
|
| 79 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/range/tail_flags.h
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/iterator/transform_iterator.h>
|
| 21 |
+
#include <thrust/iterator/zip_iterator.h>
|
| 22 |
+
#include <thrust/iterator/counting_iterator.h>
|
| 23 |
+
#include <thrust/tuple.h>
|
| 24 |
+
#include <thrust/functional.h>
|
| 25 |
+
|
| 26 |
+
THRUST_NAMESPACE_BEGIN
|
| 27 |
+
namespace detail
|
| 28 |
+
{
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
template<typename RandomAccessIterator,
|
| 32 |
+
typename BinaryPredicate = thrust::equal_to<typename thrust::iterator_value<RandomAccessIterator>::type>,
|
| 33 |
+
typename ValueType = bool,
|
| 34 |
+
typename IndexType = typename thrust::iterator_difference<RandomAccessIterator>::type>
|
| 35 |
+
class tail_flags
|
| 36 |
+
{
|
| 37 |
+
// XXX WAR cudafe bug
|
| 38 |
+
//private:
|
| 39 |
+
public:
|
| 40 |
+
struct tail_flag_functor
|
| 41 |
+
{
|
| 42 |
+
BinaryPredicate binary_pred; // this must be the first member for performance reasons
|
| 43 |
+
RandomAccessIterator iter;
|
| 44 |
+
IndexType n;
|
| 45 |
+
|
| 46 |
+
typedef ValueType result_type;
|
| 47 |
+
|
| 48 |
+
__host__ __device__
|
| 49 |
+
tail_flag_functor(RandomAccessIterator first, RandomAccessIterator last)
|
| 50 |
+
: binary_pred(), iter(first), n(last - first)
|
| 51 |
+
{}
|
| 52 |
+
|
| 53 |
+
__host__ __device__
|
| 54 |
+
tail_flag_functor(RandomAccessIterator first, RandomAccessIterator last, BinaryPredicate binary_pred)
|
| 55 |
+
: binary_pred(binary_pred), iter(first), n(last - first)
|
| 56 |
+
{}
|
| 57 |
+
|
| 58 |
+
__host__ __device__ __thrust_forceinline__
|
| 59 |
+
result_type operator()(const IndexType &i)
|
| 60 |
+
{
|
| 61 |
+
return (i == (n - 1) || !binary_pred(iter[i], iter[i+1]));
|
| 62 |
+
}
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
typedef thrust::counting_iterator<IndexType> counting_iterator;
|
| 66 |
+
|
| 67 |
+
public:
|
| 68 |
+
typedef thrust::transform_iterator<
|
| 69 |
+
tail_flag_functor,
|
| 70 |
+
counting_iterator
|
| 71 |
+
> iterator;
|
| 72 |
+
|
| 73 |
+
__thrust_exec_check_disable__
|
| 74 |
+
__host__ __device__
|
| 75 |
+
tail_flags(RandomAccessIterator first, RandomAccessIterator last)
|
| 76 |
+
: m_begin(thrust::make_transform_iterator(thrust::counting_iterator<IndexType>(0),
|
| 77 |
+
tail_flag_functor(first, last))),
|
| 78 |
+
m_end(m_begin + (last - first))
|
| 79 |
+
{}
|
| 80 |
+
|
| 81 |
+
__thrust_exec_check_disable__
|
| 82 |
+
__host__ __device__
|
| 83 |
+
tail_flags(RandomAccessIterator first, RandomAccessIterator last, BinaryPredicate binary_pred)
|
| 84 |
+
: m_begin(thrust::make_transform_iterator(thrust::counting_iterator<IndexType>(0),
|
| 85 |
+
tail_flag_functor(first, last, binary_pred))),
|
| 86 |
+
m_end(m_begin + (last - first))
|
| 87 |
+
{}
|
| 88 |
+
|
| 89 |
+
__host__ __device__
|
| 90 |
+
iterator begin() const
|
| 91 |
+
{
|
| 92 |
+
return m_begin;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
__host__ __device__
|
| 96 |
+
iterator end() const
|
| 97 |
+
{
|
| 98 |
+
return m_end;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
template<typename OtherIndex>
|
| 102 |
+
__host__ __device__
|
| 103 |
+
typename iterator::reference operator[](OtherIndex i)
|
| 104 |
+
{
|
| 105 |
+
return *(begin() + i);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
private:
|
| 109 |
+
iterator m_begin, m_end;
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
template<typename RandomAccessIterator, typename BinaryPredicate>
|
| 114 |
+
__host__ __device__
|
| 115 |
+
tail_flags<RandomAccessIterator, BinaryPredicate>
|
| 116 |
+
make_tail_flags(RandomAccessIterator first, RandomAccessIterator last, BinaryPredicate binary_pred)
|
| 117 |
+
{
|
| 118 |
+
return tail_flags<RandomAccessIterator, BinaryPredicate>(first, last, binary_pred);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
template<typename RandomAccessIterator>
|
| 123 |
+
__host__ __device__
|
| 124 |
+
tail_flags<RandomAccessIterator>
|
| 125 |
+
make_tail_flags(RandomAccessIterator first, RandomAccessIterator last)
|
| 126 |
+
{
|
| 127 |
+
return tail_flags<RandomAccessIterator>(first, last);
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
} // end detail
|
| 132 |
+
THRUST_NAMESPACE_END
|
| 133 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/function_traits.h
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
|
| 21 |
+
#include <thrust/detail/type_traits.h>
|
| 22 |
+
#include <thrust/detail/type_traits/has_nested_type.h>
|
| 23 |
+
|
| 24 |
+
THRUST_NAMESPACE_BEGIN
|
| 25 |
+
|
| 26 |
+
// forward definitions for is_commutative
|
| 27 |
+
template <typename T> struct plus;
|
| 28 |
+
template <typename T> struct multiplies;
|
| 29 |
+
template <typename T> struct minimum;
|
| 30 |
+
template <typename T> struct maximum;
|
| 31 |
+
template <typename T> struct logical_or;
|
| 32 |
+
template <typename T> struct logical_and;
|
| 33 |
+
template <typename T> struct bit_or;
|
| 34 |
+
template <typename T> struct bit_and;
|
| 35 |
+
template <typename T> struct bit_xor;
|
| 36 |
+
|
| 37 |
+
namespace detail
|
| 38 |
+
{
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
// some metafunctions which check for the nested types of the adaptable functions
|
| 42 |
+
|
| 43 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_result_type, result_type)
|
| 44 |
+
|
| 45 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_argument_type, argument_type)
|
| 46 |
+
|
| 47 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_first_argument_type, first_argument_type)
|
| 48 |
+
|
| 49 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(has_second_argument_type, second_argument_type)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
template<typename AdaptableBinaryFunction>
|
| 53 |
+
struct result_type
|
| 54 |
+
{
|
| 55 |
+
typedef typename AdaptableBinaryFunction::result_type type;
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
template<typename T>
|
| 60 |
+
struct is_adaptable_unary_function
|
| 61 |
+
: thrust::detail::and_<
|
| 62 |
+
has_result_type<T>,
|
| 63 |
+
has_argument_type<T>
|
| 64 |
+
>
|
| 65 |
+
{};
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
template<typename T>
|
| 69 |
+
struct is_adaptable_binary_function
|
| 70 |
+
: thrust::detail::and_<
|
| 71 |
+
has_result_type<T>,
|
| 72 |
+
thrust::detail::and_<
|
| 73 |
+
has_first_argument_type<T>,
|
| 74 |
+
has_second_argument_type<T>
|
| 75 |
+
>
|
| 76 |
+
>
|
| 77 |
+
{};
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
template<typename BinaryFunction>
|
| 81 |
+
struct is_commutative
|
| 82 |
+
: public thrust::detail::false_type
|
| 83 |
+
{};
|
| 84 |
+
|
| 85 |
+
template<typename T> struct is_commutative< typename thrust::plus<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 86 |
+
template<typename T> struct is_commutative< typename thrust::multiplies<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 87 |
+
template<typename T> struct is_commutative< typename thrust::minimum<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 88 |
+
template<typename T> struct is_commutative< typename thrust::maximum<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 89 |
+
template<typename T> struct is_commutative< typename thrust::logical_or<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 90 |
+
template<typename T> struct is_commutative< typename thrust::logical_and<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 91 |
+
template<typename T> struct is_commutative< typename thrust::bit_or<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 92 |
+
template<typename T> struct is_commutative< typename thrust::bit_and<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 93 |
+
template<typename T> struct is_commutative< typename thrust::bit_xor<T> > : public thrust::detail::is_arithmetic<T> {};
|
| 94 |
+
|
| 95 |
+
} // end namespace detail
|
| 96 |
+
THRUST_NAMESPACE_END
|
| 97 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/has_member_function.h
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2021 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/type_traits.h>
|
| 20 |
+
|
| 21 |
+
#include <utility> // for std::declval
|
| 22 |
+
|
| 23 |
+
#define __THRUST_DEFINE_HAS_MEMBER_FUNCTION(trait_name, member_function_name) \
|
| 24 |
+
template <typename T, typename Signature, typename = void> \
|
| 25 |
+
struct trait_name : thrust::false_type \
|
| 26 |
+
{}; \
|
| 27 |
+
\
|
| 28 |
+
template <typename T, typename ResultT, typename... Args> \
|
| 29 |
+
struct trait_name<T, \
|
| 30 |
+
ResultT(Args...), \
|
| 31 |
+
typename thrust::detail::enable_if< \
|
| 32 |
+
thrust::detail::is_same<ResultT, void>::value || \
|
| 33 |
+
thrust::detail::is_convertible< \
|
| 34 |
+
ResultT, \
|
| 35 |
+
decltype(std::declval<T>().member_function_name( \
|
| 36 |
+
std::declval<Args>()...))>::value>::type> \
|
| 37 |
+
: thrust::true_type \
|
| 38 |
+
{};
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/has_nested_type.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/type_traits.h>
|
| 20 |
+
|
| 21 |
+
#define __THRUST_DEFINE_HAS_NESTED_TYPE(trait_name, nested_type_name) \
|
| 22 |
+
template<typename T> \
|
| 23 |
+
struct trait_name \
|
| 24 |
+
{ \
|
| 25 |
+
typedef char yes_type; \
|
| 26 |
+
typedef int no_type; \
|
| 27 |
+
template<typename S> static yes_type test(typename S::nested_type_name *); \
|
| 28 |
+
template<typename S> static no_type test(...); \
|
| 29 |
+
static bool const value = sizeof(test<T>(0)) == sizeof(yes_type);\
|
| 30 |
+
typedef thrust::detail::integral_constant<bool, value> type;\
|
| 31 |
+
};
|
| 32 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/has_trivial_assign.h
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
/*! \file type_traits.h
|
| 19 |
+
* \brief Temporarily define some type traits
|
| 20 |
+
* until nvcc can compile tr1::type_traits.
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
#pragma once
|
| 24 |
+
|
| 25 |
+
#include <thrust/detail/config.h>
|
| 26 |
+
#include <thrust/detail/type_traits.h>
|
| 27 |
+
|
| 28 |
+
#include <cuda/std/type_traits>
|
| 29 |
+
|
| 30 |
+
THRUST_NAMESPACE_BEGIN
|
| 31 |
+
|
| 32 |
+
namespace detail
|
| 33 |
+
{
|
| 34 |
+
|
| 35 |
+
template<typename T>
|
| 36 |
+
struct has_trivial_assign
|
| 37 |
+
: public integral_constant<
|
| 38 |
+
bool,
|
| 39 |
+
(is_pod<T>::value && !is_const<T>::value)
|
| 40 |
+
|| ::cuda::std::is_trivially_copy_assignable<T>::value
|
| 41 |
+
>
|
| 42 |
+
{};
|
| 43 |
+
|
| 44 |
+
} // end detail
|
| 45 |
+
|
| 46 |
+
THRUST_NAMESPACE_END
|
| 47 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/is_call_possible.h
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
|
| 21 |
+
#include <thrust/detail/type_traits.h>
|
| 22 |
+
#include <thrust/detail/type_traits/has_member_function.h>
|
| 23 |
+
|
| 24 |
+
// inspired by Roman Perepelitsa's presentation from comp.lang.c++.moderated
|
| 25 |
+
// based on the implementation here: http://www.rsdn.ru/forum/cpp/2759773.1.aspx
|
| 26 |
+
|
| 27 |
+
THRUST_NAMESPACE_BEGIN
|
| 28 |
+
namespace detail
|
| 29 |
+
{
|
| 30 |
+
namespace is_call_possible_detail
|
| 31 |
+
{
|
| 32 |
+
|
| 33 |
+
template<typename T> class void_exp_result {};
|
| 34 |
+
|
| 35 |
+
template<typename T, typename U>
|
| 36 |
+
U const& operator,(U const&, void_exp_result<T>);
|
| 37 |
+
|
| 38 |
+
template<typename T, typename U>
|
| 39 |
+
U& operator,(U&, void_exp_result<T>);
|
| 40 |
+
|
| 41 |
+
template<typename src_type, typename dest_type>
|
| 42 |
+
struct clone_constness
|
| 43 |
+
{
|
| 44 |
+
typedef dest_type type;
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
template<typename src_type, typename dest_type>
|
| 48 |
+
struct clone_constness<const src_type, dest_type>
|
| 49 |
+
{
|
| 50 |
+
typedef const dest_type type;
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
} // end is_call_possible_detail
|
| 54 |
+
} // end detail
|
| 55 |
+
THRUST_NAMESPACE_END
|
| 56 |
+
|
| 57 |
+
#define __THRUST_DEFINE_IS_CALL_POSSIBLE(trait_name, member_function_name) \
|
| 58 |
+
__THRUST_DEFINE_HAS_MEMBER_FUNCTION(trait_name##_has_member, member_function_name) \
|
| 59 |
+
\
|
| 60 |
+
template <typename T, typename Signature> \
|
| 61 |
+
struct trait_name \
|
| 62 |
+
{ \
|
| 63 |
+
private: \
|
| 64 |
+
struct yes {}; \
|
| 65 |
+
struct no { yes m[2]; }; \
|
| 66 |
+
struct derived : public T \
|
| 67 |
+
{ \
|
| 68 |
+
using T::member_function_name; \
|
| 69 |
+
no member_function_name(...) const; \
|
| 70 |
+
}; \
|
| 71 |
+
\
|
| 72 |
+
typedef typename thrust::detail::is_call_possible_detail::clone_constness<T, derived>::type derived_type; \
|
| 73 |
+
\
|
| 74 |
+
template<typename U, typename Result> \
|
| 75 |
+
struct return_value_check \
|
| 76 |
+
{ \
|
| 77 |
+
static yes deduce(Result); \
|
| 78 |
+
static no deduce(...); \
|
| 79 |
+
static no deduce(no); \
|
| 80 |
+
static no deduce(thrust::detail::is_call_possible_detail::void_exp_result<T>); \
|
| 81 |
+
}; \
|
| 82 |
+
\
|
| 83 |
+
template<typename U> \
|
| 84 |
+
struct return_value_check<U, void> \
|
| 85 |
+
{ \
|
| 86 |
+
static yes deduce(...); \
|
| 87 |
+
static no deduce(no); \
|
| 88 |
+
}; \
|
| 89 |
+
\
|
| 90 |
+
template<bool has_the_member_of_interest, typename F> \
|
| 91 |
+
struct impl \
|
| 92 |
+
{ \
|
| 93 |
+
static const bool value = false; \
|
| 94 |
+
}; \
|
| 95 |
+
\
|
| 96 |
+
template<typename Result, typename Arg> \
|
| 97 |
+
struct impl<true, Result(Arg)> \
|
| 98 |
+
{ \
|
| 99 |
+
static typename add_reference<derived_type>::type test_me; \
|
| 100 |
+
static typename add_reference<Arg>::type arg; \
|
| 101 |
+
\
|
| 102 |
+
static const bool value = \
|
| 103 |
+
sizeof( \
|
| 104 |
+
return_value_check<T, Result>::deduce( \
|
| 105 |
+
(test_me.member_function_name(arg), thrust::detail::is_call_possible_detail::void_exp_result<T>()) \
|
| 106 |
+
) \
|
| 107 |
+
) == sizeof(yes); \
|
| 108 |
+
}; \
|
| 109 |
+
\
|
| 110 |
+
template<typename Result, typename Arg1, typename Arg2> \
|
| 111 |
+
struct impl<true, Result(Arg1,Arg2)> \
|
| 112 |
+
{ \
|
| 113 |
+
static typename add_reference<derived_type>::type test_me; \
|
| 114 |
+
static typename add_reference<Arg1>::type arg1; \
|
| 115 |
+
static typename add_reference<Arg2>::type arg2; \
|
| 116 |
+
\
|
| 117 |
+
static const bool value = \
|
| 118 |
+
sizeof( \
|
| 119 |
+
return_value_check<T, Result>::deduce( \
|
| 120 |
+
(test_me.member_function_name(arg1,arg2), thrust::detail::is_call_possible_detail::void_exp_result<T>()) \
|
| 121 |
+
) \
|
| 122 |
+
) == sizeof(yes); \
|
| 123 |
+
}; \
|
| 124 |
+
\
|
| 125 |
+
template<typename Result, typename Arg1, typename Arg2, typename Arg3> \
|
| 126 |
+
struct impl<true, Result(Arg1,Arg2,Arg3)> \
|
| 127 |
+
{ \
|
| 128 |
+
static typename add_reference<derived_type>::type test_me; \
|
| 129 |
+
static typename add_reference<Arg1>::type arg1; \
|
| 130 |
+
static typename add_reference<Arg2>::type arg2; \
|
| 131 |
+
static typename add_reference<Arg3>::type arg3; \
|
| 132 |
+
\
|
| 133 |
+
static const bool value = \
|
| 134 |
+
sizeof( \
|
| 135 |
+
return_value_check<T, Result>::deduce( \
|
| 136 |
+
(test_me.member_function_name(arg1,arg2,arg3), thrust::detail::is_call_possible_detail::void_exp_result<T>()) \
|
| 137 |
+
) \
|
| 138 |
+
) == sizeof(yes); \
|
| 139 |
+
}; \
|
| 140 |
+
\
|
| 141 |
+
template<typename Result, typename Arg1, typename Arg2, typename Arg3, typename Arg4> \
|
| 142 |
+
struct impl<true, Result(Arg1,Arg2,Arg3,Arg4)> \
|
| 143 |
+
{ \
|
| 144 |
+
static typename add_reference<derived_type>::type test_me; \
|
| 145 |
+
static typename add_reference<Arg1>::type arg1; \
|
| 146 |
+
static typename add_reference<Arg2>::type arg2; \
|
| 147 |
+
static typename add_reference<Arg3>::type arg3; \
|
| 148 |
+
static typename add_reference<Arg4>::type arg4; \
|
| 149 |
+
\
|
| 150 |
+
static const bool value = \
|
| 151 |
+
sizeof( \
|
| 152 |
+
return_value_check<T, Result>::deduce( \
|
| 153 |
+
(test_me.member_function_name(arg1,arg2,arg3,arg4), thrust::detail::is_call_possible_detail::void_exp_result<T>()) \
|
| 154 |
+
) \
|
| 155 |
+
) == sizeof(yes); \
|
| 156 |
+
}; \
|
| 157 |
+
\
|
| 158 |
+
public: \
|
| 159 |
+
static const bool value = impl<trait_name##_has_member<T,Signature>::value, Signature>::value; \
|
| 160 |
+
typedef thrust::detail::integral_constant<bool,value> type; \
|
| 161 |
+
};
|
| 162 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/is_metafunction_defined.h
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
|
| 21 |
+
#include <thrust/detail/type_traits/has_nested_type.h>
|
| 22 |
+
#include <thrust/detail/type_traits.h>
|
| 23 |
+
|
| 24 |
+
THRUST_NAMESPACE_BEGIN
|
| 25 |
+
|
| 26 |
+
namespace detail
|
| 27 |
+
{
|
| 28 |
+
|
| 29 |
+
__THRUST_DEFINE_HAS_NESTED_TYPE(is_metafunction_defined, type)
|
| 30 |
+
|
| 31 |
+
template<typename Metafunction>
|
| 32 |
+
struct enable_if_defined
|
| 33 |
+
: thrust::detail::lazy_enable_if<
|
| 34 |
+
is_metafunction_defined<Metafunction>::value,
|
| 35 |
+
Metafunction
|
| 36 |
+
>
|
| 37 |
+
{};
|
| 38 |
+
|
| 39 |
+
} // end detail
|
| 40 |
+
|
| 41 |
+
THRUST_NAMESPACE_END
|
| 42 |
+
|
videochat2/lib/python3.10/site-packages/tensorflow/include/external/local_config_cuda/cuda/cuda/include/thrust/detail/type_traits/iterator/is_discard_iterator.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2008-2013 NVIDIA Corporation
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#pragma once
|
| 18 |
+
|
| 19 |
+
#include <thrust/detail/config.h>
|
| 20 |
+
#include <thrust/detail/type_traits.h>
|
| 21 |
+
#include <thrust/iterator/discard_iterator.h>
|
| 22 |
+
|
| 23 |
+
THRUST_NAMESPACE_BEGIN
|
| 24 |
+
namespace detail
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
template <typename Iterator>
|
| 28 |
+
struct is_discard_iterator
|
| 29 |
+
: public thrust::detail::false_type
|
| 30 |
+
{};
|
| 31 |
+
|
| 32 |
+
template <typename System>
|
| 33 |
+
struct is_discard_iterator< thrust::discard_iterator<System> >
|
| 34 |
+
: public thrust::detail::true_type
|
| 35 |
+
{};
|
| 36 |
+
|
| 37 |
+
} // end namespace detail
|
| 38 |
+
THRUST_NAMESPACE_END
|
| 39 |
+
|