Commit da29ac8a authored by Davis King's avatar Davis King

Changed sparse vector definition to encourage use of unsigned keys.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403513
parent 43516aa8
...@@ -16,12 +16,12 @@ namespace dlib ...@@ -16,12 +16,12 @@ namespace dlib
In dlib, sparse vectors are represented using the container objects In dlib, sparse vectors are represented using the container objects
in the C++ STL. In particular, a sparse vector is any container that in the C++ STL. In particular, a sparse vector is any container that
contains a sorted range of std::pair<key, scalar_value> objects where: contains a sorted range of std::pair<key, scalar_value> objects where:
- key is any type that can serve as a unique index or identifier (e.g. long) - key is any type that can serve as a unique index or identifier (e.g. unsigned long)
- scalar_value is float, double, or long double - scalar_value is float, double, or long double
So examples of valid sparse vectors are: So examples of valid sparse vectors are:
- std::map<long, double> - std::map<unsigned long, double>
- std::vector<std::pair<long, float> > where the vector is sorted. - std::vector<std::pair<unsigned long, float> > where the vector is sorted.
(you could make sure it was sorted by applying std::sort to it) (you could make sure it was sorted by applying std::sort to it)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment