DiSMEC++
postproc.h
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #ifndef DISMEC_POSTPROC_H
7 #define DISMEC_POSTPROC_H
8 
9 #include "matrix_types.h"
10 #include "fwd.h"
11 #include <memory>
12 #include "stats/tracked.h"
13 
14 namespace dismec::postproc {
15  class PostProcessFactory;
16  using FactoryPtr = std::shared_ptr<PostProcessFactory>;
17  class PostProcessor : public stats::Tracked {
18  public:
19  virtual ~PostProcessor() = default;
20 
22  virtual void process(label_id_t label_id, Eigen::Ref<DenseRealVector> weight_vector, solvers::MinimizationResult& result) = 0;
23  };
24 
26  public:
27  virtual ~PostProcessFactory() = default;
28 
29  [[nodiscard]] virtual std::unique_ptr<PostProcessor> make_processor(const std::shared_ptr<objective::Objective>& objective) const = 0;
30  };
31 
35  FactoryPtr create_combined(std::vector<FactoryPtr> processor);
36  FactoryPtr create_reordering(Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> ordering);
37 }
38 
39 
40 #endif //DISMEC_POSTPROC_H
Strong typedef for an int to signify a label id.
Definition: types.h:20
virtual std::unique_ptr< PostProcessor > make_processor(const std::shared_ptr< objective::Objective > &objective) const =0
virtual ~PostProcessor()=default
virtual void process(label_id_t label_id, Eigen::Ref< DenseRealVector > weight_vector, solvers::MinimizationResult &result)=0
Apply post-processing for the weight_vector corresponding to the label label_id.
A base class to be used for all types that implement some for of statistics tracking.
Definition: tracked.h:42
Forward-declares types.
FactoryPtr create_combined(std::vector< FactoryPtr > processor)
std::shared_ptr< PostProcessFactory > FactoryPtr
Definition: postproc.h:16
FactoryPtr create_reordering(Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic, int > ordering)
Definition: reorder.cpp:25
FactoryPtr create_identity()
Definition: postproc.cpp:50
FactoryPtr create_sparsify(real_t tolerance)
Definition: sparsify.cpp:167
FactoryPtr create_culling(real_t eps)
Definition: postproc.cpp:54
float real_t
The default type for floating point values.
Definition: config.h:17