Version: 8.3.0
LinearDecoder Class Reference

#include <decode.hxx>

Inheritance diagram for LinearDecoder:
Collaboration diagram for LinearDecoder:

Public Member Functions

 LinearDecoder (std::vector< std::pair< double, double > > &)
 
virtual std::vector< double > * code (std::vector< double > &)
 
virtual std::vector< double > * decode (std::vector< double > &)
 
- Public Member Functions inherited from Decoder
void echo (Solution &)
 

Private Attributes

std::vector< double > a
 
std::vector< double > b
 

Additional Inherited Members

- Protected Attributes inherited from Decoder
long size
 

Detailed Description

Definition at line 37 of file decode.hxx.

Constructor & Destructor Documentation

LinearDecoder::LinearDecoder ( std::vector< std::pair< double, double > > &  borne)

Definition at line 44 of file decode.cxx.

References a, b, CORBAEngineTest::i, and Decoder::size.

45 {
46  int i;
47 
48  size = borne.size();
49  a.resize(size);
50  b.resize(size);
51  for (i=0; i < size; i++) {
52  a[i] = borne[i].second - borne[i].first;
53  b[i] = borne[i].first;
54  }
55 }

Member Function Documentation

std::vector< double > * LinearDecoder::code ( std::vector< double > &  in)
virtual

Implements Decoder.

Definition at line 70 of file decode.cxx.

References a, b, CORBAEngineTest::i, PMMLBasicsTestLauncher::ret, and Decoder::size.

71 {
72  std::vector<double> *ret;
73  long i;
74 
75  ret = new std::vector<double>(size);
76  for (i=0; i<size; i++)
77  (*ret)[i] = (in[i] - b[i]) / a[i];
78  return ret;
79 }
std::vector< double > * LinearDecoder::decode ( std::vector< double > &  in)
virtual

Implements Decoder.

Definition at line 58 of file decode.cxx.

References a, b, CORBAEngineTest::i, PMMLBasicsTestLauncher::ret, and Decoder::size.

59 {
60  std::vector<double> *ret;
61  long i;
62 
63  ret = new std::vector<double>(size);
64  for (i=0; i<size; i++)
65  (*ret)[i] = a[i]*in[i] + b[i];
66  return ret;
67 }

Member Data Documentation

std::vector<double> LinearDecoder::a
private

Definition at line 39 of file decode.hxx.

Referenced by code(), decode(), and LinearDecoder().

std::vector<double> LinearDecoder::b
private

Definition at line 39 of file decode.hxx.

Referenced by code(), decode(), and LinearDecoder().


The documentation for this class was generated from the following files: