From: mcecchetti Date: Sun, 6 Jul 2008 15:36:49 +0000 (+0000) Subject: modified is_positive and is_negative implementation for Vector and Matrix in order... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=40f90655923d3f6ab288055fdb6641b45066e8c9;p=inkscape.git modified is_positive and is_negative implementation for Vector and Matrix in order to make 2geom linkable with a gsl release >= 1.8 --- 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