SHOGUN  v3.2.0
所有成员列表 | Public 成员函数 | Protected 属性
ParameterMap类 参考

详细描述

Implements a map of ParameterMapElement instances Maps one key to a set of values.

Implementation is done via an array. Via the call finalize_map(), a hidden structure is built which bundles all values for each key. Then, get() may be called, which returns an array of values for a key. If it is called before, an error is thrown.

Putting elements is in O(1). finalize_map sorts the underlying array and then regroups values, O(n*log n). Add all values and then call once. Getting a set of values is possible in O(log n) via binary search

在文件 ParameterMap.h161 行定义.

Public 成员函数

 ParameterMap ()
 
virtual ~ParameterMap ()
 
void put (const SGParamInfo *key, const SGParamInfo *value)
 
DynArray< const SGParamInfo * > * get (const SGParamInfo) const
 
DynArray< const SGParamInfo * > * get (const SGParamInfo *key) const
 
void finalize_map ()
 
void print_map ()
 

Protected 属性

DynArray< ParameterMapElement * > m_map_elements
 
DynArray< ParameterMapElement * > m_multi_map_elements
 
bool m_finalized
 

构造及析构函数说明

§ ParameterMap()

constructor

在文件 ParameterMap.cpp235 行定义.

§ ~ParameterMap()

~ParameterMap ( )
virtual

destructor

在文件 ParameterMap.cpp241 行定义.

成员函数说明

§ finalize_map()

void finalize_map ( )

Finalizes the map. Has to be called before get may be called if more than one element in map

Operation in O(n*log n)

在文件 ParameterMap.cpp301 行定义.

§ get() [1/2]

DynArray< const SGParamInfo * > * get ( const SGParamInfo  key) const

Gets a specific element of the map finalize_map() has to be called first if more than one elements are in map.

Operation in O(log n)

Same as below but without pointer for syntactic ease.

parameter key: key of the element to get returns set of values of the key element

在文件 ParameterMap.cpp274 行定义.

§ get() [2/2]

DynArray< const SGParamInfo * > * get ( const SGParamInfo key) const

Gets a specific element of the map. finalize_map() has to be called first if more than one elements are in map.

Operation in O(log n)

参数
keykey of the element to get
返回
set of values of the key element

在文件 ParameterMap.cpp279 行定义.

§ print_map()

void print_map ( )

prints all elements of this map

在文件 ParameterMap.cpp372 行定义.

§ put()

void put ( const SGParamInfo key,
const SGParamInfo value 
)

Puts an newly allocated element into the map. Note that get(...) returns an array of value elements, so it is allowed to add multiple values for one key. Note that there is also no check for double entries, i.e. same key and same value.This will result in two elements when get is called. Operation in O(1).

参数
keykey of the element
valuevalue of the lement

在文件 ParameterMap.cpp250 行定义.

类成员变量说明

§ m_finalized

bool m_finalized
protected

variable that indicates if its possible to call get method

在文件 ParameterMap.h225 行定义.

§ m_map_elements

DynArray<ParameterMapElement*> m_map_elements
protected

list of CLinearMap elements, this is always kept sorted

在文件 ParameterMap.h218 行定义.

§ m_multi_map_elements

DynArray<ParameterMapElement*> m_multi_map_elements
protected

hidden internal structure which is used to hold multiple values for one key. It is built when finalize_map() is called.

在文件 ParameterMap.h222 行定义.


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation