Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

Phil Steitz
It does not look to me like any implementation we have of this
interface actually throws raw IAE anywhere.  I think maybe it is the
javadoc that is wrong.

On 12/18/15 4:47 AM, [hidden email] wrote:

> Repository: commons-math
> Updated Branches:
>   refs/heads/master abb205795 -> 5566a21d2
>
>
> Updated FieldMatrix exceptions thrown to match javadoc.
>
> Github: closes #20
>
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
> Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/5566a21d
> Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/5566a21d
> Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/5566a21d
>
> Branch: refs/heads/master
> Commit: 5566a21d2b34090d1ce8129f41b551a1187e7d5b
> Parents: abb2057
> Author: Luc Maisonobe <[hidden email]>
> Authored: Fri Dec 18 12:47:13 2015 +0100
> Committer: Luc Maisonobe <[hidden email]>
> Committed: Fri Dec 18 12:47:13 2015 +0100
>
> ----------------------------------------------------------------------
>  src/main/java/org/apache/commons/math4/linear/FieldMatrix.java | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/commons-math/blob/5566a21d/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
> ----------------------------------------------------------------------
> diff --git a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
> index 0db94b9..4c0ad9f 100644
> --- a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
> +++ b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
> @@ -195,7 +195,7 @@ public interface FieldMatrix<T extends FieldElement<T>> extends AnyMatrix {
>      void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
>                         T[][] destination)
>      throws MatrixDimensionMismatchException, NumberIsTooSmallException,
> -    OutOfRangeException;
> +    OutOfRangeException, IllegalArgumentException;
>  
>    /**
>     * Copy a submatrix. Rows and columns are indicated
>
> .
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

ole ersoy
I think it makes sense.  If the destination array is too small, throw an IAE.  Perhaps the implementations need to be updated.  I'm attempting to modularize the linear package ATM so I'll have a closer look.

Cheers,
- Ole

On 12/18/2015 01:31 PM, Phil Steitz wrote:

> It does not look to me like any implementation we have of this
> interface actually throws raw IAE anywhere.  I think maybe it is the
> javadoc that is wrong.
>
> On 12/18/15 4:47 AM, [hidden email] wrote:
>> Repository: commons-math
>> Updated Branches:
>>    refs/heads/master abb205795 -> 5566a21d2
>>
>>
>> Updated FieldMatrix exceptions thrown to match javadoc.
>>
>> Github: closes #20
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/5566a21d
>> Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/5566a21d
>> Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/5566a21d
>>
>> Branch: refs/heads/master
>> Commit: 5566a21d2b34090d1ce8129f41b551a1187e7d5b
>> Parents: abb2057
>> Author: Luc Maisonobe <[hidden email]>
>> Authored: Fri Dec 18 12:47:13 2015 +0100
>> Committer: Luc Maisonobe <[hidden email]>
>> Committed: Fri Dec 18 12:47:13 2015 +0100
>>
>> ----------------------------------------------------------------------
>>   src/main/java/org/apache/commons/math4/linear/FieldMatrix.java | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/5566a21d/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>> ----------------------------------------------------------------------
>> diff --git a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>> index 0db94b9..4c0ad9f 100644
>> --- a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>> +++ b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>> @@ -195,7 +195,7 @@ public interface FieldMatrix<T extends FieldElement<T>> extends AnyMatrix {
>>       void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
>>                          T[][] destination)
>>       throws MatrixDimensionMismatchException, NumberIsTooSmallException,
>> -    OutOfRangeException;
>> +    OutOfRangeException, IllegalArgumentException;
>>  
>>     /**
>>      * Copy a submatrix. Rows and columns are indicated
>>
>> .
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

Phil Steitz
On 12/18/15 2:59 PM, Ole Ersoy wrote:
> I think it makes sense.  If the destination array is too small,
> throw an IAE.

Right.  That is what the implementations do - it is just a
specialized IAE.  We decided a while back not to throw "raw" IAE but
to use things like MatrixDimensionMismatchException which is what
AbstractFieldMatrix does for the case described in the javadoc.

Phil

> Perhaps the implementations need to be updated.  I'm attempting to
> modularize the linear package ATM so I'll have a closer look.
>
> Cheers,
> - Ole
>
> On 12/18/2015 01:31 PM, Phil Steitz wrote:
>> It does not look to me like any implementation we have of this
>> interface actually throws raw IAE anywhere.  I think maybe it is the
>> javadoc that is wrong.
>>
>> On 12/18/15 4:47 AM, [hidden email] wrote:
>>> Repository: commons-math
>>> Updated Branches:
>>>    refs/heads/master abb205795 -> 5566a21d2
>>>
>>>
>>> Updated FieldMatrix exceptions thrown to match javadoc.
>>>
>>> Github: closes #20
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
>>> Commit:
>>> http://git-wip-us.apache.org/repos/asf/commons-math/commit/5566a21d
>>> Tree:
>>> http://git-wip-us.apache.org/repos/asf/commons-math/tree/5566a21d
>>> Diff:
>>> http://git-wip-us.apache.org/repos/asf/commons-math/diff/5566a21d
>>>
>>> Branch: refs/heads/master
>>> Commit: 5566a21d2b34090d1ce8129f41b551a1187e7d5b
>>> Parents: abb2057
>>> Author: Luc Maisonobe <[hidden email]>
>>> Authored: Fri Dec 18 12:47:13 2015 +0100
>>> Committer: Luc Maisonobe <[hidden email]>
>>> Committed: Fri Dec 18 12:47:13 2015 +0100
>>>
>>> ----------------------------------------------------------------------
>>>
>>>   src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>> | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/5566a21d/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>
>>> ----------------------------------------------------------------------
>>>
>>> diff --git
>>> a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>> b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>> index 0db94b9..4c0ad9f 100644
>>> ---
>>> a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>> +++
>>> b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>> @@ -195,7 +195,7 @@ public interface FieldMatrix<T extends
>>> FieldElement<T>> extends AnyMatrix {
>>>       void copySubMatrix(int startRow, int endRow, int
>>> startColumn, int endColumn,
>>>                          T[][] destination)
>>>       throws MatrixDimensionMismatchException,
>>> NumberIsTooSmallException,
>>> -    OutOfRangeException;
>>> +    OutOfRangeException, IllegalArgumentException;
>>>       /**
>>>      * Copy a submatrix. Rows and columns are indicated
>>>
>>> .
>>>
>>
>> ---------------------------------------------------------------------
>>
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

ole ersoy


On 12/18/2015 04:07 PM, Phil Steitz wrote:
> On 12/18/15 2:59 PM, Ole Ersoy wrote:
>> I think it makes sense.  If the destination array is too small,
>> throw an IAE.
> Right.  That is what the implementations do - it is just a
> specialized IAE.  We decided a while back not to throw "raw" IAE but
> to use things like MatrixDimensionMismatchException which is what
> AbstractFieldMatrix does for the case described in the javadoc.
Got it - thanks for the heads up.  So in this case should:

@throws MatrixDimensionMismatchException if the dimensions of
{@code destination} do not match those of {@code this}.

Be replaced with:
@throws MatrixDimensionMismatchException if the destination array is to small.

Which should replace the IAE?

Ole


>
> Phil
>> Perhaps the implementations need to be updated.  I'm attempting to
>> modularize the linear package ATM so I'll have a closer look.
>>
>> Cheers,
>> - Ole
>>
>> On 12/18/2015 01:31 PM, Phil Steitz wrote:
>>> It does not look to me like any implementation we have of this
>>> interface actually throws raw IAE anywhere.  I think maybe it is the
>>> javadoc that is wrong.
>>>
>>> On 12/18/15 4:47 AM, [hidden email] wrote:
>>>> Repository: commons-math
>>>> Updated Branches:
>>>>     refs/heads/master abb205795 -> 5566a21d2
>>>>
>>>>
>>>> Updated FieldMatrix exceptions thrown to match javadoc.
>>>>
>>>> Github: closes #20
>>>>
>>>>
>>>> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
>>>> Commit:
>>>> http://git-wip-us.apache.org/repos/asf/commons-math/commit/5566a21d
>>>> Tree:
>>>> http://git-wip-us.apache.org/repos/asf/commons-math/tree/5566a21d
>>>> Diff:
>>>> http://git-wip-us.apache.org/repos/asf/commons-math/diff/5566a21d
>>>>
>>>> Branch: refs/heads/master
>>>> Commit: 5566a21d2b34090d1ce8129f41b551a1187e7d5b
>>>> Parents: abb2057
>>>> Author: Luc Maisonobe <[hidden email]>
>>>> Authored: Fri Dec 18 12:47:13 2015 +0100
>>>> Committer: Luc Maisonobe <[hidden email]>
>>>> Committed: Fri Dec 18 12:47:13 2015 +0100
>>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>>    src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>> | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>> ----------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/5566a21d/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>> diff --git
>>>> a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>> b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>> index 0db94b9..4c0ad9f 100644
>>>> ---
>>>> a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>> +++
>>>> b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>> @@ -195,7 +195,7 @@ public interface FieldMatrix<T extends
>>>> FieldElement<T>> extends AnyMatrix {
>>>>        void copySubMatrix(int startRow, int endRow, int
>>>> startColumn, int endColumn,
>>>>                           T[][] destination)
>>>>        throws MatrixDimensionMismatchException,
>>>> NumberIsTooSmallException,
>>>> -    OutOfRangeException;
>>>> +    OutOfRangeException, IllegalArgumentException;
>>>>        /**
>>>>       * Copy a submatrix. Rows and columns are indicated
>>>>
>>>> .
>>>>
>>> ---------------------------------------------------------------------
>>>
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

Phil Steitz
On 12/18/15 4:20 PM, Ole Ersoy wrote:

>
>
> On 12/18/2015 04:07 PM, Phil Steitz wrote:
>> On 12/18/15 2:59 PM, Ole Ersoy wrote:
>>> I think it makes sense.  If the destination array is too small,
>>> throw an IAE.
>> Right.  That is what the implementations do - it is just a
>> specialized IAE.  We decided a while back not to throw "raw" IAE but
>> to use things like MatrixDimensionMismatchException which is what
>> AbstractFieldMatrix does for the case described in the javadoc.
> Got it - thanks for the heads up.  So in this case should:
>
> @throws MatrixDimensionMismatchException if the dimensions of
> {@code destination} do not match those of {@code this}.
>
> Be replaced with:
> @throws MatrixDimensionMismatchException if the destination array
> is to small.
>
> Which should replace the IAE?

Should look like this, with some typos fixed:

/**
    ...
    * @throws MatrixDimensionMismatchException if the dimensions of
    * {@code destination} do not match those of {@code this}.
    * @throws NumberIsTooSmallException if {@code endRow < startRow} or
    * {@code endColumn < startColumn}.
    * @throws OutOfRangeException if the indices are not valid.
    */
    void copySubMatrix(int startRow, int endRow, int startColumn,
int endColumn,
                       T[][] destination)
    throws MatrixDimensionMismatchException, NumberIsTooSmallException,
    OutOfRangeException;

