Loading...
Searching...
No Matches
SymEngine::LatexPrinter Class Reference
+ Inheritance diagram for SymEngine::LatexPrinter:
+ Collaboration diagram for SymEngine::LatexPrinter:

Public Member Functions

void bvisit (const Symbol &x)
 
void bvisit (const Rational &x)
 
void bvisit (const Complex &x)
 
void bvisit (const ComplexBase &x)
 
void bvisit (const ComplexDouble &x)
 
void bvisit (const Interval &x)
 
void bvisit (const Piecewise &x)
 
void bvisit (const EmptySet &x)
 
void bvisit (const Complexes &x)
 
void bvisit (const Reals &x)
 
void bvisit (const Rationals &x)
 
void bvisit (const Integers &x)
 
void bvisit (const Naturals &x)
 
void bvisit (const Naturals0 &x)
 
void bvisit (const FiniteSet &x)
 
void bvisit (const ConditionSet &x)
 
void bvisit (const Contains &x)
 
void bvisit (const BooleanAtom &x)
 
void bvisit (const And &x)
 
void bvisit (const Or &x)
 
void bvisit (const Xor &x)
 
void bvisit (const Not &x)
 
void bvisit (const Union &x)
 
void bvisit (const Intersection &x)
 
void bvisit (const Complement &x)
 
void bvisit (const ImageSet &x)
 
void bvisit (const Infty &x)
 
void bvisit (const NaN &x)
 
void bvisit (const Constant &x)
 
void bvisit (const Function &x)
 
void bvisit (const Abs &x)
 
void bvisit (const Floor &x)
 
void bvisit (const Ceiling &x)
 
void bvisit (const Derivative &x)
 
void bvisit (const Subs &x)
 
void bvisit (const Equality &x)
 
void bvisit (const Unequality &x)
 
void bvisit (const LessThan &x)
 
void bvisit (const StrictLessThan &x)
 
void bvisit (const Tuple &x)
 
void bvisit (const Basic &x)
 
void bvisit (const Symbol &x)
 
void bvisit (const Integer &x)
 
void bvisit (const Rational &x)
 
void bvisit (const Complex &x)
 
void bvisit (const Interval &x)
 
void bvisit (const Complexes &x)
 
void bvisit (const Reals &x)
 
void bvisit (const Rationals &x)
 
void bvisit (const Integers &x)
 
void bvisit (const Naturals &x)
 
void bvisit (const Naturals0 &x)
 
void bvisit (const Piecewise &x)
 
void bvisit (const EmptySet &x)
 
void bvisit (const FiniteSet &x)
 
void bvisit (const UniversalSet &x)
 
void bvisit (const ConditionSet &x)
 
void bvisit (const Contains &x)
 
void bvisit (const BooleanAtom &x)
 
void bvisit (const And &x)
 
void bvisit (const Or &x)
 
void bvisit (const Xor &x)
 
void bvisit (const Not &x)
 
void bvisit (const Union &x)
 
void bvisit (const Intersection &x)
 
void bvisit (const Complement &x)
 
void bvisit (const ImageSet &x)
 
void bvisit (const Add &x)
 
void bvisit (const Mul &x)
 
void bvisit (const Pow &x)
 
void bvisit (const UIntPoly &x)
 
void bvisit (const MIntPoly &x)
 
void bvisit (const URatPoly &x)
 
void bvisit (const UExprPoly &x)
 
void bvisit (const MExprPoly &x)
 
void bvisit (const GaloisField &x)
 
void bvisit (const Infty &x)
 
void bvisit (const NaN &x)
 
void bvisit (const UnivariateSeries &x)
 
void bvisit (const Constant &x)
 
void bvisit (const Function &x)
 
void bvisit (const FunctionSymbol &x)
 
void bvisit (const Derivative &x)
 
void bvisit (const Subs &x)
 
void bvisit (const RealDouble &x)
 
void bvisit (const ComplexDouble &x)
 
void bvisit (const Equality &x)
 
void bvisit (const Unequality &x)
 
void bvisit (const LessThan &x)
 
void bvisit (const StrictLessThan &x)
 
void bvisit (const NumberWrapper &x)
 
void bvisit (const Tuple &x)
 
void bvisit (const IdentityMatrix &x)
 
void bvisit (const ZeroMatrix &x)
 
- Public Member Functions inherited from SymEngine::StrPrinter
void bvisit (const Basic &x)
 
void bvisit (const Symbol &x)
 
void bvisit (const Integer &x)
 
void bvisit (const Rational &x)
 
void bvisit (const Complex &x)
 
void bvisit (const Interval &x)
 
void bvisit (const Complexes &x)
 
void bvisit (const Reals &x)
 
void bvisit (const Rationals &x)
 
void bvisit (const Integers &x)
 
void bvisit (const Naturals &x)
 
void bvisit (const Naturals0 &x)
 
void bvisit (const Piecewise &x)
 
void bvisit (const EmptySet &x)
 
void bvisit (const FiniteSet &x)
 
void bvisit (const UniversalSet &x)
 
void bvisit (const ConditionSet &x)
 
void bvisit (const Contains &x)
 
void bvisit (const BooleanAtom &x)
 
void bvisit (const And &x)
 
void bvisit (const Or &x)
 
void bvisit (const Xor &x)
 
void bvisit (const Not &x)
 
void bvisit (const Union &x)
 
void bvisit (const Intersection &x)
 
void bvisit (const Complement &x)
 
void bvisit (const ImageSet &x)
 
void bvisit (const Add &x)
 
void bvisit (const Mul &x)
 
void bvisit (const Pow &x)
 
void bvisit (const UIntPoly &x)
 
void bvisit (const MIntPoly &x)
 
void bvisit (const URatPoly &x)
 
void bvisit (const UExprPoly &x)
 
void bvisit (const MExprPoly &x)
 
void bvisit (const GaloisField &x)
 
void bvisit (const Infty &x)
 
void bvisit (const NaN &x)
 
void bvisit (const UnivariateSeries &x)
 
void bvisit (const Constant &x)
 
void bvisit (const Function &x)
 
void bvisit (const FunctionSymbol &x)
 
void bvisit (const Derivative &x)
 
void bvisit (const Subs &x)
 
void bvisit (const RealDouble &x)
 
void bvisit (const ComplexDouble &x)
 
void bvisit (const Equality &x)
 
void bvisit (const Unequality &x)
 
void bvisit (const LessThan &x)
 
void bvisit (const StrictLessThan &x)
 
void bvisit (const NumberWrapper &x)
 
void bvisit (const Tuple &x)
 
void bvisit (const IdentityMatrix &x)
 
void bvisit (const ZeroMatrix &x)
 
std::string apply (const RCP< const Basic > &b)
 
std::string apply (const vec_basic &v)
 
std::string apply (const Basic &b)
 

Protected Member Functions

void print_with_args (const Basic &x, const std::string &join, std::ostringstream &s)
 
std::string parenthesize (const std::string &expr) override
 
void _print_pow (std::ostringstream &o, const RCP< const Basic > &a, const RCP< const Basic > &b) override
 
bool split_mul_coef () override
 
std::string print_mul () override
 
std::string print_div (const std::string &num, const std::string &den, bool paren) override
 
- Protected Member Functions inherited from SymEngine::StrPrinter
virtual std::string get_imag_symbol ()
 
std::string parenthesizeLT (const RCP< const Basic > &x, PrecedenceEnum precedenceEnum)
 
std::string parenthesizeLE (const RCP< const Basic > &x, PrecedenceEnum precedenceEnum)
 

Static Private Attributes

static const std::vector< std::stringnames_
 

Additional Inherited Members

- Protected Attributes inherited from SymEngine::StrPrinter
std::string str_
 

Detailed Description

Definition at line 9 of file latex.h.

Member Function Documentation

◆ _print_pow()

void SymEngine::LatexPrinter::_print_pow ( std::ostringstream o,
const RCP< const Basic > &  a,
const RCP< const Basic > &  b 
)
overrideprotectedvirtual

Reimplemented from SymEngine::StrPrinter.

Definition at line 559 of file latex.cpp.

561{
562 if (eq(*a, *E)) {
563 o << "e^{" << apply(b) << "}";
564 } else if (eq(*b, *rational(1, 2))) {
565 o << "\\sqrt{" << apply(a) << "}";
566 } else if (is_a<Rational>(*b)
567 and eq(*static_cast<const Rational &>(*b).get_num(), *one)) {
568 o << "\\sqrt[" << apply(static_cast<const Rational &>(*b).get_den())
569 << "]{" << apply(a) << "}";
570 } else {
571 o << parenthesizeLE(a, PrecedenceEnum::Pow);
572 Precedence prec;
573 auto b_str = apply(b);
574 if (b_str.size() > 1) {
575 o << "^{" << b_str << "}";
576 } else {
577 o << "^" << b_str;
578 }
579 }
580}
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
Definition basic-inl.h:21
void hash_combine(hash_t &seed, const T &v)
Definition basic-inl.h:95
RCP< const Number > rational(long n, long d)
convenience creator from two longs
Definition rational.h:328

◆ bvisit() [1/94]

void SymEngine::LatexPrinter::bvisit ( const Abs x)

Definition at line 547 of file latex.cpp.

548{
550 o << "\\left|" << apply(x.get_arg()) << "}\\right|";
551 str_ = o.str();
552}

◆ bvisit() [2/94]

void SymEngine::StrPrinter::bvisit ( const Add x)

Definition at line 154 of file strprinter.cpp.

518{
520 bool first = true;
521 std::map<RCP<const Basic>, RCP<const Number>, PrinterBasicCmp> dict(
522 x.get_dict().begin(), x.get_dict().end());
523
524 if (neq(*(x.get_coef()), *zero)) {
525 o << this->apply(x.get_coef());
526 first = false;
527 }
528 for (const auto &p : dict) {
529 std::string t;
530 if (eq(*(p.second), *one)) {
531 t = parenthesizeLT(p.first, PrecedenceEnum::Add);
532 } else if (eq(*(p.second), *minus_one)) {
533 t = "-" + parenthesizeLT(p.first, PrecedenceEnum::Mul);
534 } else {
535 t = parenthesizeLT(p.second, PrecedenceEnum::Mul) + print_mul()
536 + parenthesizeLT(p.first, PrecedenceEnum::Mul);
537 }
538
539 if (not first) {
540 if (t[0] == '-') {
541 o << " - " << t.substr(1);
542 } else {
543 o << " + " << t;
544 }
545 } else {
546 o << t;
547 first = false;
548 }
549 }
550 str_ = o.str();
551}
bool neq(const Basic &a, const Basic &b)
Checks inequality for a and b
Definition basic-inl.h:29
T substr(T... args)

◆ bvisit() [3/94]

void SymEngine::StrPrinter::bvisit ( const And x)

Definition at line 146 of file strprinter.cpp.

297{
299 auto container = x.get_container();
300 s << "And(";
301 s << apply(*container.begin());
302 for (auto it = ++(container.begin()); it != container.end(); ++it) {
303 s << ", " << apply(*it);
304 }
305 s << ")";
306 str_ = s.str();
307}
T str(T... args)

◆ bvisit() [4/94]

void SymEngine::LatexPrinter::bvisit ( const And x)

Definition at line 309 of file latex.cpp.

310{
312 auto container = x.get_container();
313 if (is_a<Or>(**container.begin()) or is_a<Xor>(**container.begin())) {
314 s << parenthesize(apply(*container.begin()));
315 } else {
316 s << apply(*container.begin());
317 }
318
319 for (auto it = ++(container.begin()); it != container.end(); ++it) {
320 s << " \\wedge ";
321 if (is_a<Or>(**it) or is_a<Xor>(**it)) {
322 s << parenthesize(apply(*it));
323 } else {
324 s << apply(*it);
325 }
326 }
327 str_ = s.str();
328}

◆ bvisit() [5/94]

void SymEngine::StrPrinter::bvisit ( const Basic x)

Definition at line 127 of file strprinter.cpp.

134{
136 s << "<" << typeName<Basic>(x) << " instance at " << (const void *)this
137 << ">";
138 str_ = s.str();
139}

◆ bvisit() [6/94]

void SymEngine::StrPrinter::bvisit ( const BooleanAtom x)

Definition at line 145 of file strprinter.cpp.

288{
289 if (x.get_val()) {
290 str_ = "True";
291 } else {
292 str_ = "False";
293 }
294}

◆ bvisit() [7/94]

void SymEngine::LatexPrinter::bvisit ( const BooleanAtom x)

Definition at line 300 of file latex.cpp.

301{
302 if (x.get_val()) {
303 str_ = "\\mathrm{True}";
304 } else {
305 str_ = "\\mathrm{False}";
306 }
307}

◆ bvisit() [8/94]

void SymEngine::LatexPrinter::bvisit ( const Ceiling x)

Definition at line 540 of file latex.cpp.

541{
543 o << "\\lceil{" << apply(x.get_arg()) << "}\\rceil";
544 str_ = o.str();
545}

◆ bvisit() [9/94]

void SymEngine::StrPrinter::bvisit ( const Complement x)

Definition at line 152 of file strprinter.cpp.

429{
431 s << apply(*x.get_universe());
432 s << " \\ " << apply(*x.get_container());
433 str_ = s.str();
434}

◆ bvisit() [10/94]

void SymEngine::LatexPrinter::bvisit ( const Complement x)

Definition at line 402 of file latex.cpp.

403{
405 s << apply(x.get_universe()) << " \\setminus " << apply(x.get_container());
406 str_ = s.str();
407}

◆ bvisit() [11/94]

void SymEngine::StrPrinter::bvisit ( const Complex x)

Definition at line 131 of file strprinter.cpp.

178{
180 if (x.real_ != 0) {
181 s << x.real_;
182 // Since Complex is in canonical form, imaginary_ is not 0.
183 if (mp_sign(x.imaginary_) == 1) {
184 s << " + ";
185 } else {
186 s << " - ";
187 }
188 // If imaginary_ is not 1 or -1, print the absolute value
189 if (x.imaginary_ != mp_sign(x.imaginary_)) {
190 s << mp_abs(x.imaginary_);
191 s << print_mul() << get_imag_symbol();
192 } else {
193 s << "I";
194 }
195 } else {
196 if (x.imaginary_ != mp_sign(x.imaginary_)) {
197 s << x.imaginary_;
198 s << print_mul() << get_imag_symbol();
199 } else {
200 if (mp_sign(x.imaginary_) == 1) {
201 s << get_imag_symbol();
202 } else {
203 s << "-" << get_imag_symbol();
204 }
205 }
206 }
207 str_ = s.str();
208}

◆ bvisit() [12/94]

void SymEngine::LatexPrinter::bvisit ( const Complex x)

Definition at line 64 of file latex.cpp.

65{
67 if (x.real_ != 0) {
68 print_rational_class(x.real_, s);
69 // Since Complex is in canonical form, imaginary_ is not 0.
70 if (mp_sign(x.imaginary_) == 1) {
71 s << " + ";
72 } else {
73 s << " - ";
74 }
75 // If imaginary_ is not 1 or -1, print the absolute value
76 if (x.imaginary_ != mp_sign(x.imaginary_)) {
77 print_rational_class(mp_abs(x.imaginary_), s);
78 s << "j";
79 } else {
80 s << "j";
81 }
82 } else {
83 if (x.imaginary_ != mp_sign(x.imaginary_)) {
84 print_rational_class(x.imaginary_, s);
85 s << "j";
86 } else {
87 if (mp_sign(x.imaginary_) == 1) {
88 s << "j";
89 } else {
90 s << "-j";
91 }
92 }
93 }
94 str_ = s.str();
95}

◆ bvisit() [13/94]

void SymEngine::LatexPrinter::bvisit ( const ComplexBase x)

Definition at line 97 of file latex.cpp.

98{
99 RCP<const Number> imag = x.imaginary_part();
100 if (imag->is_negative()) {
101 std::string str = apply(imag);
102 str = str.substr(1, str.length() - 1);
103 str_ = apply(x.real_part()) + " - " + str + "j";
104 } else {
105 str_ = apply(x.real_part()) + " + " + apply(imag) + "j";
106 }
107}

◆ bvisit() [14/94]

void SymEngine::StrPrinter::bvisit ( const ComplexDouble x)

Definition at line 182 of file strprinter.cpp.

233{
234 str_ = print_double(x.i.real());
235 if (x.i.imag() < 0) {
236 str_ += " - " + print_double(-x.i.imag()) + print_mul()
237 + get_imag_symbol();
238 } else {
239 str_ += " + " + print_double(x.i.imag()) + print_mul()
240 + get_imag_symbol();
241 }
242}

◆ bvisit() [15/94]

void SymEngine::LatexPrinter::bvisit ( const ComplexDouble x)

Definition at line 108 of file latex.cpp.

109{
110 bvisit(static_cast<const ComplexBase &>(x));
111}

◆ bvisit() [16/94]

void SymEngine::StrPrinter::bvisit ( const Complexes x)

Definition at line 133 of file strprinter.cpp.

374{
375 str_ = "Complexes";
376}

◆ bvisit() [17/94]

void SymEngine::LatexPrinter::bvisit ( const Complexes x)

Definition at line 431 of file latex.cpp.

432{
433 str_ = "\\mathbb{C}";
434}

◆ bvisit() [18/94]

void SymEngine::StrPrinter::bvisit ( const ConditionSet x)

Definition at line 143 of file strprinter.cpp.

458{
460 s << "{" << apply(*x.get_symbol());
461 s << " | " << apply(x.get_condition()) << "}";
462 str_ = s.str();
463}

◆ bvisit() [19/94]

void SymEngine::LatexPrinter::bvisit ( const ConditionSet x)

Definition at line 418 of file latex.cpp.

419{
421 s << "\\left\\{" << apply(*x.get_symbol()) << "\\; |\\; ";
422 s << apply(x.get_condition()) << "\\right\\}";
423 str_ = s.str();
424}

◆ bvisit() [20/94]

void SymEngine::StrPrinter::bvisit ( const Constant x)

Definition at line 176 of file strprinter.cpp.

857{
858 str_ = x.get_name();
859}

◆ bvisit() [21/94]

void SymEngine::LatexPrinter::bvisit ( const Constant x)

Definition at line 136 of file latex.cpp.

137{
138 if (eq(x, *pi)) {
139 str_ = "\\pi";
140 } else if (eq(x, *E)) {
141 str_ = "e";
142 } else if (eq(x, *EulerGamma)) {
143 str_ = "\\gamma";
144 } else if (eq(x, *Catalan)) {
145 str_ = "G";
146 } else if (eq(x, *GoldenRatio)) {
147 str_ = "\\phi";
148 } else {
149 throw NotImplementedError("Constant " + x.get_name()
150 + " is not implemented.");
151 }
152}

◆ bvisit() [22/94]

void SymEngine::StrPrinter::bvisit ( const Contains x)

Definition at line 144 of file strprinter.cpp.

343{
345 s << "Contains(" << apply(x.get_expr()) << ", " << apply(x.get_set())
346 << ")";
347 str_ = s.str();
348}

