projection_hash_abstract.h 1.64 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (C) 2011  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#undef DLIB_PROJECTION_HASh_ABSTRACT_H__
#ifdef DLIB_PROJECTION_HASh_ABSTRACT_H__

#include "../matrix.h"
#include "../rand.h"
#include <vector>

namespace dlib
{

// ----------------------------------------------------------------------------------------

    class projection_hash
    {
        /*!
            WHAT THIS OBJECT REPRESENTS
        !*/
    public:

        projection_hash(
        );

        template <typename EXP1, typename EXP2>
        projection_hash(
            const matrix_exp<EXP1>& proj,
            const matrix_exp<EXP2>& offset
        ); 

        const matrix<double>& get_projection_matrix (
        ) const;

        const matrix<double,0,1>& get_offset_matrix (
        ) const; 

        unsigned long size (
        ) const;

        template <typename EXP>
        unsigned long operator() (
            const matrix_exp<EXP>& v
        ) const;
    };

// ----------------------------------------------------------------------------------------

    void serialize (
        const projection_hash& item,
        std::ostream& out
    );

    void deserialize (
        projection_hash& item,
        std::istream& in 
    );

// ----------------------------------------------------------------------------------------

    template <typename vector_type>
    projection_hash create_random_projection_hash (
        const vector_type& v,
        const int bits
    );

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_PROJECTION_HASh_ABSTRACT_H__