Skip to content

Commit 42887ce

Browse files
committed
remove some IF statements
1 parent a73e5c3 commit 42887ce

File tree

1 file changed

+62
-72
lines changed

1 file changed

+62
-72
lines changed

symengine/lib/symengine.pxd

Lines changed: 62 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -655,68 +655,62 @@ cdef extern from "<symengine/functions.h>" namespace "SymEngine":
655655
cdef cppclass Log(Function):
656656
pass
657657

658-
IF HAVE_SYMENGINE_MPFR:
659-
cdef extern from "mpfr.h":
660-
ctypedef struct __mpfr_struct:
661-
pass
662-
ctypedef __mpfr_struct mpfr_t[1]
663-
ctypedef __mpfr_struct* mpfr_ptr
664-
ctypedef const __mpfr_struct* mpfr_srcptr
665-
ctypedef long mpfr_prec_t
666-
ctypedef enum mpfr_rnd_t:
667-
MPFR_RNDN
668-
MPFR_RNDZ
669-
MPFR_RNDU
670-
MPFR_RNDD
671-
MPFR_RNDA
672-
MPFR_RNDF
673-
MPFR_RNDNA
674-
675-
cdef extern from "<symengine/real_mpfr.h>" namespace "SymEngine":
676-
cdef cppclass mpfr_class:
677-
mpfr_class() nogil
678-
mpfr_class(mpfr_prec_t prec) nogil
679-
mpfr_class(string s, mpfr_prec_t prec, unsigned base) nogil
680-
mpfr_class(mpfr_t m) nogil
681-
mpfr_ptr get_mpfr_t() nogil
682-
683-
cdef cppclass RealMPFR(Number):
684-
RealMPFR(mpfr_class) nogil
685-
mpfr_class as_mpfr() nogil
686-
mpfr_prec_t get_prec() nogil
687-
688-
RCP[const RealMPFR] real_mpfr(mpfr_class t) nogil
689-
ELSE:
690-
cdef extern from "<symengine/real_mpfr.h>" namespace "SymEngine":
691-
cdef cppclass RealMPFR(Number):
692-
pass
693-
694-
IF HAVE_SYMENGINE_MPC:
695-
cdef extern from "mpc.h":
696-
ctypedef struct __mpc_struct:
697-
pass
698-
ctypedef __mpc_struct mpc_t[1]
699-
ctypedef __mpc_struct* mpc_ptr
700-
ctypedef const __mpc_struct* mpc_srcptr
701-
702-
cdef extern from "<symengine/complex_mpc.h>" namespace "SymEngine":
703-
cdef cppclass mpc_class:
704-
mpc_class() nogil
705-
mpc_class(mpfr_prec_t prec) nogil
706-
mpc_class(mpc_t m) nogil
707-
mpc_ptr get_mpc_t() nogil
708-
mpc_class(string s, mpfr_prec_t prec, unsigned base) nogil
709-
710-
cdef cppclass ComplexMPC(ComplexBase):
711-
ComplexMPC(mpc_class) nogil
712-
mpc_class as_mpc() nogil
713-
mpfr_prec_t get_prec() nogil
714-
715-
RCP[const ComplexMPC] complex_mpc(mpc_class t) nogil
716-
ELSE:
717-
cdef extern from "<symengine/complex_mpc.h>" namespace "SymEngine":
718-
cdef cppclass ComplexMPC(Number):
719-
pass
658+
cdef extern from "<symengine/real_mpfr.h>":
659+
# These come from mpfr.h, but don't include mpfr.h to not break
660+
# builds without mpfr
661+
ctypedef struct __mpfr_struct:
662+
pass
663+
ctypedef __mpfr_struct mpfr_t[1]
664+
ctypedef __mpfr_struct* mpfr_ptr
665+
ctypedef const __mpfr_struct* mpfr_srcptr
666+
ctypedef long mpfr_prec_t
667+
ctypedef enum mpfr_rnd_t:
668+
MPFR_RNDN
669+
MPFR_RNDZ
670+
MPFR_RNDU
671+
MPFR_RNDD
672+
MPFR_RNDA
673+
MPFR_RNDF
674+
MPFR_RNDNA
675+
676+
cdef extern from "<symengine/real_mpfr.h>" namespace "SymEngine":
677+
cdef cppclass mpfr_class:
678+
mpfr_class() nogil
679+
mpfr_class(mpfr_prec_t prec) nogil
680+
mpfr_class(string s, mpfr_prec_t prec, unsigned base) nogil
681+
mpfr_class(mpfr_t m) nogil
682+
mpfr_ptr get_mpfr_t() nogil
683+
684+
cdef cppclass RealMPFR(Number):
685+
RealMPFR(mpfr_class) nogil
686+
mpfr_class as_mpfr() nogil
687+
mpfr_prec_t get_prec() nogil
688+
689+
RCP[const RealMPFR] real_mpfr(mpfr_class t) nogil
690+
691+
cdef extern from "<symengine/complex_mpc.h>":
692+
# These come from mpc.h, but don't include mpc.h to not break
693+
# builds without mpc
694+
ctypedef struct __mpc_struct:
695+
pass
696+
ctypedef __mpc_struct mpc_t[1]
697+
ctypedef __mpc_struct* mpc_ptr
698+
ctypedef const __mpc_struct* mpc_srcptr
699+
700+
cdef extern from "<symengine/complex_mpc.h>" namespace "SymEngine":
701+
cdef cppclass mpc_class:
702+
mpc_class() nogil
703+
mpc_class(mpfr_prec_t prec) nogil
704+
mpc_class(mpc_t m) nogil
705+
mpc_ptr get_mpc_t() nogil
706+
mpc_class(string s, mpfr_prec_t prec, unsigned base) nogil
707+
708+
cdef cppclass ComplexMPC(ComplexBase):
709+
ComplexMPC(mpc_class) nogil
710+
mpc_class as_mpc() nogil
711+
mpfr_prec_t get_prec() nogil
712+
713+
RCP[const ComplexMPC] complex_mpc(mpc_class t) nogil
720714

