Apollo 10.0
自动驾驶开放平台
util.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <fstream>
20#include <functional>
21#include <map>
22#include <string>
23#include <vector>
24
25#include "Eigen/Dense"
26
29
30namespace apollo {
31namespace perception {
32namespace radar4d {
33
34enum {
36};
37
38typedef Eigen::Matrix<double, VALID_OBJECT_TYPE, 1> Vectord;
39typedef Eigen::Matrix<int, VALID_OBJECT_TYPE, 1> Vectori;
40typedef Eigen::Matrix<double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE> Matrixd;
41
42namespace util {
43
50void FromStdToVector(const std::vector<float>& src_prob, Vectord* dst_prob);
51
58void FromEigenToVector(const Vectord& src_prob, std::vector<float>* dst_prob);
59
65void ToLog(Vectord* prob);
66
72void ToExp(Vectord* prob);
73
79void ToExpStable(Vectord* prob);
80
86void Normalize(Vectord* prob);
87
93void NormalizeRow(Matrixd* prob);
94
103bool LoadSingleMatrix(std::ifstream& fin, Matrixd* matrix);
104
113bool LoadSingleMatrixFile(const std::string& filename, Matrixd* matrix);
114
124 const std::string& filename,
126
127} // namespace util
128} // namespace radar4d
129} // namespace perception
130} // namespace apollo
std::map< T, EigenType, std::less< T >, Eigen::aligned_allocator< std::pair< const T, EigenType > > > EigenMap
Definition eigen_defs.h:40
void ToExpStable(Vectord *prob)
Compute stable exponential of Vectord
Definition util.cc:58
bool LoadSingleMatrixFile(const std::string &filename, Matrixd *matrix)
Load single matrix from file
Definition util.cc:94
void ToExp(Vectord *prob)
Compute exponential of Vectord
Definition util.cc:52
bool LoadMultipleMatricesFile(const std::string &filename, EigenMap< std::string, Matrixd > *matrices)
Definition util.cc:108
void Normalize(Vectord *prob)
Compute normalize of Vectord
Definition util.cc:65
bool LoadSingleMatrix(std::ifstream &fin, Matrixd *matrix)
Load single matrix
Definition util.cc:85
void ToLog(Vectord *prob)
Compute log of Vectord
Definition util.cc:46
void NormalizeRow(Matrixd *prob)
Compute normalize row of Matrixd
Definition util.cc:71
void FromEigenToVector(const Vectord &src_prob, std::vector< float > *dst_prob)
Transfrom Eigen to vector
Definition util.cc:37
void FromStdToVector(const std::vector< float > &src_prob, Vectord *dst_prob)
From std to vector
Definition util.cc:29
Eigen::Matrix< double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE > Matrixd
Definition util.h:40
Eigen::Matrix< int, VALID_OBJECT_TYPE, 1 > Vectori
Definition util.h:39
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
Definition util.h:38
class register implement
Definition arena_queue.h:37