Loading...
Searching...
No Matches
series_piranha.h
1#ifndef SYMENGINE_SERIES_PIRANHA_H
2#define SYMENGINE_SERIES_PIRANHA_H
3
4#include <symengine/series.h>
6
7#ifdef HAVE_SYMENGINE_PIRANHA
8#include <piranha/monomial.hpp>
9#include <piranha/polynomial.hpp>
10
11namespace SymEngine
12{
13
14using pp_t = piranha::polynomial<piranha::rational, piranha::monomial<short>>;
15// Univariate Rational Coefficient Power SeriesBase using Piranha
16class URatPSeriesPiranha
17 : public SeriesBase<pp_t, piranha::rational, URatPSeriesPiranha>
18{
19public:
20 URatPSeriesPiranha(const pp_t p, const std::string varname,
21 const unsigned degree);
22 IMPLEMENT_TYPEID(SYMENGINE_URATPSERIESPIRANHA)
23 virtual int compare(const Basic &o) const;
24 virtual hash_t __hash__() const;
25 virtual RCP<const Basic> as_basic() const;
26 virtual umap_int_basic as_dict() const;
27 virtual RCP<const Basic> get_coeff(int) const;
28
29 static RCP<const URatPSeriesPiranha>
30 series(const RCP<const Basic> &t, const std::string &x, unsigned int prec);
31 static piranha::integer convert(const Integer &x);
32 static piranha::rational convert(const rational_class &x);
33 static pp_t var(const std::string &s);
34 static piranha::rational convert(const Rational &x);
35 static piranha::rational convert(const Basic &x);
36 static pp_t mul(const pp_t &s, const pp_t &r, unsigned prec);
37 static pp_t pow(const pp_t &s, int n, unsigned prec);
38 static unsigned ldegree(const pp_t &s);
39 static piranha::rational find_cf(const pp_t &s, const pp_t &var,
40 unsigned deg);
41 static piranha::rational root(piranha::rational &c, unsigned n);
42 static pp_t diff(const pp_t &s, const pp_t &var);
43 static pp_t integrate(const pp_t &s, const pp_t &var);
44 static pp_t subs(const pp_t &s, const pp_t &var, const pp_t &r,
45 unsigned prec);
46};
47
48using p_expr = piranha::polynomial<Expression, piranha::monomial<int>>;
49// Univariate Rational Coefficient Power SeriesBase using Piranha
50class UPSeriesPiranha : public SeriesBase<p_expr, Expression, UPSeriesPiranha>
51{
52public:
53 UPSeriesPiranha(const p_expr p, const std::string varname,
54 const unsigned degree);
55 IMPLEMENT_TYPEID(SYMENGINE_UPSERIESPIRANHA)
56 virtual int compare(const Basic &o) const;
57 virtual hash_t __hash__() const;
58 virtual RCP<const Basic> as_basic() const;
59 virtual umap_int_basic as_dict() const;
60 virtual RCP<const Basic> get_coeff(int) const;
61
62 static RCP<const UPSeriesPiranha>
63 series(const RCP<const Basic> &t, const std::string &x, unsigned int prec);
64 static p_expr var(const std::string &s);
65 static Expression convert(const Basic &x);
66 static p_expr mul(const p_expr &s, const p_expr &r, unsigned prec);
67 static p_expr pow(const p_expr &s, int n, unsigned prec);
68 static unsigned ldegree(const p_expr &s);
69 static Expression find_cf(const p_expr &s, const p_expr &var, unsigned deg);
70 static Expression root(Expression &c, unsigned n);
71 static p_expr diff(const p_expr &s, const p_expr &var);
72 static p_expr integrate(const p_expr &s, const p_expr &var);
73 static p_expr subs(const p_expr &s, const p_expr &var, const p_expr &r,
74 unsigned prec);
75
76 static Expression sin(const Expression &c);
77 static Expression cos(const Expression &c);
78 static Expression tan(const Expression &c);
79 static Expression asin(const Expression &c);
80 static Expression acos(const Expression &c);
81 static Expression atan(const Expression &c);
82 static Expression sinh(const Expression &c);
83 static Expression cosh(const Expression &c);
84 static Expression tanh(const Expression &c);
85 static Expression asinh(const Expression &c);
86 static Expression atanh(const Expression &c);
87 static Expression exp(const Expression &c);
88 static Expression log(const Expression &c);
89};
90} // namespace SymEngine
91
92#endif // HAVE_SYMENGINE_PIRANHA
93
94#endif // SYMENGINE_SERIES_PIRANHA_H
T acos(T... args)
T asin(T... args)
T asinh(T... args)
T atan(T... args)
T atanh(T... args)
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:340
T cos(T... args)
T cosh(T... args)
T exp(T... args)
T log(T... args)
Main namespace for SymEngine package.
Definition: add.cpp:19
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
Definition: mul.cpp:352
T pow(T... args)
T sin(T... args)
T sinh(T... args)
T tan(T... args)
T tanh(T... args)