Vcsn  2.3
Be Rational
divide.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/dyn/value.hh>
4 
5 namespace vcsn
6 {
7 
8  /*-------------------------.
9  | ldivide(value, value). |
10  `-------------------------*/
11 
13  template <typename ValueSet>
14  typename ValueSet::value_t
15  ldivide(const ValueSet& vs,
16  const typename ValueSet::value_t& lhs,
17  const typename ValueSet::value_t& rhs)
18  {
19  return vs.ldivide(lhs, rhs);
20  }
21 
22 
23  namespace dyn
24  {
25  namespace detail
26  {
28  template <typename ExpressionSetLhs, typename ExpressionSetRhs>
30  ldivide_expression(const expression& lhs, const expression& rhs)
31  {
32  auto join_elts = join<ExpressionSetLhs, ExpressionSetRhs>(lhs, rhs);
33  return {std::get<0>(join_elts), ldivide(std::get<0>(join_elts),
34  std::get<1>(join_elts),
35  std::get<2>(join_elts))};
36  }
37 
39  template <typename PolynomialSetLhs, typename PolynomialSetRhs>
41  ldivide_polynomial(const polynomial& lhs, const polynomial& rhs)
42  {
43  auto join_elts = join<PolynomialSetLhs, PolynomialSetRhs>(lhs, rhs);
44  return {std::get<0>(join_elts), ldivide(std::get<0>(join_elts),
45  std::get<1>(join_elts),
46  std::get<2>(join_elts))};
47  }
48  }
49  }
50 
51  /*--------------------------------.
52  | lgcd(polynomial, polynomial). |
53  `--------------------------------*/
54 
56  template <typename ValueSet>
57  typename ValueSet::value_t
58  lgcd(const ValueSet& vs,
59  const typename ValueSet::value_t& lhs,
60  const typename ValueSet::value_t& rhs)
61  {
62  return vs.lgcd(lhs, rhs);
63  }
64 
65 
66  namespace dyn
67  {
68  namespace detail
69  {
71  template <typename PolynomialSetLhs, typename PolynomialSetRhs>
73  lgcd_polynomial(const polynomial& lhs, const polynomial& rhs)
74  {
75  auto join_elts = join<PolynomialSetLhs, PolynomialSetRhs>(lhs, rhs);
76  return {std::get<0>(join_elts), lgcd(std::get<0>(join_elts),
77  std::get<1>(join_elts),
78  std::get<2>(join_elts))};
79  }
80  }
81  }
82 
83  /*-------------------------.
84  | rdivide(value, value). |
85  `-------------------------*/
86 
88  template <typename ValueSet>
89  typename ValueSet::value_t
90  rdivide(const ValueSet& vs,
91  const typename ValueSet::value_t& lhs,
92  const typename ValueSet::value_t& rhs)
93  {
94  return vs.rdivide(lhs, rhs);
95  }
96 
97  namespace dyn
98  {
99  namespace detail
100  {
102  template <typename ExpressionSetLhs, typename ExpressionSetRhs>
103  expression
104  rdivide_expression(const expression& lhs, const expression& rhs)
105  {
106  auto join_elts = join<ExpressionSetLhs, ExpressionSetRhs>(lhs, rhs);
107  return {std::get<0>(join_elts), rdivide(std::get<0>(join_elts),
108  std::get<1>(join_elts),
109  std::get<2>(join_elts))};
110  }
111  }
112  }
113 }
auto ldivide(const Aut1 &lhs, const Aut2 &rhs, auto_tag={})
Compute the left quotient.
Definition: conjunction.hh:684
polynomial ldivide_polynomial(const polynomial &lhs, const polynomial &rhs)
Bridge (ldivide).
Definition: divide.hh:41
expression ldivide_expression(const expression &lhs, const expression &rhs)
Bridge (ldivide).
Definition: divide.hh:30
automaton rdivide(const automaton &aut1, const automaton &aut2)
Bridge.
Definition: conjunction.hh:763
A dyn Value/ValueSet.
Definition: fwd.hh:23
expression rdivide_expression(const expression &lhs, const expression &rhs)
Bridge (rdivide).
Definition: divide.hh:104
Definition: a-star.hh:8
automaton ldivide(const automaton &aut1, const automaton &aut2)
Bridge (ldivide).
Definition: conjunction.hh:728
value_impl< detail::polynomial_tag > polynomial
Definition: fwd.hh:27
polynomial lgcd_polynomial(const polynomial &lhs, const polynomial &rhs)
Bridge (lgcd).
Definition: divide.hh:73
polynomial lgcd(const polynomial &lhs, const polynomial &rhs)
Left greatest common divisor of two polynomials (lhs \ rhs).
value_impl< detail::expression_tag > expression
Definition: fwd.hh:25