◆ bvisit() [23/94]

void SymEngine::LatexPrinter::bvisit ( const Contains x)

Definition at line 470 of file latex.cpp.

471{
473 s << apply(x.get_expr()) << " \\in " << apply(x.get_set());
474 str_ = s.str();
475}

◆ bvisit() [24/94]

void SymEngine::StrPrinter::bvisit ( const Derivative x)

Definition at line 179 of file strprinter.cpp.

893{
895 o << "Derivative(" << this->apply(x.get_arg());
896 auto m1 = x.get_symbols();
897 for (const auto &elem : m1) {
898 o << ", " << this->apply(elem);
899 }
900 o << ")";
901 str_ = o.str();
902}

◆ bvisit() [25/94]

void SymEngine::LatexPrinter::bvisit ( const Derivative x)

Definition at line 154 of file latex.cpp.

155{
156 const auto &symbols = x.get_symbols();
158 if (symbols.size() == 1) {
159 if (free_symbols(*x.get_arg()).size() == 1) {
160 s << "\\frac{d}{d " << apply(*symbols.begin());
161 } else {
162 s << "\\frac{\\partial}{\\partial " << apply(*symbols.begin());
163 }
164 } else {
165 s << "\\frac{\\partial^" << symbols.size() << "}{";
166 unsigned count = 1;
167 auto it = symbols.begin();
168 RCP<const Basic> prev = *it;
169 ++it;
170 for (; it != symbols.end(); ++it) {
171 if (neq(*prev, **it)) {
172 if (count == 1) {
173 s << "\\partial " << apply(*prev) << " ";
174 } else {
175 s << "\\partial " << apply(*prev) << "^" << count << " ";
176 }
177 count = 1;
178 } else {
179 count++;
180 }
181 prev = *it;
182 }
183 if (count == 1) {
184 s << "\\partial " << apply(*prev) << " ";
185 } else {
186 s << "\\partial " << apply(*prev) << "^" << count << " ";
187 }
188 }
189 s << "} " << apply(x.get_arg());
190 str_ = s.str();
191}
T count(T... args)
T prev(T... args)
T size(T... args)

◆ bvisit() [26/94]

void SymEngine::StrPrinter::bvisit ( const EmptySet x)

Definition at line 140 of file strprinter.cpp.

404{
405 str_ = "EmptySet";
406}

◆ bvisit() [27/94]

void SymEngine::LatexPrinter::bvisit ( const EmptySet x)

Definition at line 426 of file latex.cpp.

427{
428 str_ = "\\emptyset";
429}

◆ bvisit() [28/94]

void SymEngine::StrPrinter::bvisit ( const Equality x)

Definition at line 183 of file strprinter.cpp.

245{
247 s << apply(x.get_arg1()) << " == " << apply(x.get_arg2());
248 str_ = s.str();
249}

◆ bvisit() [29/94]

void SymEngine::LatexPrinter::bvisit ( const Equality x)

Definition at line 207 of file latex.cpp.

208{
210 s << apply(x.get_arg1()) << " = " << apply(x.get_arg2());
211 str_ = s.str();
212}

◆ bvisit() [30/94]

void SymEngine::StrPrinter::bvisit ( const FiniteSet x)

Definition at line 141 of file strprinter.cpp.

451{
453 s << x.get_container();
454 str_ = s.str();
455}

◆ bvisit() [31/94]

void SymEngine::LatexPrinter::bvisit ( const FiniteSet x)

Definition at line 461 of file latex.cpp.

462{
464 s << "\\left{";
465 print_with_args(x, ",", s);
466 s << "\\right}";
467 str_ = s.str();
468}

◆ bvisit() [32/94]

void SymEngine::LatexPrinter::bvisit ( const Floor x)

Definition at line 533 of file latex.cpp.

534{
536 o << "\\lfloor{" << apply(x.get_arg()) << "}\\rfloor";
537 str_ = o.str();
538}

◆ bvisit() [33/94]

void SymEngine::StrPrinter::bvisit ( const Function x)

Definition at line 177 of file strprinter.cpp.

874{
875 static const std::vector<std::string> names_ = init_str_printer_names();
877 o << names_[x.get_type_code()];
878 vec_basic vec = x.get_args();
879 o << parenthesize(apply(vec));
880 str_ = o.str();
881}

◆ bvisit() [34/94]

void SymEngine::LatexPrinter::bvisit ( const Function x)

Definition at line 523 of file latex.cpp.

524{
525 static const std::vector<std::string> names_ = init_latex_printer_names();
527 o << names_[x.get_type_code()] << "{";
528 vec_basic vec = x.get_args();
529 o << parenthesize(apply(vec)) << "}";
530 str_ = o.str();
531}

◆ bvisit() [35/94]

void SymEngine::StrPrinter::bvisit ( const FunctionSymbol x)

Definition at line 178 of file strprinter.cpp.

884{
886 o << x.get_name();
887 vec_basic vec = x.get_args();
888 o << parenthesize(apply(vec));
889 str_ = o.str();
890}

◆ bvisit() [36/94]

void SymEngine::StrPrinter::bvisit ( const GaloisField x)

Definition at line 166 of file strprinter.cpp.

669{
671 // bool variable needed to take care of cases like -5, -x, -3*x etc.
672 bool first = true;
673 // we iterate over the map in reverse order so that highest degree gets
674 // printed first
675 auto dict = x.get_dict();
676 if (x.get_dict().size() == 0)
677 s << "0";
678 else {
679 for (auto it = dict.size(); it-- != 0;) {
680 if (dict[it] == 0)
681 continue;
682 // if exponent is 0, then print only coefficient
683 if (it == 0) {
684 if (first) {
685 s << dict[it];
686 } else {
687 s << " " << _print_sign(dict[it]) << " "
688 << mp_abs(dict[it]);
689 }
690 first = false;
691 break;
692 }
693 // if the coefficient of a term is +1 or -1
694 if (mp_abs(dict[it]) == 1) {
695 // in cases of -x, print -x
696 // in cases of x**2 - x, print - x
697 if (first) {
698 if (dict[it] == -1)
699 s << "-";
700 s << detail::poly_print(x.get_var());
701 } else {
702 s << " " << _print_sign(dict[it]) << " "
703 << detail::poly_print(x.get_var());
704 }
705 }
706 // same logic is followed as above
707 else {
708 // in cases of -2*x, print -2*x
709 // in cases of x**2 - 2*x, print - 2*x
710 if (first) {
711 s << dict[it] << "*" << detail::poly_print(x.get_var());
712 } else {
713 s << " " << _print_sign(dict[it]) << " " << mp_abs(dict[it])
714 << "*" << detail::poly_print(x.get_var());
715 }
716 }
717 // if exponent is not 1, print the exponent;
718 if (it != 1) {
719 s << "**" << it;
720 }
721 // corner cases of only first term handled successfully, switch the
722 // bool
723 first = false;
724 }
725 }
726 str_ = s.str();
727}

◆ bvisit() [37/94]

void SymEngine::StrPrinter::bvisit ( const IdentityMatrix x)

Definition at line 195 of file strprinter.cpp.

1031{
1032 str_ = "I";
1033}

◆ bvisit() [38/94]

void SymEngine::StrPrinter::bvisit ( const ImageSet x)

Definition at line 153 of file strprinter.cpp.

437{
439 s << "{" << apply(*x.get_expr()) << " | ";
440 s << apply(*x.get_symbol());
441 s << " in " << apply(*x.get_baseset()) << "}";
442 str_ = s.str();
443}

◆ bvisit() [39/94]

void SymEngine::LatexPrinter::bvisit ( const ImageSet x)

Definition at line 409 of file latex.cpp.

410{
412 s << "\\left\\{" << apply(*x.get_expr()) << "\\; |\\; ";
413 s << apply(*x.get_symbol());
414 s << " \\in " << apply(*x.get_baseset()) << "\\right\\}";
415 str_ = s.str();
416}

◆ bvisit() [40/94]

void SymEngine::StrPrinter::bvisit ( const Infty x)

Definition at line 167 of file strprinter.cpp.

147{
149 if (x.is_negative_infinity())
150 s << "-oo";
151 else if (x.is_positive_infinity())
152 s << "oo";
153 else
154 s << "zoo";
155 str_ = s.str();
156}

◆ bvisit() [41/94]

void SymEngine::LatexPrinter::bvisit ( const Infty x)

Definition at line 120 of file latex.cpp.

121{
122 if (x.is_negative_infinity()) {
123 str_ = "-\\infty";
124 } else if (x.is_positive_infinity()) {
125 str_ = "\\infty";
126 } else {
127 str_ = "\\tilde{\\infty}";
128 }
129}

◆ bvisit() [42/94]

void SymEngine::StrPrinter::bvisit ( const Integer x)

Definition at line 129 of file strprinter.cpp.

164{
166 s << x.as_integer_class();
167 str_ = s.str();
168}

◆ bvisit() [43/94]

void SymEngine::StrPrinter::bvisit ( const Integers x)

Definition at line 136 of file strprinter.cpp.

389{
390 str_ = "Integers";
391}

◆ bvisit() [44/94]

void SymEngine::LatexPrinter::bvisit ( const Integers x)

Definition at line 446 of file latex.cpp.

447{
448 str_ = "\\mathbb{Z}";
449}

◆ bvisit() [45/94]

void SymEngine::StrPrinter::bvisit ( const Intersection x)

Definition at line 151 of file strprinter.cpp.

420{
422 vec_basic vec = x.get_args();
423 s << "Intersection";
424 s << parenthesize(apply(vec));
425 str_ = s.str();
426}

◆ bvisit() [46/94]

void SymEngine::LatexPrinter::bvisit ( const Intersection x)

Definition at line 395 of file latex.cpp.

396{
398 print_with_args(x, "\\cap", s);
399 str_ = s.str();
400}

◆ bvisit() [47/94]

void SymEngine::StrPrinter::bvisit ( const Interval x)

Definition at line 132 of file strprinter.cpp.

273{
275 if (x.get_left_open())
276 s << "(";
277 else
278 s << "[";
279 s << *x.get_start() << ", " << *x.get_end();
280 if (x.get_right_open())
281 s << ")";
282 else
283 s << "]";
284 str_ = s.str();
285}

◆ bvisit() [48/94]

void SymEngine::LatexPrinter::bvisit ( const Interval x)

Definition at line 285 of file latex.cpp.

286{
288 if (x.get_left_open())
289 s << "\\left(";
290 else
291 s << "\\left[";
292 s << *x.get_start() << ", " << *x.get_end();
293 if (x.get_right_open())
294 s << "\\right)";
295 else
296 s << "\\right]";
297 str_ = s.str();
298}

◆ bvisit() [49/94]

void SymEngine::StrPrinter::bvisit ( const LessThan x)

Definition at line 185 of file strprinter.cpp.

259{
261 s << apply(x.get_arg1()) << " <= " << apply(x.get_arg2());
262 str_ = s.str();
263}

◆ bvisit() [50/94]

void SymEngine::LatexPrinter::bvisit ( const LessThan x)

Definition at line 221 of file latex.cpp.

222{
224 s << apply(x.get_arg1()) << " \\leq " << apply(x.get_arg2());
225 str_ = s.str();
226}

◆ bvisit() [51/94]

void SymEngine::StrPrinter::bvisit ( const MExprPoly x)

Definition at line 165 of file strprinter.cpp.

974{
976 bool first = true; // is this the first term being printed out?
977 // To change the ordering in which the terms will print out, change
978 // vec_uint_compare in dict.h
979 std::vector<vec_int> v = sorted_keys(x.get_poly().dict_);
980
981 for (vec_int exps : v) {
982 Expression c = x.get_poly().dict_.find(exps)->second;
983 std::string t = parenthesizeLT(c.get_basic(), PrecedenceEnum::Mul);
984 if ('-' == t[0] && !first) {
985 s << " - ";
986 t = t.substr(1);
987 } else if (!first) {
988 s << " + ";
989 }
990 unsigned int i = 0;
992 bool first_var = true;
993 for (auto it : x.get_vars()) {
994 if (exps[i] != 0) {
995 if (!first_var) {
996 expr << "*";
997 }
998 expr << it->__str__();
999 if (exps[i] > 1 or exps[i] < 0)
1000 expr << "**" << exps[i];
1001 first_var = false;
1002 }
1003 i++;
1004 }
1005 if (c != 1 && c != -1) {
1006 s << t;
1007 if (!expr.str().empty()) {
1008 s << "*";
1009 }
1010 } else if (expr.str().empty()) {
1011 s << "1";
1012 }
1013 s << expr.str();
1014 first = false;
1015 }
1016
1017 if (s.str().empty())
1018 s << "0";
1019 str_ = s.str();
1020}

◆ bvisit() [52/94]

void SymEngine::StrPrinter::bvisit ( const MIntPoly x)

Definition at line 158 of file strprinter.cpp.

926{
928 bool first = true; // is this the first term being printed out?
929 // To change the ordering in which the terms will print out, change
930 // vec_uint_compare in dict.h
931 std::vector<vec_uint> v = sorted_keys(x.get_poly().dict_);
932
933 for (vec_uint exps : v) {
934 integer_class c = x.get_poly().dict_.find(exps)->second;
935 if (!first) {
936 s << " " << _print_sign(c) << " ";
937 } else if (c < 0) {
938 s << "-";
939 }
940
941 unsigned int i = 0;
943 bool first_var = true;
944 for (auto it : x.get_vars()) {
945 if (exps[i] != 0) {
946 if (!first_var) {
947 expr << "*";
948 }
949 expr << it->__str__();
950 if (exps[i] > 1)
951 expr << "**" << exps[i];
952 first_var = false;
953 }
954 i++;
955 }
956 if (mp_abs(c) != 1) {
957 s << mp_abs(c);
958 if (!expr.str().empty()) {
959 s << "*";
960 }
961 } else if (expr.str().empty()) {
962 s << "1";
963 }
964 s << expr.str();
965 first = false;
966 }
967
968 if (s.str().empty())
969 s << "0";
970 str_ = s.str();
971}

◆ bvisit() [53/94]

void SymEngine::StrPrinter::bvisit ( const Mul x)

Definition at line 155 of file strprinter.cpp.

568{
570 bool num = false;
571 unsigned den = 0;
572
573 if (eq(*(x.get_coef()), *minus_one)) {
574 o << "-";
575 } else if (neq(*(x.get_coef()), *one)) {
576 if (not split_mul_coef()) {
577 o << parenthesizeLT(x.get_coef(), PrecedenceEnum::Mul)
578 << print_mul();
579 num = true;
580 } else {
581 RCP<const Basic> numer, denom;
582 as_numer_denom(x.get_coef(), outArg(numer), outArg(denom));
583 if (neq(*numer, *one)) {
584 num = true;
585 o << parenthesizeLT(numer, PrecedenceEnum::Mul) << print_mul();
586 }
587 if (neq(*denom, *one)) {
588 den++;
589 o2 << parenthesizeLT(denom, PrecedenceEnum::Mul) << print_mul();
590 }
591 }
592 }
593
594 for (const auto &p : x.get_dict()) {
595 if ((is_a<Integer>(*p.second) or is_a<Rational>(*p.second))
596 and down_cast<const Number &>(*p.second).is_negative()
597 and neq(*(p.first), *E)) {
598 if (eq(*(p.second), *minus_one)) {
599 o2 << parenthesizeLT(p.first, PrecedenceEnum::Mul);
600 } else {
601 _print_pow(o2, p.first, neg(p.second));
602 }
603 o2 << print_mul();
604 den++;
605 } else {
606 if (eq(*(p.second), *one)) {
607 o << parenthesizeLT(p.first, PrecedenceEnum::Mul);
608 } else {
609 _print_pow(o, p.first, p.second);
610 }
611 o << print_mul();
612 num = true;
613 }
614 }
615
616 if (not num) {
617 o << "1" << print_mul();
618 }
619
620 std::string s = o.str();
621 s = s.substr(0, s.size() - 1);
622
623 if (den != 0) {
624 std::string s2 = o2.str();
625 s2 = s2.substr(0, s2.size() - 1);
626 if (den > 1) {
627 str_ = print_div(s, s2, true);
628 } else {
629 str_ = print_div(s, s2, false);
630 }
631 } else {
632 str_ = s;
633 }
634}
RCP< const Basic > neg(const RCP< const Basic > &a)
Negation.
Definition mul.cpp:443

◆ bvisit() [54/94]

void SymEngine::StrPrinter::bvisit ( const NaN x)

Definition at line 168 of file strprinter.cpp.

159{
160 str_ = "nan";
161}

◆ bvisit() [55/94]

void SymEngine::LatexPrinter::bvisit ( const NaN x)

Definition at line 131 of file latex.cpp.

132{
133 str_ = "\\mathrm{NaN}";
134}

◆ bvisit() [56/94]

void SymEngine::StrPrinter::bvisit ( const Naturals x)

Definition at line 137 of file strprinter.cpp.

394{
395 str_ = "Naturals";
396}

◆ bvisit() [57/94]

void SymEngine::LatexPrinter::bvisit ( const Naturals x)

Definition at line 451 of file latex.cpp.

452{
453 str_ = "\\mathbb{N}";
454}

◆ bvisit() [58/94]

void SymEngine::StrPrinter::bvisit ( const Naturals0 x)

Definition at line 138 of file strprinter.cpp.

399{
400 str_ = "Naturals0";
401}

◆ bvisit() [59/94]

void SymEngine::LatexPrinter::bvisit ( const Naturals0 x)

Definition at line 456 of file latex.cpp.

457{
458 str_ = "\\mathbb{N}_0";
459}

◆ bvisit() [60/94]

void SymEngine::StrPrinter::bvisit ( const Not x)

Definition at line 149 of file strprinter.cpp.

336{
338 s << "Not(" << *x.get_arg() << ")";
339 str_ = s.str();
340}

◆ bvisit() [61/94]

void SymEngine::LatexPrinter::bvisit ( const Not x)

Definition at line 383 of file latex.cpp.

384{
385 str_ = "\\neg " + apply(*x.get_arg());
386}

◆ bvisit() [62/94]

void SymEngine::StrPrinter::bvisit ( const NumberWrapper x)

Definition at line 193 of file strprinter.cpp.

921{
922 str_ = x.__str__();
923}

◆ bvisit() [63/94]

void SymEngine::StrPrinter::bvisit ( const Or x)

Definition at line 147 of file strprinter.cpp.

310{
312 auto container = x.get_container();
313 s << "Or(";
314 s << apply(*container.begin());
315 for (auto it = ++(container.begin()); it != container.end(); ++it) {
316 s << ", " << apply(*it);
317 }
318 s << ")";
319 str_ = s.str();
320}

◆ bvisit() [64/94]

void SymEngine::LatexPrinter::bvisit ( const Or x)

Definition at line 330 of file latex.cpp.

331{
333 auto container = x.get_container();
334 if (is_a<And>(**container.begin()) or is_a<Xor>(**container.begin())) {
335 s << parenthesize(apply(*container.begin()));
336 } else {
337 s << apply(*container.begin());
338 }
339
340 for (auto it = ++(container.begin()); it != container.end(); ++it) {
341 s << " \\vee ";
342 if (is_a<And>(**it) or is_a<Xor>(**it)) {
343 s << parenthesize(apply(*it));
344 } else {
345 s << apply(*it);
346 }
347 }
348 str_ = s.str();
349}

◆ bvisit() [65/94]

void SymEngine::StrPrinter::bvisit ( const Piecewise x)

Definition at line 139 of file strprinter.cpp.

351{
353 auto vec = x.get_vec();
354 auto it = vec.begin();
355 s << "Piecewise(";
356 while (true) {
357 s << "(";
358 s << apply((*it).first);
359 s << ", ";
360 s << apply((*it).second);
361 s << ")";
362 ++it;
363 if (it != vec.end()) {
364 s << ", ";
365 } else {
366 break;
367 }
368 }
369 s << ")";
370 str_ = s.str();
371}

◆ bvisit() [66/94]

void SymEngine::LatexPrinter::bvisit ( const Piecewise x)

Definition at line 588 of file latex.cpp.

589{
591 s << "\\begin{cases} ";
592 const auto &vec = x.get_vec();
593 auto it = vec.begin();
594 auto it_last = --vec.end();
595 while (it != vec.end()) {
596 s << apply(it->first);
597 if (it == it_last) {
598 if (eq(*it->second, *boolTrue)) {
599 s << " & \\text{otherwise} \\end{cases}";
600 } else {
601 s << " & \\text{for}\\: ";
602 s << apply(it->second);
603 s << " \\end{cases}";
604 }
605 } else {
606 s << " & \\text{for}\\: ";
607 s << apply(it->second);
608 s << "\\\\";
609 }
610 it++;
611 }
612 str_ = s.str();
613}

◆ bvisit() [67/94]

void SymEngine::StrPrinter::bvisit ( const Pow x)

Definition at line 156 of file strprinter.cpp.

652{
654 _print_pow(o, x.get_base(), x.get_exp());
655 str_ = o.str();
656}

◆ bvisit() [68/94]

void SymEngine::StrPrinter::bvisit ( const Rational x)

Definition at line 130 of file strprinter.cpp.

171{
173 s << x.as_rational_class();
174 str_ = s.str();
175}

◆ bvisit() [69/94]

void SymEngine::LatexPrinter::bvisit ( const Rational x)

Definition at line 56 of file latex.cpp.

57{
58 const auto &rational = x.as_rational_class();
60 print_rational_class(rational, s);
61 str_ = s.str();
62}

◆ bvisit() [70/94]

void SymEngine::StrPrinter::bvisit ( const Rationals x)

Definition at line 135 of file strprinter.cpp.

384{
385 str_ = "Rationals";
386}

◆ bvisit() [71/94]

void SymEngine::LatexPrinter::bvisit ( const Rationals x)

Definition at line 441 of file latex.cpp.

442{
443 str_ = "\\mathbb{Q}";
444}

◆ bvisit() [72/94]

void SymEngine::StrPrinter::bvisit ( const RealDouble x)

Definition at line 181 of file strprinter.cpp.

228{
229 str_ = print_double(x.i);
230}

◆ bvisit() [73/94]

void SymEngine::StrPrinter::bvisit ( const Reals x)

Definition at line 134 of file strprinter.cpp.

379{
380 str_ = "Reals";
381}

◆ bvisit() [74/94]

void SymEngine::LatexPrinter::bvisit ( const Reals x)

Definition at line 436 of file latex.cpp.

437{
438 str_ = "\\mathbb{R}";
439}

◆ bvisit() [75/94]

void SymEngine::StrPrinter::bvisit ( const StrictLessThan x)

Definition at line 186 of file strprinter.cpp.

266{
268 s << apply(x.get_arg1()) << " < " << apply(x.get_arg2());
269 str_ = s.str();
270}

◆ bvisit() [76/94]

void SymEngine::LatexPrinter::bvisit ( const StrictLessThan x)

Definition at line 228 of file latex.cpp.

229{
231 s << apply(x.get_arg1()) << " < " << apply(x.get_arg2());
232 str_ = s.str();
233}

◆ bvisit() [77/94]

void SymEngine::StrPrinter::bvisit ( const Subs x)

Definition at line 180 of file strprinter.cpp.

905{
907 for (auto p = x.get_dict().begin(); p != x.get_dict().end(); p++) {
908 if (p != x.get_dict().begin()) {
909 vars << ", ";
910 point << ", ";
911 }
912 vars << apply(p->first);
913 point << apply(p->second);
914 }
915 o << "Subs(" << apply(x.get_arg()) << ", (" << vars.str() << "), ("
916 << point.str() << "))";
917 str_ = o.str();
918}

◆ bvisit() [78/94]

void SymEngine::LatexPrinter::bvisit ( const Subs x)

Definition at line 193 of file latex.cpp.

194{
196 o << "\\left. " << apply(x.get_arg()) << "\\right|_{\\substack{";
197 for (auto p = x.get_dict().begin(); p != x.get_dict().end(); p++) {
198 if (p != x.get_dict().begin()) {
199 o << " \\\\ ";
200 }
201 o << apply(p->first) << "=" << apply(p->second);
202 }
203 o << "}}";
204 str_ = o.str();
205}

◆ bvisit() [79/94]

void SymEngine::StrPrinter::bvisit ( const Symbol x)

Definition at line 128 of file strprinter.cpp.

142{
143 str_ = x.get_name();
144}

◆ bvisit() [80/94]

void SymEngine::LatexPrinter::bvisit ( const Symbol x)

Definition at line 23 of file latex.cpp.

24{
25 std::string name = x.get_name();
26
27 if (name.find('\\') != std::string::npos
28 or name.find('{') != std::string::npos) {
29 str_ = name;
30 return;
31 }
32 if (name[0] == '_') {
33 name = name.substr(1, name.size());
34 }
36 = {"alpha", "beta", "gamma", "Gamma", "delta", "Delta", "epsilon",
37 "zeta", "eta", "theta", "Theta", "iota", "kappa", "lambda",
38 "Lambda", "mu", "nu", "xi", "omicron", "pi", "Pi",
39 "rho", "sigma", "Sigma", "tau", "upsilon", "Upsilon", "phi",
40 "Phi", "chi", "psi", "Psi", "omega", "Omega"};
41
42 for (auto &letter : greeks) {
43 if (name == letter) {
44 str_ = "\\" + name;
45 return;
46 }
47 if (name.size() > letter.size() and name.find(letter + "_") == 0) {
48 str_ = "\\" + name;
49 return;
50 }
51 }
52 str_ = name;
53 return;
54}
T find(T... args)

