void add_vector ( SparseVector vec ) { for ( Map . Entry < Integer , Double > entry : vec . entrySet ( ) ) { Double v = get ( entry . getKey ( ) ) ; if ( v == null ) v = 0. ; put ( entry . getKey ( ) , v + entry . getValue ( ) ) ; } }
Add other vector .