Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign C++ code to be more generic #6

Closed
BerndDoser opened this issue Sep 28, 2018 · 0 comments
Closed

Redesign C++ code to be more generic #6

BerndDoser opened this issue Sep 28, 2018 · 0 comments
Assignees
Labels
discussion Open discussion enhancement New feature or request
Milestone

Comments

@BerndDoser
Copy link
Member

The first version of PINK was written basically in C-style and we have duplicated code for CPU and GPU execution. Therefore, for PINK version 2 we would like to rewrite the code to get a more generic structure to avoid the CPU/GPU code duplication and to enable the implementation of an python interface, so that the C++ functions can be called directly in python.

The development will be performed in the branch https://github.com/HITS-AIN/PINK/tree/redesign.

The basic idea is to separate data and algorithm classes and to formulate the SOM, neurons and training objects as LayoutTypes. We start with the two LayoutTypes Cartesian<dim, T> and Hexagonal<T>, where dim is the dimension of the cartesian grid and T the data type, e.g. float. A image has then the type Cartesian<2, float>. The type of a 2-dimensional, cartesian SOM would be Cartesian<2, Cartesian<2, float>> or Hexagonal<Cartesian<2, float>> for a hexagonal SOM.

The SOM training and mapping algorithms are formulated as Functors, where the call operator gets the SOM and the training data object:

struct Trainer {
    template <typename SOMType>
    void operator () (SOMType& som, typename SOMType::NeuronType const& image) const;
};

The new design makes it also easier to add new SOM types and training algorithms.

Discussions and suggestions are always welcome.

@BerndDoser BerndDoser added enhancement New feature or request help wanted Extra attention is needed labels Sep 28, 2018
@BerndDoser BerndDoser added this to the 2.0 milestone Sep 28, 2018
@BerndDoser BerndDoser self-assigned this Sep 28, 2018
@BerndDoser BerndDoser added discussion Open discussion and removed help wanted Extra attention is needed labels Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Open discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant