diff options
| author | mcecchetti <mcecchetti@users.sourceforge.net> | 2008-07-06 15:36:49 +0000 |
|---|---|---|
| committer | mcecchetti <mcecchetti@users.sourceforge.net> | 2008-07-06 15:36:49 +0000 |
| commit | 6a0c5250c76404facef504f9e148ce99e05610d5 (patch) | |
| tree | 28aa9f309d509853fae58b61884c5c0cc2cc85fd /src | |
| parent | agree with the FIXME (diff) | |
| download | inkscape-6a0c5250c76404facef504f9e148ce99e05610d5.tar.gz inkscape-6a0c5250c76404facef504f9e148ce99e05610d5.zip | |
modified is_positive and is_negative implementation for Vector and Matrix in order to make 2geom linkable with a gsl release >= 1.8
(bzr r6197)
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 |
