HighMap library (C++)
Loading...
Searching...
No Matches
vector_utils.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
15#pragma once
16
17#include <vector>
18
19typedef unsigned int uint;
20
21namespace hmap
22{
23
24// TODO clean up
25
26size_t upperbound_right(const std::vector<float> &v, float value);
27
28std::vector<size_t> argsort(const std::vector<float> &v);
29
30template <typename T>
31void reindex_vector(std::vector<T> &v, std::vector<size_t> &idx)
32{
33 std::vector<T> v_new(v.size());
34 for (uint k = 0; k < v.size(); k++)
35 v_new[k] = v[idx[k]];
36 v = v_new;
37}
38
39void vector_unique_values(std::vector<float> &v);
40
41} // namespace hmap
unsigned int uint
Definition array.hpp:14
Definition algebra.hpp:28
size_t upperbound_right(const std::vector< float > &v, float value)
Definition vector_utils.cpp:27
std::vector< size_t > argsort(const std::vector< float > &v)
Definition vector_utils.cpp:16
void vector_unique_values(std::vector< float > &v)
Definition vector_utils.cpp:42
void reindex_vector(std::vector< T > &v, std::vector< size_t > &idx)
Definition vector_utils.hpp:31
unsigned int uint
Definition vector_utils.hpp:19