From 0e5c09a607e151b60a31fcfe9a94090e068d7056 Mon Sep 17 00:00:00 2001 From: vdubos Date: Thu, 21 Sep 2023 10:56:01 +0200 Subject: [PATCH 1/2] add lrmatgenerator doc --- docs/htool | 2 +- .../advance_usage_cpp/custom_low_rank_generator.rst | 6 ++++++ docs/source/cpp_api/advance_usage_cpp/index.rst | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 docs/source/cpp_api/advance_usage_cpp/custom_low_rank_generator.rst create mode 100644 docs/source/cpp_api/advance_usage_cpp/index.rst diff --git a/docs/htool b/docs/htool index 9a243c1..96f2f87 160000 --- a/docs/htool +++ b/docs/htool @@ -1 +1 @@ -Subproject commit 9a243c108d09248f63e008fae4020e54f43fecc3 +Subproject commit 96f2f87805f25806f3d8e7969362a54c921985b7 diff --git a/docs/source/cpp_api/advance_usage_cpp/custom_low_rank_generator.rst b/docs/source/cpp_api/advance_usage_cpp/custom_low_rank_generator.rst new file mode 100644 index 0000000..94136bc --- /dev/null +++ b/docs/source/cpp_api/advance_usage_cpp/custom_low_rank_generator.rst @@ -0,0 +1,6 @@ + + +Custom low rank generator +######################### + +.. doxygenclass:: htool::VirtualLowRankGenerator \ No newline at end of file diff --git a/docs/source/cpp_api/advance_usage_cpp/index.rst b/docs/source/cpp_api/advance_usage_cpp/index.rst new file mode 100644 index 0000000..e6ba25c --- /dev/null +++ b/docs/source/cpp_api/advance_usage_cpp/index.rst @@ -0,0 +1,8 @@ +C++ -- Advance usage +#################### + +.. toctree:: + :maxdepth: 2 + :caption: Overview + + custom_low_rank_generator From 5a42744dd07b04092095d773296a5d89b670ceb7 Mon Sep 17 00:00:00 2001 From: vdubos Date: Fri, 22 Sep 2023 11:54:35 +0200 Subject: [PATCH 2/2] fix --- docs/htool | 2 +- docs/source/cpp_api/advance_usage_cpp.rst | 73 ----------------------- docs/source/cpp_api/index.rst | 2 +- 3 files changed, 2 insertions(+), 75 deletions(-) delete mode 100644 docs/source/cpp_api/advance_usage_cpp.rst diff --git a/docs/htool b/docs/htool index 96f2f87..bb1bce7 160000 --- a/docs/htool +++ b/docs/htool @@ -1 +1 @@ -Subproject commit 96f2f87805f25806f3d8e7969362a54c921985b7 +Subproject commit bb1bce7ad52a6a5a91316b866cb76f8ca039e033 diff --git a/docs/source/cpp_api/advance_usage_cpp.rst b/docs/source/cpp_api/advance_usage_cpp.rst deleted file mode 100644 index fffc0c0..0000000 --- a/docs/source/cpp_api/advance_usage_cpp.rst +++ /dev/null @@ -1,73 +0,0 @@ - -.. _cpp_api: - -C++ -- Advance usage -################## - -Installation ------------- - -Htool is a C++11 header library, you need to download it, using for example - -.. code-block:: bash - - git clone https://github.com/htool-ddm/htool - -and you need to include the header files contained in `include/htool `_. Note that Htool requires - -- a MPI implementation, to perform communications on parallel computing architectures, -- a BLAS implementation, to perform algebraic operations (dense matrix-matrix or matrix-vector operations). - -And optionally - -- LAPACK, to perform SVD compression, -- `HPDDM`_ and its dependencies (BLAS, LAPACK) to use iterative solvers and DDM preconditioners. - -Required inputs ---------------- - -At the very least, Htool requires a geometry and a function to generate the coefficients of the matrix you wish to compress. More precisely, - -- the geometry is a matrix of size :math:`d\times N`, where :math:`N` is the number of points and :math:`d` the geometric dimension, stored in a column-major array, -- the function generating the coefficients is passed to Htool using the interface :cpp:class:`htool::VirtualGenerator`. - -Here is an example where we define the interaction between to set of points ``target_points`` and ``source_points`` with :math:`\kappa (x,y)=e^{-|x-y|}`: - -.. code-block:: cpp - - class MyMatrix : public VirtualGenerator { - const vector & target_points; - const vector & source_points; - int dimension; - - public: - MyMatrix(int dimension0, int nr, int nc, const vector &p10, const vector &p20) : VirtualGenerator(nr, nc), target_points (target_points_0), source_points(source_points_0), dimension(dimension0) {} - - void copy_submatrix(int M, int N, const int *const rows, const int *const cols, double *ptr) const override { - for (int j = 0; j < M; j++) { - for (int k = 0; k < N; k++) { - double norm2=0; - for (int p = 0; p < dimension; p++) { - norm2+= (target_points[p+dimension*row[j]]-source_points[p+dimension*cols[k]])*(target_points[p+dimension*row[j]]-source_points[p+dimension*cols[k]]); - } - ptr[j + M * k] = exp(-sqrt(norm2)); - } - } - } - }; - - -.. note:: Htool does not have any a priori information on the kernel, so it is up to the user to optimize the computations in :cpp:class:`htool::VirtualGenerator::copy_submatrix`. - - -Build a HMatrix ---------------- - -Use a HMatrix -------------- - -Full example ------------- - -Solvers -------- diff --git a/docs/source/cpp_api/index.rst b/docs/source/cpp_api/index.rst index be3ad6c..49c7637 100644 --- a/docs/source/cpp_api/index.rst +++ b/docs/source/cpp_api/index.rst @@ -5,5 +5,5 @@ :caption: Overview basic_usage_cpp/index - advance_usage_cpp + advance_usage_cpp/index reference