algorithmfoundry / Foundry

The Cognitive Foundry is an open-source Java library for building intelligent systems using machine learning
Other
131 stars 41 forks source link

Speeding up sparse vector set #77

Closed jbasilico closed 5 years ago

jbasilico commented 5 years ago

Avoiding doing a lookup on setting a value in a SparseVector each time, since that requires 2 lookups, which makes it slow. Instead, only do the check when the value passed in is 0 to avoid adding a 0 element to the underlying vector.