You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gilles <gi...@harfang.homelinux.org> on 2013/10/27 14:34:34 UTC

Re: svn commit: r1536073 - in /commons/proper/math/trunk/src: changes/changes.xml main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java

On Sun, 27 Oct 2013 09:52:44 -0000, luc@apache.org wrote:
> Author: luc
> Date: Sun Oct 27 09:52:44 2013
> New Revision: 1536073
>
> URL: http://svn.apache.org/r1536073
> Log:
> Added SparseGradient to deal efficiently with numerous variables.
>
> [...]
> +
> +    /**
> +     * Multiply in place.
> +     * <p>
> +     * This method is designed to be faster when used multiple times
> in a loop.
> +     * </p>
> +     * <p>
> +     * The instance is changed here, in order to not change the
> +     * instance the {@link #add(SparseGradient)} method should
> +     * be used.
> +     * </p>
> +     * @param a instance to multiply
> +     */
> +    public void multInPlace(final SparseGradient a) {
                    ^^^^^^^^^^^

Shouldn't the name composed of full words (i.e be "multiplyInPlace")?

> [...]
> +
> +    /**
> +     * Get a hashCode for the derivative structure.
> +     * @return a hash code value for this object
> +     * @since 3.2
> +     */
> +    @Override
> +    public int hashCode() {
> +        return 743 + 809 *  + 233 * MathUtils.hash(value) + 167 *
                           ^^^^^^
Typo?

> derivatives.hashCode();
> +    }
> +
> +}
>

Regards,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1536073 - in /commons/proper/math/trunk/src: changes/changes.xml main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java

Posted by Sean Owen <sr...@gmail.com>.
On Sun, Oct 27, 2013 at 10:41 AM, Luc Maisonobe <lu...@spaceroots.org> wrote:
>>> +        return 743 + 809 *  + 233 * MathUtils.hash(value) + 167 *
>>                           ^^^^^^
>> Typo?
>
> Yes. I don't even understand why this code does not raise a compilation
> error ...
>
> Thanks for spotting this. Everything is fixed in the subversion
> repository now.

The "+" becomes a unary plus operator. It's read as "809 * (+233) *
MathUtils.hash..."

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1536073 - in /commons/proper/math/trunk/src: changes/changes.xml main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java

Posted by Luc Maisonobe <lu...@spaceroots.org>.
Le 27/10/2013 14:34, Gilles a écrit :
> On Sun, 27 Oct 2013 09:52:44 -0000, luc@apache.org wrote:
>> Author: luc
>> Date: Sun Oct 27 09:52:44 2013
>> New Revision: 1536073
>>
>> URL: http://svn.apache.org/r1536073
>> Log:
>> Added SparseGradient to deal efficiently with numerous variables.
>>
>> [...]
>> +
>> +    /**
>> +     * Multiply in place.
>> +     * <p>
>> +     * This method is designed to be faster when used multiple times
>> in a loop.
>> +     * </p>
>> +     * <p>
>> +     * The instance is changed here, in order to not change the
>> +     * instance the {@link #add(SparseGradient)} method should
>> +     * be used.
>> +     * </p>
>> +     * @param a instance to multiply
>> +     */
>> +    public void multInPlace(final SparseGradient a) {
>                    ^^^^^^^^^^^
> 
> Shouldn't the name composed of full words (i.e be "multiplyInPlace")?

The original name was the one from the patch, but full words are better.

I have fixed this.

> 
>> [...]
>> +
>> +    /**
>> +     * Get a hashCode for the derivative structure.
>> +     * @return a hash code value for this object
>> +     * @since 3.2
>> +     */
>> +    @Override
>> +    public int hashCode() {
>> +        return 743 + 809 *  + 233 * MathUtils.hash(value) + 167 *
>                           ^^^^^^
> Typo?

Yes. I don't even understand why this code does not raise a compilation
error ...

Thanks for spotting this. Everything is fixed in the subversion
repository now.

best regards,
Luc

> 
>> derivatives.hashCode();
>> +    }
>> +
>> +}
>>
> 
> Regards,
> Gilles
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org