◆ bvisit() [81/94]

void SymEngine::StrPrinter::bvisit ( const Tuple x)

Definition at line 194 of file strprinter.cpp.

1023{
1025 vec_basic vec = x.get_args();
1026 o << parenthesize(apply(vec));
1027 str_ = o.str();
1028}

◆ bvisit() [82/94]

void SymEngine::LatexPrinter::bvisit ( const Tuple x)

Definition at line 615 of file latex.cpp.

616{
618 vec_basic vec = x.get_args();
619 o << parenthesize(apply(vec));
620 str_ = o.str();
621}

◆ bvisit() [83/94]

void SymEngine::StrPrinter::bvisit ( const UExprPoly x)

Definition at line 164 of file strprinter.cpp.

822{
824 if (x.get_dict().size() == 0)
825 s << "0";
826 else
827 s << x.get_poly().__str__(detail::poly_print(x.get_var()));
828 str_ = s.str();
829}

◆ bvisit() [84/94]

void SymEngine::StrPrinter::bvisit ( const UIntPoly x)

Definition at line 157 of file strprinter.cpp.

788{
789 str_ = upoly_print<UIntPoly>(x);
790}

◆ bvisit() [85/94]

void SymEngine::StrPrinter::bvisit ( const Unequality x)

Definition at line 184 of file strprinter.cpp.

252{
254 s << apply(x.get_arg1()) << " != " << apply(x.get_arg2());
255 str_ = s.str();
256}

◆ bvisit() [86/94]

void SymEngine::LatexPrinter::bvisit ( const Unequality x)

Definition at line 214 of file latex.cpp.

215{
217 s << apply(x.get_arg1()) << " \\neq " << apply(x.get_arg2());
218 str_ = s.str();
219}

◆ bvisit() [87/94]

void SymEngine::StrPrinter::bvisit ( const Union x)

Definition at line 150 of file strprinter.cpp.

409{
411 s << apply(*x.get_container().begin());
412 for (auto it = ++(x.get_container().begin()); it != x.get_container().end();
413 ++it) {
414 s << " U " << apply(*it);
415 }
416 str_ = s.str();
417}

◆ bvisit() [88/94]

void SymEngine::LatexPrinter::bvisit ( const Union x)

Definition at line 388 of file latex.cpp.

389{
391 print_with_args(x, "\\cup", s);
392 str_ = s.str();
393}

◆ bvisit() [89/94]

void SymEngine::StrPrinter::bvisit ( const UnivariateSeries x)

Definition at line 169 of file strprinter.cpp.

832{
834 o << x.get_poly().__str__(x.get_var()) << " + O(" << x.get_var() << "**"
835 << x.get_degree() << ")";
836 str_ = o.str();
837}

◆ bvisit() [90/94]

void SymEngine::StrPrinter::bvisit ( const UniversalSet x)

Definition at line 142 of file strprinter.cpp.

446{
447 str_ = "UniversalSet";
448}

◆ bvisit() [91/94]

void SymEngine::StrPrinter::bvisit ( const URatPoly x)

Definition at line 159 of file strprinter.cpp.

793{
794 str_ = upoly_print<URatPoly>(x);
795}

◆ bvisit() [92/94]

void SymEngine::StrPrinter::bvisit ( const Xor x)

Definition at line 148 of file strprinter.cpp.

323{
325 auto container = x.get_container();
326 s << "Xor(";
327 s << apply(*container.begin());
328 for (auto it = ++(container.begin()); it != container.end(); ++it) {
329 s << ", " << apply(*it);
330 }
331 s << ")";
332 str_ = s.str();
333}

◆ bvisit() [93/94]

void SymEngine::LatexPrinter::bvisit ( const Xor x)

Definition at line 351 of file latex.cpp.

352{
354 auto container = x.get_container();
355 if (is_a<Or>(**container.begin()) or is_a<And>(**container.begin())) {
356 s << parenthesize(apply(*container.begin()));
357 } else {
358 s << apply(*container.begin());
359 }
360
361 for (auto it = ++(container.begin()); it != container.end(); ++it) {
362 s << " \\veebar ";
363 if (is_a<Or>(**it) or is_a<And>(**it)) {
364 s << parenthesize(apply(*it));
365 } else {
366 s << apply(*it);
367 }
368 }
369 str_ = s.str();
370}

◆ bvisit() [94/94]

void SymEngine::StrPrinter::bvisit ( const ZeroMatrix x)

Definition at line 196 of file strprinter.cpp.

1036{
1037 str_ = "0";
1038}

◆ parenthesize()

std::string SymEngine::LatexPrinter::parenthesize ( const std::string expr)
overrideprotectedvirtual

Reimplemented from SymEngine::StrPrinter.

Definition at line 554 of file latex.cpp.

555{
556 return "\\left(" + expr + "\\right)";
557}

◆ print_div()

std::string SymEngine::LatexPrinter::print_div ( const std::string num,
const std::string den,
bool  paren 
)
overrideprotectedvirtual

Reimplemented from SymEngine::StrPrinter.

Definition at line 582 of file latex.cpp.

584{
585 return "\\frac{" + num + "}{" + den + "}";
586}

◆ print_mul()

std::string SymEngine::LatexPrinter::print_mul ( )
overrideprotectedvirtual

Reimplemented from SymEngine::StrPrinter.

Definition at line 477 of file latex.cpp.

478{
479 return " ";
480}

◆ print_with_args()

void SymEngine::LatexPrinter::print_with_args ( const Basic x,
const std::string join,
std::ostringstream s 
)
protected

Definition at line 372 of file latex.cpp.

374{
375 vec_basic v = x.get_args();
376 s << apply(*v.begin());
377
378 for (auto it = ++(v.begin()); it != v.end(); ++it) {
379 s << " " << join << " " << apply(*it);
380 }
381}

◆ split_mul_coef()

bool SymEngine::LatexPrinter::split_mul_coef ( )
overrideprotectedvirtual

Reimplemented from SymEngine::StrPrinter.

Definition at line 482 of file latex.cpp.

483{
484 return true;
485}

Field Documentation

◆ names_

const std::vector<std::string> SymEngine::LatexPrinter::names_
staticprivate

Definition at line 59 of file latex.h.


The documentation for this class was generated from the following files: