Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
4c426786
Commit
4c426786
authored
8 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[bindings] add matching type to matrix/vector
parent
93f1835c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/xt/la/bindings.cc
+9
-9
9 additions, 9 deletions
dune/xt/la/bindings.cc
dune/xt/la/container/matrix-interface.pbh
+7
-6
7 additions, 6 deletions
dune/xt/la/container/matrix-interface.pbh
dune/xt/la/container/vector-interface.pbh
+0
-3
0 additions, 3 deletions
dune/xt/la/container/vector-interface.pbh
with
16 additions
and
18 deletions
dune/xt/la/bindings.cc
+
9
−
9
View file @
4c426786
...
...
@@ -43,12 +43,12 @@ PYBIND11_PLUGIN(_la)
LA
::
bind_Backends
(
m
);
LA
::
bind_Vector
<
LA
::
CommonDenseVector
<
double
>>
(
m
,
"CommonDenseVector_double"
);
auto
common_dense_vector_double
=
LA
::
bind_Vector
<
LA
::
CommonDenseVector
<
double
>>
(
m
,
"CommonDenseVector_double"
);
#if HAVE_DUNE_ISTL
LA
::
bind_Vector
<
LA
::
IstlDenseVector
<
double
>>
(
m
,
"IstlDenseVector_double"
);
auto
istl_dense_vector_double
=
LA
::
bind_Vector
<
LA
::
IstlDenseVector
<
double
>>
(
m
,
"IstlDenseVector_double"
);
#endif
#if HAVE_EIGEN
LA
::
bind_Vector
<
LA
::
EigenDenseVector
<
double
>>
(
m
,
"EigenDenseVector_double"
);
auto
eigen_dense_vector_double
=
LA
::
bind_Vector
<
LA
::
EigenDenseVector
<
double
>>
(
m
,
"EigenDenseVector_double"
);
#endif
LA
::
bind_SparsityPatternDefault
(
m
);
...
...
@@ -56,7 +56,7 @@ PYBIND11_PLUGIN(_la)
#define BIND_MATRIX(C, s, c, id) auto c = LA::bind_Matrix<C, s>(m, id);
BIND_MATRIX
(
LA
::
CommonDenseMatrix
<
double
>
,
false
,
common_dense_matrix_double
,
"CommonDenseMatrix_double"
);
BIND_MATRIX
(
LA
::
CommonSparseMatrix
<
double
>
,
true
,
common_sparse_matrix_double
,
"CommonSparseMatrix_double"
);
//
BIND_MATRIX(LA::CommonSparseMatrix<double>, true, common_sparse_matrix_double, "CommonSparseMatrix_double");
#if HAVE_DUNE_ISTL
BIND_MATRIX
(
LA
::
IstlRowMajorSparseMatrix
<
double
>
,
true
,
...
...
@@ -71,14 +71,14 @@ PYBIND11_PLUGIN(_la)
"EigenRowMajorSparseMatrix_double"
);
#endif
#undef BIND_MATRIX
LA
::
addbind_Matrix_Vector_interaction
<
LA
::
C
ommon
D
ense
Vector
<
double
>>
(
common_dense_
matrix
_double
);
LA
::
addbind_Matrix_Vector_interaction
<
LA
::
CommonDenseVector
<
double
>>
(
common_
sparse_matrix
_double
);
LA
::
addbind_Matrix_Vector_interaction
(
c
ommon
_d
ense
_matrix_
double
,
common_dense_
vector
_double
);
//
LA::addbind_Matrix_Vector_interaction
(common_sparse_matrix_
double
,
common_
dense_vector
_double);
#if HAVE_DUNE_ISTL
LA
::
addbind_Matrix_Vector_interaction
<
LA
::
IstlDenseVector
<
double
>>
(
istl_row_major_sparse_matrix_double
);
LA
::
addbind_Matrix_Vector_interaction
(
istl_row_major_sparse_matrix_double
,
istl_dense_vector_double
);
#endif
#if HAVE_EIGEN
LA
::
addbind_Matrix_Vector_interaction
<
LA
::
E
igen
D
ense
Vector
<
double
>>
(
eigen_dense_
matrix
_double
);
LA
::
addbind_Matrix_Vector_interaction
<
LA
::
EigenDenseVector
<
double
>>
(
eigen_row_major_sparse_matrix_double
);
LA
::
addbind_Matrix_Vector_interaction
(
e
igen
_d
ense
_matrix_
double
,
eigen_dense_
vector
_double
);
LA
::
addbind_Matrix_Vector_interaction
(
eigen_row_major_sparse_matrix_double
,
eigen_dense_vector_double
);
#endif
LA
::
bind_Solver
<
LA
::
CommonDenseMatrix
<
double
>>
(
m
,
"CommonDenseMatrix_double"
);
...
...
This diff is collapsed.
Click to expand it.
dune/xt/la/container/matrix-interface.pbh
+
7
−
6
View file @
4c426786
...
...
@@ -99,8 +99,6 @@ typename std::enable_if<is_matrix<C>::value, pybind11::class_<C>>::type bind_Mat
addbind_ProvidesBackend(c);
c.def_property_readonly_static("vector_type", [](py::object /*self*/) { return C::vector_type; });
internal::addbind_Matrix<C, sparse>::template ctor<S>(c);
c.def("__init__",
[](C& self, const ssize_t rows, const ssize_t cols, const SparsityPatternDefault& pattern) {
...
...
@@ -161,14 +159,17 @@ typename std::enable_if<is_matrix<C>::value, pybind11::class_<C>>::type bind_Mat
} // ... bind_Matrix(...)
template <class
V
, class
M
>
void addbind_Matrix_Vector_interaction(pybind11::class_<M>& c)
template <class
M
, class
V
>
void addbind_Matrix_Vector_interaction(pybind11::class_<M>&
mat, pybind11::class_<V>& ve
c)
{
namespace py = pybind11;
c.def("mv", [](const M& self, const V& xx, V& yy) { self.mv(xx, yy); }, "source", "range");
mat.def("mv", [](const M& self, const V& xx, V& yy) { self.mv(xx, yy); }, "source", "range");
mat.def(py::self * V());
c.def(py::self * V());
mat.def("vector_type", [vec](M& /*self*/) { return vec; });
vec.def("matrix_type", [mat](V& /*self*/) { return mat; });
} // ... addbind_Matrix_Vector_interaction(...)
...
...
This diff is collapsed.
Click to expand it.
dune/xt/la/container/vector-interface.pbh
+
0
−
3
View file @
4c426786
...
...
@@ -43,9 +43,6 @@ typename std::enable_if<is_vector<C>::value, pybind11::class_<C>>::type bind_Vec
py::class_<C> c = bind_ProvidesDataAccess<C>(m, id, id);
addbind_ProvidesBackend(c);
c.def_property_readonly_static("dense_matrix_type", [](py::object /*self*/) { return C::dense_matrix_type; });
c.def_property_readonly_static("sparse_matrix_type", [](py::object /*self*/) { return C::sparse_matrix_type; });
c.def("__init__",
[](C& vec, const ssize_t size, const S& value) {
try {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment