Code

modified is_positive and is_negative implementation for Vector and Matrix in order...
authormcecchetti <mcecchetti@users.sourceforge.net>
Sun, 6 Jul 2008 15:36:49 +0000 (15:36 +0000)
committermcecchetti <mcecchetti@users.sourceforge.net>
Sun, 6 Jul 2008 15:36:49 +0000 (15:36 +0000)
src/2geom/numeric/matrix.cpp
src/2geom/numeric/matrix.h
src/2geom/numeric/vector.h

index 30b452b37e4f7f406238d01dd510d950af9f1610..bb2a4cefda7ede3bb379a3649683bd182fe8432b 100644 (file)
@@ -33,8 +33,8 @@
  */
 
 
-#include "matrix.h"
-#include "vector.h"
+#include <2geom/numeric/matrix.h>
+#include <2geom/numeric/vector.h>
 
 
 
index 156b6e9a25b24a2b0fae0f98918c332bd894a942..e9b6e6e9e13b53c8f4a9962a38b20559653d97ca 100644 (file)
@@ -89,12 +89,26 @@ class BaseMatrixImpl
 
        bool is_positive() const
        {
-               return gsl_matrix_ispos(m_matrix);
+        for ( unsigned int i = 0; i < rows(); ++i )
+        {
+            for ( unsigned int j = 0; j < columns(); ++j )
+            {
+                if ( (*this)(i,j) <= 0 ) return false;
+            }
+        }
+        return true;
        }
 
        bool is_negative() const
        {
-               return gsl_matrix_isneg(m_matrix);
+        for ( unsigned int i = 0; i < rows(); ++i )
+        {
+            for ( unsigned int j = 0; j < columns(); ++j )
+            {
+                if ( (*this)(i,j) >= 0 ) return false;
+            }
+        }
+        return true;
        }
 
        bool is_non_negative() const
index 3e53405f42d0dfef76180944bf8985aefeaaf7a5..04c1333727b9190df75e4f2093dac3c2f7e54c59 100644 (file)
@@ -73,12 +73,20 @@ class BaseVectorImpl
 
        bool is_positive() const
        {
-               return gsl_vector_ispos(m_vector);
+           for ( size_t i = 0; i < size(); ++i )
+           {
+               if ( (*this)[i] <= 0 ) return false;
+           }
+               return true;
        }
 
        bool is_negative() const
        {
-               return gsl_vector_isneg(m_vector);
+        for ( size_t i = 0; i < size(); ++i )
+        {
+            if ( (*this)[i] >= 0 ) return false;
+        }
+        return true;
        }
 
        bool is_non_negative() const