Tapkee
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
projection.hpp
Go to the documentation of this file.
1
/* This software is distributed under BSD 3-clause license (see LICENSE file).
2
*
3
* Copyright (c) 2012-2013 Sergey Lisitsyn, Fernando Iglesias
4
*/
5
6
#ifndef TAPKEE_PROJECTION_H_
7
#define TAPKEE_PROJECTION_H_
8
9
namespace
tapkee
10
{
11
13
struct
ProjectionImplementation
14
{
15
virtual
~ProjectionImplementation
()
16
{
17
}
21
virtual
DenseVector
project
(
const
DenseVector
& vec) = 0;
22
};
23
25
struct
ProjectingFunction
26
{
27
ProjectingFunction
() :
implementation
(NULL) {};
28
ProjectingFunction
(
ProjectionImplementation
* impl) :
implementation
(impl) {};
30
void
clear
()
31
{
32
delete
implementation
;
33
}
37
inline
DenseVector
operator()
(
const
DenseVector
& vec)
38
{
39
return
implementation
->
project
(vec);
40
}
41
ProjectionImplementation
*
implementation
;
42
};
43
46
struct
MatrixProjectionImplementation
:
public
ProjectionImplementation
47
{
48
MatrixProjectionImplementation
(
DenseMatrix
matrix,
DenseVector
mean) :
proj_mat
(matrix),
mean_vec
(mean)
49
{
50
}
51
52
virtual
~MatrixProjectionImplementation
()
53
{
54
}
55
56
virtual
DenseVector
project
(
const
DenseVector
& vec)
57
{
58
return
proj_mat
*(vec-
mean_vec
);
59
}
60
61
DenseMatrix
proj_mat
;
62
DenseVector
mean_vec
;
63
};
64
65
}
66
#endif
include
tapkee
projection.hpp
Generated by
1.8.3.1