I will fix this.

Phil

>
> Ole
>
>
>>
>> Phil
>>> Perhaps the implementations need to be updated.  I'm attempting to
>>> modularize the linear package ATM so I'll have a closer look.
>>>
>>> Cheers,
>>> - Ole
>>>
>>> On 12/18/2015 01:31 PM, Phil Steitz wrote:
>>>> It does not look to me like any implementation we have of this
>>>> interface actually throws raw IAE anywhere.  I think maybe it
>>>> is the
>>>> javadoc that is wrong.
>>>>
>>>> On 12/18/15 4:47 AM, [hidden email] wrote:
>>>>> Repository: commons-math
>>>>> Updated Branches:
>>>>>     refs/heads/master abb205795 -> 5566a21d2
>>>>>
>>>>>
>>>>> Updated FieldMatrix exceptions thrown to match javadoc.
>>>>>
>>>>> Github: closes #20
>>>>>
>>>>>
>>>>> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
>>>>> Commit:
>>>>> http://git-wip-us.apache.org/repos/asf/commons-math/commit/5566a21d
>>>>>
>>>>> Tree:
>>>>> http://git-wip-us.apache.org/repos/asf/commons-math/tree/5566a21d
>>>>> Diff:
>>>>> http://git-wip-us.apache.org/repos/asf/commons-math/diff/5566a21d
>>>>>
>>>>> Branch: refs/heads/master
>>>>> Commit: 5566a21d2b34090d1ce8129f41b551a1187e7d5b
>>>>> Parents: abb2057
>>>>> Author: Luc Maisonobe <[hidden email]>
>>>>> Authored: Fri Dec 18 12:47:13 2015 +0100
>>>>> Committer: Luc Maisonobe <[hidden email]>
>>>>> Committed: Fri Dec 18 12:47:13 2015 +0100
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>>
>>>>>
>>>>>    src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>> | 2 +-
>>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>> ----------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/5566a21d/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>>
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>>
>>>>>
>>>>> diff --git
>>>>> a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>> b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>> index 0db94b9..4c0ad9f 100644
>>>>> ---
>>>>> a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>> +++
>>>>> b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
>>>>> @@ -195,7 +195,7 @@ public interface FieldMatrix<T extends
>>>>> FieldElement<T>> extends AnyMatrix {
>>>>>        void copySubMatrix(int startRow, int endRow, int
>>>>> startColumn, int endColumn,
>>>>>                           T[][] destination)
>>>>>        throws MatrixDimensionMismatchException,
>>>>> NumberIsTooSmallException,
>>>>> -    OutOfRangeException;
>>>>> +    OutOfRangeException, IllegalArgumentException;
>>>>>        /**
>>>>>       * Copy a submatrix. Rows and columns are indicated
>>>>>
>>>>> .
>>>>>
>>>> ---------------------------------------------------------------------
>>>>
>>>>
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>>
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>>
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

ole ersoy
> Should look like this, with some typos fixed:
>
> /**
>      ...
>      * @throws MatrixDimensionMismatchException if the dimensions of
>      * {@code destination} do not match those of {@code this}.
>      * @throws NumberIsTooSmallException if {@code endRow < startRow} or
>      * {@code endColumn < startColumn}.
>      * @throws OutOfRangeException if the indices are not valid.
>      */
>      void copySubMatrix(int startRow, int endRow, int startColumn,
> int endColumn,
>                         T[][] destination)
>      throws MatrixDimensionMismatchException, NumberIsTooSmallException,
>      OutOfRangeException;
>
> I will fix this.
I think it's easier to understand if the "too small" wording is included.  Something like:

@throws MatrixDimensionMismatchException if the {@code destination} matrix
  dimensions are too small.


Cheers,
Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

Phil Steitz
On 12/21/15 12:26 PM, Ole Ersoy wrote:

>> Should look like this, with some typos fixed:
>>
>> /**
>>      ...
>>      * @throws MatrixDimensionMismatchException if the dimensions of
>>      * {@code destination} do not match those of {@code this}.
>>      * @throws NumberIsTooSmallException if {@code endRow <
>> startRow} or
>>      * {@code endColumn < startColumn}.
>>      * @throws OutOfRangeException if the indices are not valid.
>>      */
>>      void copySubMatrix(int startRow, int endRow, int startColumn,
>> int endColumn,
>>                         T[][] destination)
>>      throws MatrixDimensionMismatchException,
>> NumberIsTooSmallException,
>>      OutOfRangeException;
>>
>> I will fix this.
> I think it's easier to understand if the "too small" wording is
> included.  Something like:
>
> @throws MatrixDimensionMismatchException if the {@code
> destination} matrix
>  dimensions are too small.

No, the MatrixDimensionMismatchException is thrown whenever the
dimensions don't match exactly, as it says above.

Phil

>
>
> Cheers,
> Ole
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

ole ersoy


On 12/21/2015 01:45 PM, Phil Steitz wrote:

> On 12/21/15 12:26 PM, Ole Ersoy wrote:
>>> Should look like this, with some typos fixed:
>>>
>>> /**
>>>       ...
>>>       * @throws MatrixDimensionMismatchException if the dimensions of
>>>       * {@code destination} do not match those of {@code this}.
>>>       * @throws NumberIsTooSmallException if {@code endRow <
>>> startRow} or
>>>       * {@code endColumn < startColumn}.
>>>       * @throws OutOfRangeException if the indices are not valid.
>>>       */
>>>       void copySubMatrix(int startRow, int endRow, int startColumn,
>>> int endColumn,
>>>                          T[][] destination)
>>>       throws MatrixDimensionMismatchException,
>>> NumberIsTooSmallException,
>>>       OutOfRangeException;
>>>
>>> I will fix this.
>> I think it's easier to understand if the "too small" wording is
>> included.  Something like:
>>
>> @throws MatrixDimensionMismatchException if the {@code
>> destination} matrix
>>   dimensions are too small.
> No, the MatrixDimensionMismatchException is thrown whenever the
> dimensions don't match exactly, as it says above.
Maybe I'm missing something, but if that's the case then it seems like it would be better to just create and return the sub matrix internally and avoid the exception all together?

The way I understand the method is that we have a matrix and we want the left hand corner of the matrix to be replaced with the submatrix being copied into it?

Cheers,
Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] Updated FieldMatrix exceptions thrown to match javadoc.

