Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Sep 12, 2024
1 parent 6f8bc21 commit 70e3cc5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions include/clad/Differentiator/DiffPlanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ struct DiffRequest {

// Define the hash function for DiffRequest.
template <> struct std::hash<clad::DiffRequest> {
std::size_t operator()(const clad::DiffRequest& DR) const {
// Use the function pointer as the hash of the DiffRequest, it
// is sufficient to break a reasonable number of collisions.
if (DR.Function->getPreviousDecl())
return std::hash<const void*>{}(DR.Function->getPreviousDecl());
return std::hash<const void*>{}(DR.Function);
}
std::size_t operator()(const clad::DiffRequest& DR) const {
// Use the function pointer as the hash of the DiffRequest, it
// is sufficient to break a reasonable number of collisions.
if (DR.Function->getPreviousDecl())
return std::hash<const void*>{}(DR.Function->getPreviousDecl());
return std::hash<const void*>{}(DR.Function);
}
};

#endif
11 changes: 6 additions & 5 deletions include/clad/Differentiator/Differentiator.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ CUDA_HOST_DEVICE T push(tape<T>& to, ArgsT... val) {
typename std::enable_if<EnablePadding, bool>::type = true>
CUDA_HOST_DEVICE auto
execute_with_default_args(list<Rest...>, ReturnType C::*f, Obj&& obj,
list<fArgTypes...>, Args&&... args)
-> return_type_t<decltype(f)> {
list<fArgTypes...>,
Args&&... args) -> return_type_t<decltype(f)> {
return (static_cast<Obj>(obj).*f)((fArgTypes)(args)...,
static_cast<Rest>(nullptr)...);
}
Expand All @@ -174,8 +174,8 @@ CUDA_HOST_DEVICE T push(tape<T>& to, ArgsT... val) {
class Obj, class... Args, class... fArgTypes,
typename std::enable_if<!EnablePadding, bool>::type = true>
auto execute_with_default_args(list<Rest...>, ReturnType C::*f, Obj&& obj,
list<fArgTypes...>, Args&&... args)
-> return_type_t<decltype(f)> {
list<fArgTypes...>,
Args&&... args) -> return_type_t<decltype(f)> {
return (static_cast<Obj>(obj).*f)(static_cast<Args>(args)...);
}

Expand Down Expand Up @@ -366,7 +366,8 @@ CUDA_HOST_DEVICE T push(tape<T>& to, ArgsT... val) {
execute_helper(ReturnType C::*f, Obj&& obj, Args&&... args) {
// `static_cast` is required here for perfect forwarding.
return execute_with_default_args<EnablePadding>(
DropArgs_t<sizeof...(Args), decltype(f)>{}, f, static_cast<Obj>(obj),
DropArgs_t<sizeof...(Args), decltype(f)>{}, f,
static_cast<Obj>(obj),
TakeNFirstArgs_t<sizeof...(Args), decltype(f)>{},
static_cast<Args>(args)...);
}
Expand Down
8 changes: 4 additions & 4 deletions include/clad/Differentiator/FunctionTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,10 @@ namespace clad {
/// qualifier only if it is supported and finally AddSPECS declares the
/// function with all the cases
#define HessianDerivedFnTraits_AddSPECS(var, cv, vol, ref, noex) \
template <typename R, typename C, typename... Args> \
struct HessianDerivedFnTraits<R (C::*)(Args...) cv vol ref noex> { \
using type = void (C::*)(Args..., R*) cv vol ref noex; \
};
template <typename R, typename C, typename... Args> \
struct HessianDerivedFnTraits<R (C::*)(Args...) cv vol ref noex> { \
using type = void (C::*)(Args..., R*) cv vol ref noex; \
};

#if __cpp_noexcept_function_type > 0
#define HessianDerivedFnTraits_AddNOEX(var, con, vol, ref) \
Expand Down
9 changes: 4 additions & 5 deletions lib/Differentiator/DiffPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,11 @@ namespace clad {
i < e && paramIdx < FD->getNumParams(); ++i) {
const auto* param = DVI[i].param;
while (paramIdx < FD->getNumParams() &&
FD->getParamDecl(paramIdx) != param) {
++paramIdx;
}
FD->getParamDecl(paramIdx) != param)
++paramIdx;
if (paramIdx != FD->getNumParams())
// Update the parameter to point to the definition parameter.
DVI[i].param = Function->getParamDecl(paramIdx);
// Update the parameter to point to the definition parameter.
DVI[i].param = Function->getParamDecl(paramIdx);
}
return;
}
Expand Down

0 comments on commit 70e3cc5

Please sign in to comment.