Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Vector.eachNonZero method and implementations (issue #57) #76

Merged
merged 4 commits into from Aug 3, 2013

Conversation

@SamoylovMD
Copy link
Contributor

@SamoylovMD SamoylovMD commented Aug 2, 2013

No description provided.

@@ -235,6 +235,13 @@ public void each(VectorProcedure procedure) {
}

@Override
public void eachNonZero(VectorProcedure procedure) {

This comment has been minimized.

@vkostyukov

vkostyukov Aug 3, 2013
Owner

It is not necessary to check value in compressed vector on zero. It is guaranteed that only non-zero values are store. Which means, that we only need to rename each to eachNonZero in CompressedVector class. Please also make sure that MatrixMarketStream uses the proper iteration method. TIP: It should be eachNonZero.

@@ -428,6 +428,13 @@ public void each(VectorProcedure procedure) {
}

@Override
public void eachNonZero(VectorProcedure procedure) {
for (int i = 0; i < length; i++) {
if (Math.abs(get(i))>Vectors.EPS) procedure.apply(i, get(i));

This comment has been minimized.

@vkostyukov

vkostyukov Aug 3, 2013
Owner

Please, add spaces between get(i) > Vectors.EPS. And having a {} arround procedure is also a good practice.

@@ -276,6 +276,11 @@ public void each(VectorProcedure procedure) {
}

@Override
public void eachNonZero(VectorProcedure procedure) {
self.each(procedure);

This comment has been minimized.

@vkostyukov

vkostyukov Aug 3, 2013
Owner

Should be each.nonZero(procedure).

@vkostyukov
Copy link
Owner

@vkostyukov vkostyukov commented Aug 3, 2013

Looks good! Just one thing's left (see my comments below).

@vkostyukov
Copy link
Owner

@vkostyukov vkostyukov commented Aug 3, 2013

Nice job Maxim @SamoylovMD!

vkostyukov added a commit that referenced this pull request Aug 3, 2013
Added Vector.eachNonZero method and implementations (issue #57)
@vkostyukov vkostyukov merged commit f2294b5 into vkostyukov:master Aug 3, 2013
1 check passed
1 check passed
default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.