-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integer determinant calculation (#80)
* Add integer determinant overload * Add typetraits and make template more readable * Add new swap function and change naming. * Added determinant specilization via custom type traits * Removed unnecessary include * Update impl/NotSoBasicLinearAlgebra.h Co-authored-by: tomstewart89 <[email protected]> --------- Co-authored-by: Nils Mueller <[email protected]> Co-authored-by: tomstewart89 <[email protected]>
- Loading branch information
1 parent
0080e10
commit 55b01ed
Showing
4 changed files
with
130 additions
and
14 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
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,46 @@ | ||
#pragma once | ||
|
||
namespace BLA | ||
{ | ||
// This namespace exists because the header "typetraits" is not implemented in every Arduino environment. | ||
namespace Types | ||
{ | ||
template<class T, class U> struct is_same { static constexpr bool value = false; }; | ||
template<class T> struct is_same<T, T> { static constexpr bool value = true; }; | ||
|
||
template<class T> struct remove_const { typedef T type; }; | ||
template<class T> struct remove_const<const T> { typedef T type; }; | ||
|
||
template<class T> | ||
struct is_floating_point | ||
{ | ||
static constexpr bool value = | ||
is_same<float, typename remove_const<T>::type>::value || | ||
is_same<double, typename remove_const<T>::type>::value || | ||
is_same<long double, typename remove_const<T>::type>::value; | ||
}; | ||
|
||
template<class T> | ||
struct is_signed_integer | ||
{ | ||
static constexpr bool value = | ||
is_same<signed char, typename remove_const<T>::type>::value || | ||
is_same<signed short, typename remove_const<T>::type>::value || | ||
is_same<signed int, typename remove_const<T>::type>::value || | ||
is_same<signed long, typename remove_const<T>::type>::value || | ||
is_same<signed long long, typename remove_const<T>::type>::value; | ||
}; | ||
|
||
template<class T> | ||
struct is_signed | ||
{ | ||
static constexpr bool value = | ||
is_floating_point<T>::value || | ||
is_signed_integer<T>::value; | ||
}; | ||
|
||
template<bool, typename T = void> struct enable_if {}; | ||
template<typename T> struct enable_if<true, T> { typedef T type; }; | ||
} | ||
} // namespace BLA | ||
|
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