-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a fct to wrap scalar values for derivs
- Loading branch information
1 parent
77db7cd
commit b160944
Showing
3 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef SCALAR_DERIV_ETR_H | ||
#define SCALAR_DERIV_ETR_H | ||
|
||
#include "../Core.hpp" | ||
|
||
namespace etr { | ||
|
||
template <int Idx, typename AV, typename T> | ||
requires std::is_arithmetic_v<T> | ||
inline auto scalarDeriv(AV &av, T s) { | ||
av.varConstants[Idx].resize(1); | ||
av.varConstants[Idx][0] = s; | ||
Vec<T, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av); | ||
return ret; | ||
} | ||
|
||
} // namespace etr | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters