12 #ifndef RTCTK_EXAMPLEDATATASK_COMPUTATION_HPP
13 #define RTCTK_EXAMPLEDATATASK_COMPUTATION_HPP
38 m_n_slopes = n_slopes;
42 m_IM.resize(m_n_acts, m_n_slopes);
43 m_CM.resize(m_n_slopes, m_n_acts);
44 m_ipiv.resize(m_n_acts);
47 LOG4CPLUS_DEBUG(
GetLogger(),
"m_n_slopes: " << m_n_slopes);
48 LOG4CPLUS_DEBUG(
GetLogger(),
"m_n_acts: " << m_n_acts);
52 m_IM = std::move(data);
54 if (m_n_acts != (
int)m_IM.GetNrows() || m_n_slopes != (
int)m_IM.GetNcols()) {
55 std::stringstream err_text;
56 err_text <<
"IM wrong shape, "
57 <<
"expected:" << m_n_acts <<
" x " << m_n_slopes
58 <<
"received: " << m_IM.GetNrows() <<
" x " << m_IM.GetNcols();
73 auto time_start = std::chrono::system_clock::now();
75 if (algorithm == SimpleInversion) {
77 memcpy((
void*)m_CM.data(), (
void*)m_IM.data(), m_n_slopes * m_n_acts *
sizeof(
float));
79 LAPACK_ROW_MAJOR, m_n_acts, m_n_slopes, m_CM.data(), m_n_slopes, m_ipiv.data());
80 LAPACKE_sgetri(LAPACK_ROW_MAJOR, m_n_slopes, m_CM.data(), m_n_acts, m_ipiv.data());
83 py::scoped_interpreter py_guard;
85 auto py_compute_module = py::module::import(
"rtctkExampleDataTaskPyLib");
86 auto py_inversion = py_compute_module.attr(
"inversion");
88 py_inversion(&m_IM, &m_CM);
91 auto elapsed = std::chrono::system_clock::now() - time_start;
93 return {m_CM, elapsed};
107 std::vector<int> m_ipiv;
112 #endif // RTCTK_EXAMPLEDATATASK_COMPUTATION_HPP