Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Samer Afach
Polymath
Commits
d5638d0f
Commit
d5638d0f
authored
Oct 20, 2016
by
Samer Afach
Browse files
Many fixes and tests of the initial release of Polymath.
parent
03ff1f63
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
include/internal/Matrix.h
View file @
d5638d0f
This diff is collapsed.
Click to expand it.
include/internal/StdAdapters.h
View file @
d5638d0f
...
...
@@ -2,6 +2,7 @@
#define STDADAPTERS_H
#include <functional>
#include <algorithm>
namespace
Poly
{
...
...
@@ -12,7 +13,7 @@ class Matrix;
namespace
std
{
#ifndef _CONCAT
#define
_CONCAT(A, B) A ## B
#define _CONCAT(A, B) A ## B
#endif
#define _UNARY_STD_ADAPTER(func_name) \
...
...
@@ -20,7 +21,7 @@ template <typename T, int M> \
Poly::Matrix<T,M> func_name(const Poly::Matrix<T,M>& mat) \
{ \
Poly::Matrix<T,M> res(mat.rows(), mat.columns()); \
std::transform(mat.begin(),mat.end(),res.begin(),std::pointer_to_unary_function<T,T>(std::
ceil
)); \
std::transform(mat.begin(),mat.end(),res.begin(),std::pointer_to_unary_function<T,T>(std::
func_name
)); \
return res; \
}
...
...
@@ -28,7 +29,7 @@ Poly::Matrix<T,M> func_name(const Poly::Matrix<T,M>& mat) \
template <typename T, int M> \
void _CONCAT(func_name, _inplace)(Poly::Matrix<T,M>& mat) \
{ \
std::transform(mat.begin(),mat.end(),mat.begin(),std::pointer_to_unary_function<T,T>(std::
ceil
)); \
std::transform(mat.begin(),mat.end(),mat.begin(),std::pointer_to_unary_function<T,T>(std::
func_name
)); \
}
#define _BINARY_STD_ADAPTER(func_name) \
...
...
@@ -158,6 +159,7 @@ _UNARY_STD_ADAPTER(isinf)
_UNARY_STD_ADAPTER
(
isnormal
)
_UNARY_STD_ADAPTER
(
signbit
)
_UNARY_STD_ADAPTER_INPLACE
(
abs
)
_UNARY_STD_ADAPTER_INPLACE
(
acos
)
_UNARY_STD_ADAPTER_INPLACE
(
acosh
)
...
...
src/StdAdapters.cpp
View file @
d5638d0f
#include "StdAdapters.h"
#include "
internal/
StdAdapters.h"
tests/tests.cpp
View file @
d5638d0f
...
...
@@ -2,7 +2,6 @@
#include <locale>
#include "tests.h"
int
RunTests
()
{
// Py_SetProgramName("MatricesTest"); /* optional but recommended */
...
...
@@ -44,9 +43,6 @@ int RunTests()
int
main
()
{
int
len
=
3
;
Poly
::
Matrix
<
double
>
mat_d
=
Poly
::
RandomMatrix
<
double
>
(
len
,
len
,
0
,
10
,
std
::
random_device
{}());
Poly
::
Matrix
<
double
>
mat_e
=
Poly
::
RandomMatrix
<
double
>
(
len
,
len
,
0
,
10
,
std
::
random_device
{}());
RunTests
();
std
::
cout
<<
"Tests program exited with no errors."
<<
std
::
endl
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment