[ https://issues.apache.org/jira/browse/MAHOUT-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805636#action_12805636 ]
Ted Dunning commented on MAHOUT-269: ------------------------------------ I don't understand your point. If there are any values at all in the dense vector, then it won't return MIN_VALUE. On the other hand, for a sparse vector, there should be a check to return 0 if the dimension of the vector is >0 and there were no non-zero elements. What to return in the case of a 0-dimensional vector is not something I would worry about. > Vector.maxValue() returns Double.MIN_VALUE for vectors with all negative > entries. > --------------------------------------------------------------------------------- > > Key: MAHOUT-269 > URL: https://issues.apache.org/jira/browse/MAHOUT-269 > Project: Mahout > Issue Type: Bug > Components: Math > Affects Versions: 0.1, 0.2 > Reporter: Jake Mannix > Priority: Minor > Fix For: 0.3 > > > {code} > @Override > public double maxValue() { > double result = Double.MIN_VALUE; > for (int i = 0; i < size(); i++) { > result = Math.max(result, getQuick(i)); > } > return result; > } > {code} > Should be: > {code} > @Override > public double maxValue() { > double result = 0; > for (int i = 0; i < size(); i++) { > result = Math.max(result, Math.abs(getQuick(i))); > } > return result; > } > {code} > Right? MaxValue should be returning the max of the absolute value, not the > real max, right? And the maxValue of the zero vector is 0, not MIN_VALUE, > yes? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.