commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <j...@apache.org>
Subject [jira] Updated: (MATH-232) Would like to have RealMatrix.getFrobeniusNorm()
Date Fri, 05 Dec 2008 00:12:47 GMT

     [ https://issues.apache.org/jira/browse/MATH-232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Luc Maisonobe updated MATH-232:
-------------------------------

    Affects Version/s: 2.0
        Fix Version/s: 2.0
             Assignee: Luc Maisonobe

> Would like to have RealMatrix.getFrobeniusNorm()
> ------------------------------------------------
>
>                 Key: MATH-232
>                 URL: https://issues.apache.org/jira/browse/MATH-232
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 2.0
>         Environment: Any
>            Reporter: Sujit Pal
>            Assignee: Luc Maisonobe
>             Fix For: 2.0
>
>
> I have been converting over some of my code that used Jama to use commons-math. One thing
I would like to have is Matrix.normF() which returns the Frobenius norm (ie the square root
of the sum of squares of all the elements).
> I have gotten around this by implementing this as a utility method, like so:
>   /**
>    * Return the square root of the sum of squares of all elements in
>    * the matrix. In Jama, it is Matrix.normF().
>    * @param matrix a RealMatrix.
>    * @return the Frobenius norm.
>    */
>   public static double getFrobeniusNorm(RealMatrix matrix) {
>     double frobeniusNorm = 0.0D;
>     for (int row = 0; row < matrix.getRowDimension(); row++) {
>       for (int col = 0; col < matrix.getColumnDimension(); col++) {
>          frobeniusNorm += Math.pow(matrix.getEntry(row, col), 2);
>       }
>     }
>     return Math.sqrt(frobeniusNorm);
>   }
> It would be nice if RealMatrix mandated a method getFrobeniusNorm() like getNorm(), that
way this method is available from within a RealMatrix.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message