Skip to content

Simple custom complex class (cxsmpl) #307

Closed

Description

@valassi

This is a placeholder for an idea I had in mind since quite some time. But unless I am wrong I have not opened a ticket for this yet.

The idea is to add yet another complex typedef, in addition to std, thrust and cucomplex. We can simply create a custom complex class that works for ALL backends (c++, cuda, and possibly alpaka, kokkos, sycl).

The point is that we only really need very basic operations in complex: addition, subtraction, multiplication, division. All of these can be very simply inlined in simple code, and actually some of these ALREADY are inlined in a header for the vector complex class. So essentially this would be an extension to the scalar type (RI) of the present cxtype_v class (RRRRIIII), it should be quite easy to do.

One additional benefit of this approach would be that we can define many methods as constexpr. This would be useful for instance in the definition of hardcoded parameters (issues #23 and #39 and PR #306).

Activity

  1. valassi commented on Dec 9, 2021

    @valassi
    MemberAuthor

    Note: this is IMO a better alternative to trying to use thrust complex also in c++ (#147).

  2. self-assigned this
    on Jan 11, 2022
  3. changed the title [-]Simple custom complex class[/-] [+]Simple custom complex class (cxsmpl)[/+] on Jan 11, 2022
  4. valassi commented on Jan 11, 2022

    @valassi
    MemberAuthor

    This is done in #327, which I am about to merge.

    Note that I enable cxsmpl by default for c++ but keep thrust for cuda, as these are the fastest options.

    The constexpr business for #39 can start off from here but needs more work.

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions