diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/2geom/numeric/matrix.cpp | 4 | ||||
| -rw-r--r-- | src/2geom/numeric/matrix.h | 18 | ||||
| -rw-r--r-- | src/2geom/numeric/vector.h | 12 |
3 files changed, 28 insertions, 6 deletions
diff --git a/src/2geom/numeric/matrix.cpp b/src/2geom/numeric/matrix.cpp index 30b452b37..bb2a4cefd 100644 --- a/src/2geom/numeric/matrix.cpp +++ b/src/2geom/numeric/matrix.cpp @@ -33,8 +33,8 @@ */ -#include "matrix.h" -#include "vector.h" +#include <2geom/numeric/matrix.h> +#include <2geom/numeric/vector.h> diff --git a/src/2geom/numeric/matrix.h b/src/2geom/numeric/matrix.h index 156b6e9a2..e9b6e6e9e 100644 --- a/src/2geom/numeric/matrix.h +++ b/src/2geom/numeric/matrix.h @@ -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 diff --git a/src/2geom/numeric/vector.h b/src/2geom/numeric/vector.h index 3e53405f4..04c133372 100644 --- a/src/2geom/numeric/vector.h +++ b/src/2geom/numeric/vector.h @@ -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 |
