nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
lib/vsm: access to non-existing keys return 0.0
[nit.git]
/
lib
/
vsm
/
vsm.nit
diff --git
a/lib/vsm/vsm.nit
b/lib/vsm/vsm.nit
index
41d5152
..
8eaeca8
100644
(file)
--- a/
lib/vsm/vsm.nit
+++ b/
lib/vsm/vsm.nit
@@
-72,6
+72,11
@@
class Vector
return cos
end
+ redef fun [](k) do
+ if not has_key(k) then return 0.0
+ return super
+ end
+
# The norm of the vector.
#
# `||x|| = (x1 ** 2 ... + xn ** 2).sqrt`