28 #ifndef SPLA_CPU_FORMAT_DOK_VEC_HPP
29 #define SPLA_CPU_FORMAT_DOK_VEC_HPP
49 std::vector<std::pair<uint, T>> tmp;
52 for (
const auto& entry : in.
Ax) {
53 tmp.emplace_back(entry.first, entry.second);
56 std::sort(tmp.begin(), tmp.end(), [](
const auto& a,
const auto& b) { return a.first < b.first; });
60 for (
const auto& entry : tmp) {
61 const uint i = entry.first;
62 const T x = entry.second;
75 assert(out.
Ax.size() == n_rows);
77 for (
const auto& entry : in.
Ax) {
78 const uint i = entry.first;
79 const T x = entry.second;
88 auto entry = vec.
Ax.find(row_id);
89 if (entry != vec.
Ax.end()) {
90 entry->second = vec.
reduce(entry->second, element);
94 vec.
Ax[row_id] = element;
CPU list-of-coordinates sparse vector representation.
Definition: cpu_formats.hpp:90
std::vector< uint > Ai
Definition: cpu_formats.hpp:96
std::vector< T > Ax
Definition: cpu_formats.hpp:97
CPU one-dim array for dense vector representation.
Definition: cpu_formats.hpp:74
std::vector< T > Ax
Definition: cpu_formats.hpp:80
Definition: cpu_formats.hpp:55
robin_hood::unordered_flat_map< uint, T > Ax
Definition: cpu_formats.hpp:63
Reduce reduce
Definition: cpu_formats.hpp:64
uint values
Definition: tdecoration.hpp:58
void cpu_dok_vec_to_dense(const uint n_rows, const CpuDokVec< T > &in, CpuDenseVec< T > &out)
Definition: cpu_format_dok_vec.hpp:72
void cpu_dok_vec_clear(CpuDokVec< T > &vec)
Definition: cpu_format_dok_vec.hpp:99
void cpu_dok_vec_to_coo(const CpuDokVec< T > &in, CpuCooVec< T > &out)
Definition: cpu_format_dok_vec.hpp:43
void cpu_dok_vec_add_element(uint row_id, T element, CpuDokVec< T > &vec)
Definition: cpu_format_dok_vec.hpp:85
std::uint32_t uint
Library index and size type.
Definition: config.hpp:56
Definition: algorithm.hpp:37