Skip to content
Snippets Groups Projects

Draft: Do dot product using lambda functions

Open Yen-Chen Chen requested to merge cpp_inner_product into feature-add-cpp-codes

What is the new feature

Reduce dot product code using lambda functions. After the new commit. I think this solution is cleaner than the Kokkos subview method.

How is it implemented

This solution uses three lambda functions so that within c++20 standard (required for lambda template), we can wrap any dot product to single line execution.
The advantage is

  1. For all dot products, we just have to redefine the lambda function and register it.
  2. Without using mdspan, we don't have to use c++23.

The disadvantage is

  1. The code is really complicated and I don't know if anyone understands.
  2. To use this feature, one at least has to know how to write an lambda function.

Another solution is to just reduce code using an inner for-loop. (This would have a slight overhead of computing the incrementing id.)

Mandatory steps before review

  • Gitlab CI passes (Hint: use make format for linting)
  • New feature is covered by additional unit tests
  • Mark the merge request as ready by removing Draft:

Mandatory steps before merge

  • Reviewed by a maintainer
  • Incorporate review suggestions
  • Remember to edit the commit message and select the proper changelog category (feature/bugfix/other)
  • Prior to merging, please remove any boilerplate from the MR description, retaining only the Please describe your feature in a couple of words and describe important implementation details of the feature section to maintain

You are not supposed to merge this request by yourself, the maintainers of libiconmath take care of this action!

Edited by Yen-Chen Chen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading