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

Public Member Functions

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 EmptySet &x)
 
void bvisit (const UniversalSet &x)
 
void bvisit (const Piecewise &x)
 
void bvisit (const FiniteSet &x)
 
void bvisit (const ConditionSet &x)
 
void bvisit (const Union &x)
 
void bvisit (const Complement &x)
 
void bvisit (const ImageSet &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 Add &x)
 
void bvisit (const Mul &x)
 
void bvisit (const Pow &x)
 
void bvisit (const Infty &x)
 
void bvisit (const NaN &x)
 
void bvisit (const Constant &x)
 
void bvisit (const Abs &x)
 
void bvisit (const Floor &x)
 
void bvisit (const Ceiling &x)
 
void bvisit (const Function &x)
 
void bvisit (const FunctionSymbol &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 Tuple &x)
 
StringBox apply (const RCP< const Basic > &b)
 
StringBox apply (const vec_basic &v)
 
StringBox apply (const Basic &b)
 

Protected Member Functions

StringBox print_mul ()
 
void _print_pow (const RCP< const Basic > &a, const RCP< const Basic > &b)
 
std::string get_imag_symbol ()
 
StringBox parenthesizeLT (const RCP< const Basic > &x, PrecedenceEnum precedenceEnum)
 
StringBox parenthesizeLE (const RCP< const Basic > &x, PrecedenceEnum precedenceEnum)
 

Protected Attributes

StringBox box_
 

Static Private Attributes

static const std::vector< std::stringnames_
 
static const std::vector< size_t > lengths_
 

Detailed Description

Definition at line 10 of file unicode.h.

Member Function Documentation

◆ _print_pow()

void SymEngine::UnicodePrinter::_print_pow ( const RCP< const Basic > &  a,
const RCP< const Basic > &  b 
)
protected

Definition at line 434 of file unicode.cpp.

436{
437 if (eq(*b, *rational(1, 2))) {
438 StringBox box = apply(a);
439 box.enclose_sqrt();
440 box_ = box;
441 } else {
442 StringBox base = parenthesizeLE(a, PrecedenceEnum::Pow);
443 StringBox exp = parenthesizeLE(b, PrecedenceEnum::Pow);
444 base.add_power(exp);
445 box_ = base;
446 }
447}
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
Definition: basic-inl.h:21
RCP< const Basic > exp(const RCP< const Basic > &x)
Returns the natural exponential function E**x = pow(E, x)
Definition: pow.cpp:271
RCP< const Number > rational(long n, long d)
convenience creator from two longs
Definition: rational.h:328

◆ apply() [1/3]

StringBox SymEngine::UnicodePrinter::apply ( const Basic b)

Definition at line 688 of file unicode.cpp.

689{
690 b.accept(*this);
691 return box_;
692}

◆ apply() [2/3]

StringBox SymEngine::UnicodePrinter::apply ( const RCP< const Basic > &  b)

Definition at line 682 of file unicode.cpp.

683{
684 b->accept(*this);
685 return box_;
686}

◆ apply() [3/3]

StringBox SymEngine::UnicodePrinter::apply ( const vec_basic v)

Definition at line 546 of file unicode.cpp.

547{
548 StringBox box("");
549 StringBox comma(", ");
550 for (auto p = d.begin(); p != d.end(); p++) {
551 if (p != d.begin()) {
552 box.add_right(comma);
553 }
554 StringBox arg = apply(*p);
555 box.add_right(arg);
556 }
557 return box;
558}

◆ bvisit() [1/44]

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

Definition at line 560 of file unicode.cpp.

561{
562 StringBox box = apply(*x.get_arg());
563 box.enclose_abs();
564 box_ = box;
565}

◆ bvisit() [2/44]

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

Definition at line 384 of file unicode.cpp.

385{
386 StringBox box;
387 bool first = true;
388 std::map<RCP<const Basic>, RCP<const Number>, PrinterBasicCmp> dict(
389 x.get_dict().begin(), x.get_dict().end());
390
391 if (neq(*(x.get_coef()), *zero)) {
392 box = apply(x.get_coef());
393 first = false;
394 }
395 bool minus = false;
396 for (const auto &p : dict) {
397 StringBox t;
398 if (eq(*(p.second), *one)) {
399 t = parenthesizeLT(p.first, PrecedenceEnum::Add);
400 } else if (eq(*(p.second), *minus_one)) {
401 minus = true;
402 t = parenthesizeLT(p.first, PrecedenceEnum::Mul);
403 } else {
404 if (down_cast<const Number &>(*p.second).is_negative()) {
405 minus = true;
406 }
407 // FIXME: Double minus here
408 t = parenthesizeLT(p.second, PrecedenceEnum::Mul);
409 auto op = print_mul();
410 t.add_right(op);
411 auto rhs = parenthesizeLT(p.first, PrecedenceEnum::Mul);
412 t.add_right(rhs);
413 }
414
415 if (not first) {
416 if (minus) {
417 StringBox op(" - ");
418 box.add_right(op);
419 box.add_right(t);
420 minus = false;
421 } else {
422 StringBox op(" + ");
423 box.add_right(op);
424 box.add_right(t);
425 }
426 } else {
427 box.add_right(t);
428 first = false;
429 }
430 }
431 box_ = box;
432}
bool neq(const Basic &a, const Basic &b)
Checks inequality for a and b
Definition: basic-inl.h:29

◆ bvisit() [3/44]

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

Definition at line 197 of file unicode.cpp.

198{
199 auto container = x.get_container();
200 StringBox box = apply(*container.begin());
201 StringBox op(U8(" \u2227 "), 3);
202 for (auto it = ++(container.begin()); it != container.end(); ++it) {
203 box.add_right(op);
204 StringBox next = apply(*it);
205 box.add_right(next);
206 }
207 box_ = box;
208}
T next(T... args)

◆ bvisit() [4/44]

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

Definition at line 22 of file unicode.cpp.

23{
25 s << U8("<") << typeName<Basic>(x) << U8(" instance at ")
26 << (const void *)this << U8(">");
27 StringBox box(s.str());
28 box_ = box;
29}
T str(T... args)

◆ bvisit() [5/44]

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

Definition at line 188 of file unicode.cpp.

189{
190 if (x.get_val()) {
191 box_ = StringBox("true");
192 } else {
193 box_ = StringBox("false");
194 }
195}

◆ bvisit() [6/44]

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

Definition at line 574 of file unicode.cpp.

575{
576 StringBox box = apply(*x.get_arg());
577 box.enclose_ceiling();
578 box_ = box;
579}

◆ bvisit() [7/44]

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

Definition at line 330 of file unicode.cpp.

331{
332 StringBox box = apply(*x.get_universe());
333 StringBox op(U8(" \\ "));
334 box.add_right(op);
335 StringBox rhs = apply(*x.get_container());
336 box.add_right(rhs);
337 box_ = box;
338}

◆ bvisit() [8/44]

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

Definition at line 70 of file unicode.cpp.

71{
73 bool mul = false;
74 if (x.real_ != 0) {
75 s << x.real_;
76 // Since Complex is in canonical form, imaginary_ is not 0.
77 if (mp_sign(x.imaginary_) == 1) {
78 s << U8(" + ");
79 } else {
80 s << U8(" - ");
81 }
82 // If imaginary_ is not 1 or -1, print the absolute value
83 if (x.imaginary_ != mp_sign(x.imaginary_)) {
84 s << mp_abs(x.imaginary_);
85 s << U8("\u22C5") << get_imag_symbol();
86 mul = true;
87 } else {
88 s << get_imag_symbol();
89 }
90 } else {
91 if (x.imaginary_ != mp_sign(x.imaginary_)) {
92 s << x.imaginary_;
93 s << U8("\u22C5") << get_imag_symbol();
94 mul = true;
95 } else {
96 if (mp_sign(x.imaginary_) == 1) {
97 s << get_imag_symbol();
98 } else {
99 s << U8("-") << get_imag_symbol();
100 }
101 }
102 }
103 std::string str = s.str();
104 std::size_t width = str.length() - 3;
105 if (mul)
106 width--;
107 StringBox box(str, width);
108 box_ = box;
109}
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
Definition: mul.cpp:352

◆ bvisit() [9/44]

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

Definition at line 116 of file unicode.cpp.

117{
118 std::string str = print_double(x.i.real());
119 if (x.i.imag() < 0) {
120 str += U8(" - ") + print_double(-x.i.imag());
121 } else {
122 str += U8(" + ") + print_double(x.i.imag());
123 }
124 auto len = str.length();
125 str += U8("\u22C5") + get_imag_symbol();
126 box_ = StringBox(str, len + 2);
127}

◆ bvisit() [10/44]

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

Definition at line 277 of file unicode.cpp.

278{
279 box_ = StringBox(U8("\u2102"), 1);
280}

◆ bvisit() [11/44]

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

Definition at line 373 of file unicode.cpp.

374{
375 StringBox box = apply(*x.get_symbol());
376 StringBox bar(" | ");
377 box.add_right(bar);
378 StringBox cond = apply(*x.get_condition());
379 box.add_right(cond);
380 box.enclose_curlies();
381 box_ = box;
382}

◆ bvisit() [12/44]

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

Definition at line 529 of file unicode.cpp.

530{
531 // NOTE: Using italics for constants which is very common in mathematics
532 // typesetting. (It goes against the ISO typesetting-standard though.)
533 if (eq(x, *pi)) {
534 box_ = StringBox(U8("\U0001D70B"), 1);
535 } else if (eq(x, *E)) {
536 box_ = StringBox(U8("\U0001D452"), 1);
537 } else if (eq(x, *EulerGamma)) {
538 box_ = StringBox(U8("\U0001D6FE"), 1);
539 } else if (eq(x, *Catalan)) {
540 box_ = StringBox(U8("\U0001D43A"), 1);
541 } else if (eq(x, *GoldenRatio)) {
542 box_ = StringBox(U8("\U0001D719"), 1);
543 }
544}

◆ bvisit() [13/44]

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

Definition at line 245 of file unicode.cpp.

246{
247 StringBox s = apply(x.get_expr());
248 StringBox op(U8(" \u220A "), 3);
249 s.add_right(op);
250 auto right = apply(x.get_set());
251 s.add_right(right);
252 box_ = s;
253}
T right(T... args)

◆ bvisit() [14/44]

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

Definition at line 307 of file unicode.cpp.

308{
309 box_ = StringBox(U8("\u2205"), 1);
310}

◆ bvisit() [15/44]

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

Definition at line 129 of file unicode.cpp.

130{
131 StringBox box = apply(x.get_arg1());
132 StringBox eq(" = ");
133 box.add_right(eq);
134 StringBox rhs = apply(x.get_arg2());
135 box.add_right(rhs);
136 box_ = box;
137}

◆ bvisit() [16/44]

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

Definition at line 355 of file unicode.cpp.

356{
357 StringBox box;
358 StringBox comma(", ");
359 bool first = true;
360 for (const auto &elem : x.get_container()) {
361 if (not first) {
362 box.add_right(comma);
363 } else {
364 first = false;
365 }
366 StringBox arg = apply(elem);
367 box.add_right(arg);
368 }
369 box.enclose_curlies();
370 box_ = box;
371}

◆ bvisit() [17/44]

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

Definition at line 567 of file unicode.cpp.

568{
569 StringBox box = apply(*x.get_arg());
570 box.enclose_floor();
571 box_ = box;
572}

◆ bvisit() [18/44]

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

Definition at line 615 of file unicode.cpp.

616{
617 static const std::vector<std::string> names_ = init_unicode_printer_names();
618 static const std::vector<size_t> lengths_
619 = init_unicode_printer_lengths(names_);
620 StringBox box(names_[x.get_type_code()], lengths_[x.get_type_code()]);
621 vec_basic vec = x.get_args();
622 StringBox args = apply(vec);
623 args.enclose_parens();
624 box.add_right(args);
625 box_ = box;
626}

◆ bvisit() [19/44]

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

Definition at line 628 of file unicode.cpp.

629{
630 StringBox box(x.get_name());
631 StringBox args;
632 StringBox comma(", ");
633 bool first = true;
634 for (auto arg : x.get_args()) {
635 if (first) {
636 first = false;
637 } else {
638 args.add_right(comma);
639 }
640 StringBox argbox = apply(arg);
641 args.add_right(argbox);
642 }
643 args.enclose_parens();
644 box.add_right(args);
645 box_ = box;
646}

◆ bvisit() [20/44]

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

Definition at line 340 of file unicode.cpp.

341{
342 StringBox box = apply(*x.get_expr());
343 StringBox bar(" | ");
344 box.add_right(bar);
345 StringBox symbol = apply(*x.get_symbol());
346 box.add_right(symbol);
347 StringBox in(U8(" \u220A "), 3);
348 box.add_right(in);
349 StringBox base = apply(*x.get_baseset());
350 box.add_right(base);
351 box.enclose_curlies();
352 box_ = box;
353}
RCP< const Symbol > symbol(const std::string &name)
inline version to return Symbol
Definition: symbol.h:82

◆ bvisit() [21/44]

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

Definition at line 36 of file unicode.cpp.

37{
38 if (x.is_negative_infinity())
39 box_ = StringBox(U8("-\u221E"), 2);
40 else if (x.is_positive_infinity())
41 box_ = StringBox(U8("\u221E"), 1);
42 else
43 box_ = StringBox(U8("\U0001D467\u221E"), 2);
44}

◆ bvisit() [22/44]

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

Definition at line 51 of file unicode.cpp.

52{
54 s << x.as_integer_class();
55 box_ = StringBox(s.str());
56}

◆ bvisit() [23/44]

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

Definition at line 292 of file unicode.cpp.

293{
294 box_ = StringBox(U8("\u2124"), 1);
295}

◆ bvisit() [24/44]

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

Definition at line 169 of file unicode.cpp.

170{
171 StringBox box = apply(x.get_start());
172 StringBox comma = StringBox(", ");
173 box.add_right(comma);
174 StringBox end = StringBox(apply(x.get_end()));
175 box.add_right(end);
176 if (x.get_left_open()) {
177 box.add_left_parens();
178 } else {
179 box.add_left_sqbracket();
180 }
181 if (x.get_right_open())
182 box.add_right_parens();
183 else
184 box.add_right_sqbracket();
185 box_ = box;
186}
T end(T... args)

◆ bvisit() [25/44]

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

Definition at line 149 of file unicode.cpp.

150{
151 StringBox box = apply(x.get_arg1());
152 StringBox eq(U8(" \u2264 "), 3);
153 box.add_right(eq);
154 StringBox rhs = apply(x.get_arg2());
155 box.add_right(rhs);
156 box_ = box;
157}

◆ bvisit() [26/44]

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

Definition at line 449 of file unicode.cpp.

450{
451 StringBox box1, box2;
452 bool num = false;
453 unsigned den = 0;
454 StringBox mulbox = print_mul();
455
456 bool first_box1 = true;
457 bool first_box2 = true;
458
459 if (eq(*(x.get_coef()), *minus_one)) {
460 box1 = StringBox("-");
461 } else if (neq(*(x.get_coef()), *one)) {
462 RCP<const Basic> numer, denom;
463 as_numer_denom(x.get_coef(), outArg(numer), outArg(denom));
464 if (neq(*numer, *one)) {
465 num = true;
466 box1 = parenthesizeLT(numer, PrecedenceEnum::Mul);
467 first_box1 = false;
468 }
469 if (neq(*denom, *one)) {
470 den++;
471 box2 = parenthesizeLT(denom, PrecedenceEnum::Mul);
472 first_box2 = false;
473 }
474 }
475
476 for (const auto &p : x.get_dict()) {
477 if ((is_a<Integer>(*p.second) or is_a<Rational>(*p.second))
478 and down_cast<const Number &>(*p.second).is_negative()) {
479 if (not first_box2) {
480 box2.add_right(mulbox);
481 } else {
482 first_box2 = false;
483 }
484 if (eq(*(p.second), *minus_one)) {
485 auto expr = parenthesizeLT(p.first, PrecedenceEnum::Mul);
486 box2.add_right(expr);
487 } else {
488 _print_pow(p.first, neg(p.second));
489 box2.add_right(box_);
490 }
491 den++;
492 } else {
493 if (not first_box1) {
494 box1.add_right(mulbox);
495 } else {
496 first_box1 = false;
497 }
498 if (eq(*(p.second), *one)) {
499 auto expr = parenthesizeLT(p.first, PrecedenceEnum::Mul);
500 box1.add_right(expr);
501 } else {
502 _print_pow(p.first, p.second);
503 box1.add_right(box_);
504 }
505 num = true;
506 }
507 }
508
509 if (not num) {
510 auto onebox = StringBox("1");
511 box1.add_right(onebox);
512 box1.add_right(mulbox);
513 }
514
515 if (den != 0) {
516 if (den > 1) {
517 box2.enclose_parens();
518 }
519 box1.add_below_unicode_line(box2);
520 }
521 box_ = box1;
522}
RCP< const Basic > neg(const RCP< const Basic > &a)
Negation.
Definition: mul.cpp:443

◆ bvisit() [27/44]

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

Definition at line 46 of file unicode.cpp.

47{
48 box_ = StringBox(U8("NaN"));
49}

◆ bvisit() [28/44]

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

Definition at line 297 of file unicode.cpp.

298{
299 box_ = StringBox(U8("\u2115"), 1);
300}

◆ bvisit() [29/44]

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

Definition at line 302 of file unicode.cpp.

303{
304 box_ = StringBox(U8("\u2115\u2080"), 2);
305}

◆ bvisit() [30/44]

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

Definition at line 236 of file unicode.cpp.

237{
238 StringBox box(U8("\u00AC"), 1);
239 StringBox expr = apply(*x.get_arg());
240 expr.enclose_parens();
241 box.add_right(expr);
242 box_ = box;
243}

◆ bvisit() [31/44]

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

Definition at line 210 of file unicode.cpp.

211{
212 auto container = x.get_container();
213 StringBox box = apply(*container.begin());
214 StringBox op(U8(" \u2228 "), 3);
215 for (auto it = ++(container.begin()); it != container.end(); ++it) {
216 box.add_right(op);
217 StringBox next = apply(*it);
218 box.add_right(next);
219 }
220 box_ = box;
221}

◆ bvisit() [32/44]

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

Definition at line 255 of file unicode.cpp.

256{
257 StringBox box;
258
259 auto vec = x.get_vec();
260 auto it = vec.begin();
261 while (true) {
262 StringBox piece = apply((*it).first);
263 StringBox mid(" if ");
264 piece.add_right(mid);
265 StringBox second = apply((*it).second);
266 piece.add_right(second);
267 box.add_below(piece);
268 ++it;
269 if (it == vec.end()) {
270 break;
271 }
272 }
273 box.add_left_curly();
274 box_ = box;
275}

◆ bvisit() [33/44]

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

Definition at line 524 of file unicode.cpp.

525{
526 _print_pow(x.get_base(), x.get_exp());
527}

◆ bvisit() [34/44]

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

Definition at line 58 of file unicode.cpp.

59{
61 num << (*x.get_num()).as_integer_class();
62 StringBox rat(num.str());
64 denom << (*x.get_den()).as_integer_class();
65 StringBox denbox(denom.str());
66 rat.add_below_unicode_line(denbox);
67 box_ = rat;
68}

◆ bvisit() [35/44]

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

Definition at line 287 of file unicode.cpp.

288{
289 box_ = StringBox(U8("\u211A"), 1);
290}

◆ bvisit() [36/44]

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

Definition at line 111 of file unicode.cpp.

112{
113 box_ = StringBox(print_double(x.i));
114}

◆ bvisit() [37/44]

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

Definition at line 282 of file unicode.cpp.

283{
284 box_ = StringBox(U8("\u211D"), 1);
285}

◆ bvisit() [38/44]

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

Definition at line 159 of file unicode.cpp.

160{
161 StringBox box = apply(x.get_arg1());
162 StringBox eq(" < ", 3);
163 box.add_right(eq);
164 StringBox rhs = apply(x.get_arg2());
165 box.add_right(rhs);
166 box_ = box;
167}

◆ bvisit() [39/44]

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

Definition at line 31 of file unicode.cpp.

32{
33 box_ = StringBox(x.get_name());
34}

◆ bvisit() [40/44]

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

Definition at line 648 of file unicode.cpp.

649{
650 vec_basic vec = x.get_args();
651 StringBox args = apply(vec);
652 args.enclose_parens();
653 box_ = args;
654}

◆ bvisit() [41/44]

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

Definition at line 139 of file unicode.cpp.

140{
141 StringBox box = apply(x.get_arg1());
142 StringBox eq(U8(" \u2260 "), 3);
143 box.add_right(eq);
144 StringBox rhs = apply(x.get_arg2());
145 box.add_right(rhs);
146 box_ = box;
147}

◆ bvisit() [42/44]

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

Definition at line 317 of file unicode.cpp.

318{
319 auto container = x.get_container();
320 StringBox box = apply(*container.begin());
321 StringBox op(U8(" \u222A "), 3);
322 for (auto it = ++(container.begin()); it != container.end(); ++it) {
323 box.add_right(op);
324 StringBox next = apply(*it);
325 box.add_right(next);
326 }
327 box_ = box;
328}

◆ bvisit() [43/44]

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

Definition at line 312 of file unicode.cpp.

313{
314 box_ = StringBox(U8("\U0001D54C"), 1);
315}

◆ bvisit() [44/44]

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

Definition at line 223 of file unicode.cpp.

224{
225 auto container = x.get_container();
226 StringBox box = apply(*container.begin());
227 StringBox op(U8(" \u22BB "), 3);
228 for (auto it = ++(container.begin()); it != container.end(); ++it) {
229 box.add_right(op);
230 StringBox next = apply(*it);
231 box.add_right(next);
232 }
233 box_ = box;
234}

◆ get_imag_symbol()

std::string SymEngine::UnicodePrinter::get_imag_symbol ( )
protected

Definition at line 699 of file unicode.cpp.

700{
701 return U8("\U0001D456");
702}

◆ parenthesizeLE()

StringBox SymEngine::UnicodePrinter::parenthesizeLE ( const RCP< const Basic > &  x,
PrecedenceEnum  precedenceEnum 
)
protected

Definition at line 669 of file unicode.cpp.

671{
672 Precedence prec;
673 if (prec.getPrecedence(x) <= precedenceEnum) {
674 auto box = apply(x);
675 box.enclose_parens();
676 return box;
677 } else {
678 return apply(x);
679 }
680}

◆ parenthesizeLT()

StringBox SymEngine::UnicodePrinter::parenthesizeLT ( const RCP< const Basic > &  x,
PrecedenceEnum  precedenceEnum 
)
protected

Definition at line 656 of file unicode.cpp.

658{
659 Precedence prec;
660 if (prec.getPrecedence(x) < precedenceEnum) {
661 auto box = apply(x);
662 box.enclose_parens();
663 return box;
664 } else {
665 return apply(x);
666 }
667}

◆ print_mul()

StringBox SymEngine::UnicodePrinter::print_mul ( )
protected

Definition at line 694 of file unicode.cpp.

695{
696 return StringBox(U8("\u22C5"), 1);
697}

Field Documentation

◆ box_

StringBox SymEngine::UnicodePrinter::box_
protected

Definition at line 17 of file unicode.h.

◆ lengths_

const std::vector<size_t> SymEngine::UnicodePrinter::lengths_
staticprivate

Definition at line 14 of file unicode.h.

◆ names_

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

Definition at line 13 of file unicode.h.


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