aboutsummaryrefslogtreecommitdiff
path: root/interactionhandler.cpp
blob: 64304c70391f86d556c4b07d00653fb92ad69765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "interactionhandler.h"

#include "mp.h"

InteractionHandler::InteractionHandler(const arma::mat &X,
                                       const arma::uvec &cpIndices)
    : m_X(X)
    , m_Y(X.n_rows, 2)
    , m_cpIndices(cpIndices)
    , m_technique(TECHNIQUE_LAMP)
{
}

void InteractionHandler::setTechnique(InteractionHandler::Technique technique)
{
    if (m_technique == technique)
        return;

    m_technique = technique;
}

void InteractionHandler::setCP(const arma::mat &Ys)
{
    switch (m_technique) {
    case TECHNIQUE_PLMP:
        mp::plmp(m_X, m_cpIndices, Ys, m_Y);
        break;
    case TECHNIQUE_LSP:
        // TODO
        // mp::lsp(m_X, m_cpIndices, Ys, m_Y);
        break;
    case TECHNIQUE_LAMP:
        mp::lamp(m_X, m_cpIndices, Ys, m_Y);
        break;
    case TECHNIQUE_PEKALSKA:
        // TODO
        // mp::pekalska(m_X, m_cpIndices, Ys, m_Y);
        break;
    }

    emit cpChanged(m_Y);
}