Phil Steitz
On 12/21/15 1:21 PM, Ole Ersoy wrote:

>
>
> On 12/21/2015 01:45 PM, Phil Steitz wrote:
>> On 12/21/15 12:26 PM, Ole Ersoy wrote:
>>>> Should look like this, with some typos fixed:
>>>>
>>>> /**
>>>>       ...
>>>>       * @throws MatrixDimensionMismatchException if the
>>>> dimensions of
>>>>       * {@code destination} do not match those of {@code this}.
>>>>       * @throws NumberIsTooSmallException if {@code endRow <
>>>> startRow} or
>>>>       * {@code endColumn < startColumn}.
>>>>       * @throws OutOfRangeException if the indices are not valid.
>>>>       */
>>>>       void copySubMatrix(int startRow, int endRow, int
>>>> startColumn,
>>>> int endColumn,
>>>>                          T[][] destination)
>>>>       throws MatrixDimensionMismatchException,
>>>> NumberIsTooSmallException,
>>>>       OutOfRangeException;
>>>>
>>>> I will fix this.
>>> I think it's easier to understand if the "too small" wording is
>>> included.  Something like:
>>>
>>> @throws MatrixDimensionMismatchException if the {@code
>>> destination} matrix
>>>   dimensions are too small.
>> No, the MatrixDimensionMismatchException is thrown whenever the
>> dimensions don't match exactly, as it says above.
> Maybe I'm missing something, but if that's the case then it seems
> like it would be better to just create and return the sub matrix
> internally and avoid the exception all together?

Sorry, I misread the code.  You are correct.  The @throws
MatrixDimensionMismatchException is wrong.  AbstractFieldMatrix does
not check exact size - just throws if the destination does not have
enough rows or columns.
>
> The way I understand the method is that we have a matrix and we
> want the left hand corner of the matrix to be replaced with the
> submatrix being copied into it?

That is what AbstractFieldMatrix does.  Thanks for pointing this out.

Phil

>
> Cheers,
> Ole
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]