721715
cdef extern from "<symengine/matrix.h>" namespace "SymEngine":
722716
cdef cppclass MatrixBase:
@@ -923,10 +917,8 @@ cdef extern from "<symengine/logic.h>" namespace "SymEngine":
923917

924918
cdef extern from "<utility>" namespace "std":
925919
cdef integer_class std_move_mpz "std::move" (integer_class) nogil
926-
IF HAVE_SYMENGINE_MPFR:
927-
cdef mpfr_class std_move_mpfr "std::move" (mpfr_class) nogil
928-
IF HAVE_SYMENGINE_MPC:
929-
cdef mpc_class std_move_mpc "std::move" (mpc_class) nogil
920+
cdef mpfr_class std_move_mpfr "std::move" (mpfr_class) nogil
921+
cdef mpc_class std_move_mpc "std::move" (mpc_class) nogil
930922
cdef map_basic_basic std_move_map_basic_basic "std::move" (map_basic_basic) nogil
931923
cdef PiecewiseVec std_move_PiecewiseVec "std::move" (PiecewiseVec) nogil
932924

@@ -977,13 +969,11 @@ cdef extern from "<symengine/series.h>" namespace "SymEngine":
977969
ctypedef RCP[const SeriesCoeffInterface] rcp_const_seriescoeffinterface "SymEngine::RCP<const SymEngine::SeriesCoeffInterface>"
978970
rcp_const_seriescoeffinterface series "SymEngine::series"(rcp_const_basic &ex, RCP[const Symbol] &var, unsigned int prec) except+ nogil
979971

980-
IF HAVE_SYMENGINE_MPFR:
981-
cdef extern from "<symengine/eval_mpfr.h>" namespace "SymEngine":
982-
void eval_mpfr(mpfr_t result, const Basic &b, mpfr_rnd_t rnd) except+ nogil
972+
cdef extern from "<symengine/eval_mpfr.h>" namespace "SymEngine":
973+
void eval_mpfr(mpfr_t result, const Basic &b, mpfr_rnd_t rnd) except+ nogil
983974

984-
IF HAVE_SYMENGINE_MPC:
985-
cdef extern from "<symengine/eval_mpc.h>" namespace "SymEngine":
986-
void eval_mpc(mpc_t result, const Basic &b, mpfr_rnd_t rnd) except+ nogil
975+
cdef extern from "<symengine/eval_mpc.h>" namespace "SymEngine":
976+
void eval_mpc(mpc_t result, const Basic &b, mpfr_rnd_t rnd) except+ nogil
987977

988978
cdef extern from "<symengine/parser.h>" namespace "SymEngine":
989979
rcp_const_basic parse(const string &n) except+ nogil

0 commit comments

Comments
 (0)