body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
c7ce82f73344293c3eb4d2ab3986d7e6e4d3563baea2c37d878893f53e590d0f
def internal_coproduct(self): "\n Return the inner coproduct of ``self`` in the basis of ``self``.\n\n The inner coproduct (also known as the Kronecker coproduct, as the\n internal coproduct, or as the second comultiplication on the ring of\n symmetric functions) is a ring homomorphism `\\Delta^\\times` from the\n ring of symmetric functions to the tensor product (over the base\n ring) of this ring with itself. It is uniquely characterized by the\n formula\n\n .. MATH::\n\n \\Delta^{\\times}(h_n) = \\sum_{\\lambda \\vdash n} s_{\\lambda}\n \\otimes s_{\\lambda} = \\sum_{\\lambda \\vdash n} h_{\\lambda} \\otimes\n m_{\\lambda} = \\sum_{\\lambda \\vdash n} m_{\\lambda} \\otimes\n h_{\\lambda},\n\n where `\\lambda \\vdash n` means `\\lambda` is a partition of `n`, and\n `n` is any nonnegative integer. It also satisfies\n\n .. MATH::\n\n \\Delta^\\times (p_n) = p_n \\otimes p_n\n\n for any positive integer `n`. If the base ring is a `\\QQ`-algebra, it\n also satisfies\n\n .. MATH::\n\n \\Delta^{\\times}(h_n) = \\sum_{\\lambda \\vdash n} z_{\\lambda}^{-1}\n p_{\\lambda} \\otimes p_{\\lambda},\n\n where\n\n .. MATH::\n\n z_{\\lambda} = \\prod_{i=1}^\\infty i^{m_i(\\lambda)} m_i(\\lambda)!\n\n with `m_i(\\lambda)` meaning the number of appearances of `i`\n in `\\lambda` (see :meth:`~sage.combinat.sf.sfa.zee`).\n\n The method :meth:`kronecker_coproduct` is a synonym of\n :meth:`internal_coproduct`.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(ZZ).s()\n sage: a = s([2,1])\n sage: a.internal_coproduct()\n s[1, 1, 1] # s[2, 1] + s[2, 1] # s[1, 1, 1] + s[2, 1] # s[2, 1] + s[2, 1] # s[3] + s[3] # s[2, 1]\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: b = e([2])\n sage: b.internal_coproduct()\n e[1, 1] # e[2] + e[2] # e[1, 1] - 2*e[2] # e[2]\n\n The internal coproduct is adjoint to the internal product with respect\n to the Hall inner product: Any three symmetric functions `f`, `g` and\n `h` satisfy `\\langle f * g, h \\rangle = \\sum_i \\langle f, h^{\\prime}_i\n \\rangle \\langle g, h^{\\prime\\prime}_i \\rangle`, where we write\n `\\Delta^{\\times}(h)` as `\\sum_i h^{\\prime}_i \\otimes\n h^{\\prime\\prime}_i`. Let us check this in degree `4`::\n\n sage: e = SymmetricFunctions(FiniteField(29)).e()\n sage: s = SymmetricFunctions(FiniteField(29)).s()\n sage: m = SymmetricFunctions(FiniteField(29)).m()\n sage: def tensor_incopr(f, g, h): # computes \\sum_i \\left< f, h'_i \\right> \\left< g, h''_i \\right>\n ....: result = h.base_ring().zero()\n ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items():\n ....: result += coeff * h.parent()(f).scalar(partition_pair[0]) * h.parent()(g).scalar(partition_pair[1])\n ....: return result\n sage: all( all( all( tensor_incopr(e[u], s[v], m[w]) == (e[u].itensor(s[v])).scalar(m[w]) # long time (10s on sage.math, 2013)\n ....: for w in Partitions(5) )\n ....: for v in Partitions(2) )\n ....: for u in Partitions(3) )\n True\n\n Let us check the formulas for `\\Delta^{\\times}(h_n)` and\n `\\Delta^{\\times}(p_n)` given in the description of this method::\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: p = SymmetricFunctions(QQ).p()\n sage: h = SymmetricFunctions(QQ).h()\n sage: s = SymmetricFunctions(QQ).s()\n sage: all( s(h([n])).internal_coproduct() == sum([tensor([s(lam), s(lam)]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n sage: all( factorial(n) * h([n]).internal_coproduct() == sum([lam.conjugacy_class_size() * tensor([h(p(lam)), h(p(lam))]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n\n TESTS::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([]).internal_coproduct()\n s[] # s[]\n " parent = self.parent() h = parent.realization_of().homogeneous() s = parent.realization_of().schur() from sage.categories.tensor import tensor result = tensor([parent.zero(), parent.zero()]) from sage.misc.cachefunc import cached_function @cached_function def hnimage(n): return sum((tensor([parent(s(lam)), parent(s(lam))]) for lam in Partitions(n))) for (lam, a) in h(self).monomial_coefficients().items(): result += (a * prod((hnimage(i) for i in lam))) return result
Return the inner coproduct of ``self`` in the basis of ``self``. The inner coproduct (also known as the Kronecker coproduct, as the internal coproduct, or as the second comultiplication on the ring of symmetric functions) is a ring homomorphism `\Delta^\times` from the ring of symmetric functions to the tensor product (over the base ring) of this ring with itself. It is uniquely characterized by the formula .. MATH:: \Delta^{\times}(h_n) = \sum_{\lambda \vdash n} s_{\lambda} \otimes s_{\lambda} = \sum_{\lambda \vdash n} h_{\lambda} \otimes m_{\lambda} = \sum_{\lambda \vdash n} m_{\lambda} \otimes h_{\lambda}, where `\lambda \vdash n` means `\lambda` is a partition of `n`, and `n` is any nonnegative integer. It also satisfies .. MATH:: \Delta^\times (p_n) = p_n \otimes p_n for any positive integer `n`. If the base ring is a `\QQ`-algebra, it also satisfies .. MATH:: \Delta^{\times}(h_n) = \sum_{\lambda \vdash n} z_{\lambda}^{-1} p_{\lambda} \otimes p_{\lambda}, where .. MATH:: z_{\lambda} = \prod_{i=1}^\infty i^{m_i(\lambda)} m_i(\lambda)! with `m_i(\lambda)` meaning the number of appearances of `i` in `\lambda` (see :meth:`~sage.combinat.sf.sfa.zee`). The method :meth:`kronecker_coproduct` is a synonym of :meth:`internal_coproduct`. EXAMPLES:: sage: s = SymmetricFunctions(ZZ).s() sage: a = s([2,1]) sage: a.internal_coproduct() s[1, 1, 1] # s[2, 1] + s[2, 1] # s[1, 1, 1] + s[2, 1] # s[2, 1] + s[2, 1] # s[3] + s[3] # s[2, 1] sage: e = SymmetricFunctions(QQ).e() sage: b = e([2]) sage: b.internal_coproduct() e[1, 1] # e[2] + e[2] # e[1, 1] - 2*e[2] # e[2] The internal coproduct is adjoint to the internal product with respect to the Hall inner product: Any three symmetric functions `f`, `g` and `h` satisfy `\langle f * g, h \rangle = \sum_i \langle f, h^{\prime}_i \rangle \langle g, h^{\prime\prime}_i \rangle`, where we write `\Delta^{\times}(h)` as `\sum_i h^{\prime}_i \otimes h^{\prime\prime}_i`. Let us check this in degree `4`:: sage: e = SymmetricFunctions(FiniteField(29)).e() sage: s = SymmetricFunctions(FiniteField(29)).s() sage: m = SymmetricFunctions(FiniteField(29)).m() sage: def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ....: result = h.base_ring().zero() ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ....: result += coeff * h.parent()(f).scalar(partition_pair[0]) * h.parent()(g).scalar(partition_pair[1]) ....: return result sage: all( all( all( tensor_incopr(e[u], s[v], m[w]) == (e[u].itensor(s[v])).scalar(m[w]) # long time (10s on sage.math, 2013) ....: for w in Partitions(5) ) ....: for v in Partitions(2) ) ....: for u in Partitions(3) ) True Let us check the formulas for `\Delta^{\times}(h_n)` and `\Delta^{\times}(p_n)` given in the description of this method:: sage: e = SymmetricFunctions(QQ).e() sage: p = SymmetricFunctions(QQ).p() sage: h = SymmetricFunctions(QQ).h() sage: s = SymmetricFunctions(QQ).s() sage: all( s(h([n])).internal_coproduct() == sum([tensor([s(lam), s(lam)]) for lam in Partitions(n)]) ....: for n in range(6) ) True sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)]) ....: for n in range(6) ) True sage: all( factorial(n) * h([n]).internal_coproduct() == sum([lam.conjugacy_class_size() * tensor([h(p(lam)), h(p(lam))]) for lam in Partitions(n)]) ....: for n in range(6) ) True TESTS:: sage: s = SymmetricFunctions(QQ).s() sage: s([]).internal_coproduct() s[] # s[]
src/sage/combinat/sf/sfa.py
internal_coproduct
bopopescu/sagesmc
5
python
def internal_coproduct(self): "\n Return the inner coproduct of ``self`` in the basis of ``self``.\n\n The inner coproduct (also known as the Kronecker coproduct, as the\n internal coproduct, or as the second comultiplication on the ring of\n symmetric functions) is a ring homomorphism `\\Delta^\\times` from the\n ring of symmetric functions to the tensor product (over the base\n ring) of this ring with itself. It is uniquely characterized by the\n formula\n\n .. MATH::\n\n \\Delta^{\\times}(h_n) = \\sum_{\\lambda \\vdash n} s_{\\lambda}\n \\otimes s_{\\lambda} = \\sum_{\\lambda \\vdash n} h_{\\lambda} \\otimes\n m_{\\lambda} = \\sum_{\\lambda \\vdash n} m_{\\lambda} \\otimes\n h_{\\lambda},\n\n where `\\lambda \\vdash n` means `\\lambda` is a partition of `n`, and\n `n` is any nonnegative integer. It also satisfies\n\n .. MATH::\n\n \\Delta^\\times (p_n) = p_n \\otimes p_n\n\n for any positive integer `n`. If the base ring is a `\\QQ`-algebra, it\n also satisfies\n\n .. MATH::\n\n \\Delta^{\\times}(h_n) = \\sum_{\\lambda \\vdash n} z_{\\lambda}^{-1}\n p_{\\lambda} \\otimes p_{\\lambda},\n\n where\n\n .. MATH::\n\n z_{\\lambda} = \\prod_{i=1}^\\infty i^{m_i(\\lambda)} m_i(\\lambda)!\n\n with `m_i(\\lambda)` meaning the number of appearances of `i`\n in `\\lambda` (see :meth:`~sage.combinat.sf.sfa.zee`).\n\n The method :meth:`kronecker_coproduct` is a synonym of\n :meth:`internal_coproduct`.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(ZZ).s()\n sage: a = s([2,1])\n sage: a.internal_coproduct()\n s[1, 1, 1] # s[2, 1] + s[2, 1] # s[1, 1, 1] + s[2, 1] # s[2, 1] + s[2, 1] # s[3] + s[3] # s[2, 1]\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: b = e([2])\n sage: b.internal_coproduct()\n e[1, 1] # e[2] + e[2] # e[1, 1] - 2*e[2] # e[2]\n\n The internal coproduct is adjoint to the internal product with respect\n to the Hall inner product: Any three symmetric functions `f`, `g` and\n `h` satisfy `\\langle f * g, h \\rangle = \\sum_i \\langle f, h^{\\prime}_i\n \\rangle \\langle g, h^{\\prime\\prime}_i \\rangle`, where we write\n `\\Delta^{\\times}(h)` as `\\sum_i h^{\\prime}_i \\otimes\n h^{\\prime\\prime}_i`. Let us check this in degree `4`::\n\n sage: e = SymmetricFunctions(FiniteField(29)).e()\n sage: s = SymmetricFunctions(FiniteField(29)).s()\n sage: m = SymmetricFunctions(FiniteField(29)).m()\n sage: def tensor_incopr(f, g, h): # computes \\sum_i \\left< f, h'_i \\right> \\left< g, h_i \\right>\n ....: result = h.base_ring().zero()\n ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items():\n ....: result += coeff * h.parent()(f).scalar(partition_pair[0]) * h.parent()(g).scalar(partition_pair[1])\n ....: return result\n sage: all( all( all( tensor_incopr(e[u], s[v], m[w]) == (e[u].itensor(s[v])).scalar(m[w]) # long time (10s on sage.math, 2013)\n ....: for w in Partitions(5) )\n ....: for v in Partitions(2) )\n ....: for u in Partitions(3) )\n True\n\n Let us check the formulas for `\\Delta^{\\times}(h_n)` and\n `\\Delta^{\\times}(p_n)` given in the description of this method::\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: p = SymmetricFunctions(QQ).p()\n sage: h = SymmetricFunctions(QQ).h()\n sage: s = SymmetricFunctions(QQ).s()\n sage: all( s(h([n])).internal_coproduct() == sum([tensor([s(lam), s(lam)]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n sage: all( factorial(n) * h([n]).internal_coproduct() == sum([lam.conjugacy_class_size() * tensor([h(p(lam)), h(p(lam))]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n\n TESTS::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([]).internal_coproduct()\n s[] # s[]\n " parent = self.parent() h = parent.realization_of().homogeneous() s = parent.realization_of().schur() from sage.categories.tensor import tensor result = tensor([parent.zero(), parent.zero()]) from sage.misc.cachefunc import cached_function @cached_function def hnimage(n): return sum((tensor([parent(s(lam)), parent(s(lam))]) for lam in Partitions(n))) for (lam, a) in h(self).monomial_coefficients().items(): result += (a * prod((hnimage(i) for i in lam))) return result
def internal_coproduct(self): "\n Return the inner coproduct of ``self`` in the basis of ``self``.\n\n The inner coproduct (also known as the Kronecker coproduct, as the\n internal coproduct, or as the second comultiplication on the ring of\n symmetric functions) is a ring homomorphism `\\Delta^\\times` from the\n ring of symmetric functions to the tensor product (over the base\n ring) of this ring with itself. It is uniquely characterized by the\n formula\n\n .. MATH::\n\n \\Delta^{\\times}(h_n) = \\sum_{\\lambda \\vdash n} s_{\\lambda}\n \\otimes s_{\\lambda} = \\sum_{\\lambda \\vdash n} h_{\\lambda} \\otimes\n m_{\\lambda} = \\sum_{\\lambda \\vdash n} m_{\\lambda} \\otimes\n h_{\\lambda},\n\n where `\\lambda \\vdash n` means `\\lambda` is a partition of `n`, and\n `n` is any nonnegative integer. It also satisfies\n\n .. MATH::\n\n \\Delta^\\times (p_n) = p_n \\otimes p_n\n\n for any positive integer `n`. If the base ring is a `\\QQ`-algebra, it\n also satisfies\n\n .. MATH::\n\n \\Delta^{\\times}(h_n) = \\sum_{\\lambda \\vdash n} z_{\\lambda}^{-1}\n p_{\\lambda} \\otimes p_{\\lambda},\n\n where\n\n .. MATH::\n\n z_{\\lambda} = \\prod_{i=1}^\\infty i^{m_i(\\lambda)} m_i(\\lambda)!\n\n with `m_i(\\lambda)` meaning the number of appearances of `i`\n in `\\lambda` (see :meth:`~sage.combinat.sf.sfa.zee`).\n\n The method :meth:`kronecker_coproduct` is a synonym of\n :meth:`internal_coproduct`.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(ZZ).s()\n sage: a = s([2,1])\n sage: a.internal_coproduct()\n s[1, 1, 1] # s[2, 1] + s[2, 1] # s[1, 1, 1] + s[2, 1] # s[2, 1] + s[2, 1] # s[3] + s[3] # s[2, 1]\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: b = e([2])\n sage: b.internal_coproduct()\n e[1, 1] # e[2] + e[2] # e[1, 1] - 2*e[2] # e[2]\n\n The internal coproduct is adjoint to the internal product with respect\n to the Hall inner product: Any three symmetric functions `f`, `g` and\n `h` satisfy `\\langle f * g, h \\rangle = \\sum_i \\langle f, h^{\\prime}_i\n \\rangle \\langle g, h^{\\prime\\prime}_i \\rangle`, where we write\n `\\Delta^{\\times}(h)` as `\\sum_i h^{\\prime}_i \\otimes\n h^{\\prime\\prime}_i`. Let us check this in degree `4`::\n\n sage: e = SymmetricFunctions(FiniteField(29)).e()\n sage: s = SymmetricFunctions(FiniteField(29)).s()\n sage: m = SymmetricFunctions(FiniteField(29)).m()\n sage: def tensor_incopr(f, g, h): # computes \\sum_i \\left< f, h'_i \\right> \\left< g, h_i \\right>\n ....: result = h.base_ring().zero()\n ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items():\n ....: result += coeff * h.parent()(f).scalar(partition_pair[0]) * h.parent()(g).scalar(partition_pair[1])\n ....: return result\n sage: all( all( all( tensor_incopr(e[u], s[v], m[w]) == (e[u].itensor(s[v])).scalar(m[w]) # long time (10s on sage.math, 2013)\n ....: for w in Partitions(5) )\n ....: for v in Partitions(2) )\n ....: for u in Partitions(3) )\n True\n\n Let us check the formulas for `\\Delta^{\\times}(h_n)` and\n `\\Delta^{\\times}(p_n)` given in the description of this method::\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: p = SymmetricFunctions(QQ).p()\n sage: h = SymmetricFunctions(QQ).h()\n sage: s = SymmetricFunctions(QQ).s()\n sage: all( s(h([n])).internal_coproduct() == sum([tensor([s(lam), s(lam)]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n sage: all( factorial(n) * h([n]).internal_coproduct() == sum([lam.conjugacy_class_size() * tensor([h(p(lam)), h(p(lam))]) for lam in Partitions(n)])\n ....: for n in range(6) )\n True\n\n TESTS::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([]).internal_coproduct()\n s[] # s[]\n " parent = self.parent() h = parent.realization_of().homogeneous() s = parent.realization_of().schur() from sage.categories.tensor import tensor result = tensor([parent.zero(), parent.zero()]) from sage.misc.cachefunc import cached_function @cached_function def hnimage(n): return sum((tensor([parent(s(lam)), parent(s(lam))]) for lam in Partitions(n))) for (lam, a) in h(self).monomial_coefficients().items(): result += (a * prod((hnimage(i) for i in lam))) return result<|docstring|>Return the inner coproduct of ``self`` in the basis of ``self``. The inner coproduct (also known as the Kronecker coproduct, as the internal coproduct, or as the second comultiplication on the ring of symmetric functions) is a ring homomorphism `\Delta^\times` from the ring of symmetric functions to the tensor product (over the base ring) of this ring with itself. It is uniquely characterized by the formula .. MATH:: \Delta^{\times}(h_n) = \sum_{\lambda \vdash n} s_{\lambda} \otimes s_{\lambda} = \sum_{\lambda \vdash n} h_{\lambda} \otimes m_{\lambda} = \sum_{\lambda \vdash n} m_{\lambda} \otimes h_{\lambda}, where `\lambda \vdash n` means `\lambda` is a partition of `n`, and `n` is any nonnegative integer. It also satisfies .. MATH:: \Delta^\times (p_n) = p_n \otimes p_n for any positive integer `n`. If the base ring is a `\QQ`-algebra, it also satisfies .. MATH:: \Delta^{\times}(h_n) = \sum_{\lambda \vdash n} z_{\lambda}^{-1} p_{\lambda} \otimes p_{\lambda}, where .. MATH:: z_{\lambda} = \prod_{i=1}^\infty i^{m_i(\lambda)} m_i(\lambda)! with `m_i(\lambda)` meaning the number of appearances of `i` in `\lambda` (see :meth:`~sage.combinat.sf.sfa.zee`). The method :meth:`kronecker_coproduct` is a synonym of :meth:`internal_coproduct`. EXAMPLES:: sage: s = SymmetricFunctions(ZZ).s() sage: a = s([2,1]) sage: a.internal_coproduct() s[1, 1, 1] # s[2, 1] + s[2, 1] # s[1, 1, 1] + s[2, 1] # s[2, 1] + s[2, 1] # s[3] + s[3] # s[2, 1] sage: e = SymmetricFunctions(QQ).e() sage: b = e([2]) sage: b.internal_coproduct() e[1, 1] # e[2] + e[2] # e[1, 1] - 2*e[2] # e[2] The internal coproduct is adjoint to the internal product with respect to the Hall inner product: Any three symmetric functions `f`, `g` and `h` satisfy `\langle f * g, h \rangle = \sum_i \langle f, h^{\prime}_i \rangle \langle g, h^{\prime\prime}_i \rangle`, where we write `\Delta^{\times}(h)` as `\sum_i h^{\prime}_i \otimes h^{\prime\prime}_i`. Let us check this in degree `4`:: sage: e = SymmetricFunctions(FiniteField(29)).e() sage: s = SymmetricFunctions(FiniteField(29)).s() sage: m = SymmetricFunctions(FiniteField(29)).m() sage: def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ....: result = h.base_ring().zero() ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ....: result += coeff * h.parent()(f).scalar(partition_pair[0]) * h.parent()(g).scalar(partition_pair[1]) ....: return result sage: all( all( all( tensor_incopr(e[u], s[v], m[w]) == (e[u].itensor(s[v])).scalar(m[w]) # long time (10s on sage.math, 2013) ....: for w in Partitions(5) ) ....: for v in Partitions(2) ) ....: for u in Partitions(3) ) True Let us check the formulas for `\Delta^{\times}(h_n)` and `\Delta^{\times}(p_n)` given in the description of this method:: sage: e = SymmetricFunctions(QQ).e() sage: p = SymmetricFunctions(QQ).p() sage: h = SymmetricFunctions(QQ).h() sage: s = SymmetricFunctions(QQ).s() sage: all( s(h([n])).internal_coproduct() == sum([tensor([s(lam), s(lam)]) for lam in Partitions(n)]) ....: for n in range(6) ) True sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)]) ....: for n in range(6) ) True sage: all( factorial(n) * h([n]).internal_coproduct() == sum([lam.conjugacy_class_size() * tensor([h(p(lam)), h(p(lam))]) for lam in Partitions(n)]) ....: for n in range(6) ) True TESTS:: sage: s = SymmetricFunctions(QQ).s() sage: s([]).internal_coproduct() s[] # s[]<|endoftext|>
9b073797d8c5beea515955ce6508e52f929e0baefb65da167cc027a0d4d4e422
def arithmetic_product(self, x): '\n Return the arithmetic product of ``self`` and ``x`` in the\n basis of ``self``.\n\n The arithmetic product is a binary operation `\\boxdot` on the\n ring of symmetric functions which is bilinear in its two\n arguments and satisfies\n\n .. MATH::\n\n p_{\\lambda} \\boxdot p_{\\mu} = \\prod\\limits_{i \\geq 1, j \\geq 1}\n p_{\\mathrm{lcm}(\\lambda_i, \\mu_j)}^{\\mathrm{gcd}(\\lambda_i, \\mu_j)}\n\n for any two partitions `\\lambda = (\\lambda_1, \\lambda_2, \\lambda_3,\n \\dots )` and `\\mu = (\\mu_1, \\mu_2, \\mu_3, \\dots )` (where `p_{\\nu}`\n denotes the power-sum symmetric function indexed by the partition\n `\\nu`, and `p_i` denotes the `i`-th power-sum symmetric function).\n This is enough to define the arithmetic product if the base ring\n is torsion-free as a `\\ZZ`-module; for all other cases the\n arithmetic product is uniquely determined by requiring it to be\n functorial in the base ring. See\n http://mathoverflow.net/questions/138148/ for a discussion of\n this arithmetic product.\n\n If `f` and `g` are two symmetric functions which are homogeneous\n of degrees `a` and `b`, respectively, then `f \\boxdot g` is\n homogeneous of degree `ab`.\n\n The arithmetic product is commutative and associative and has\n unity `e_1 = p_1 = h_1`.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n\n OUTPUT:\n\n Arithmetic product of ``self`` with ``x``; this is a symmetric\n function over the same base ring as ``self``.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([2]).arithmetic_product(s([2]))\n s[1, 1, 1, 1] + 2*s[2, 2] + s[4]\n sage: s([2]).arithmetic_product(s([1,1]))\n s[2, 1, 1] + s[3, 1]\n\n The symmetric function ``e[1]`` is the unity for the arithmetic\n product::\n\n sage: e = SymmetricFunctions(ZZ).e()\n sage: all( e([1]).arithmetic_product(e(q)) == e(q) for q in Partitions(4) )\n True\n\n The arithmetic product is commutative::\n\n sage: e = SymmetricFunctions(FiniteField(19)).e()\n sage: m = SymmetricFunctions(FiniteField(19)).m()\n sage: all( all( e(p).arithmetic_product(m(q)) == m(q).arithmetic_product(e(p)) # long time (26s on sage.math, 2013)\n ....: for q in Partitions(4) )\n ....: for p in Partitions(4) )\n True\n\n .. NOTE::\n\n The currently existing implementation of this function is\n technically unsatisfactory. It distinguishes the case when the\n base ring is a `\\QQ`-algebra (in which case the arithmetic product\n can be easily computed using the power sum basis) from the case\n where it isn\'t. In the latter, it does a computation using\n universal coefficients, again distinguishing the case when it is\n able to compute the "corresponding" basis of the symmetric function\n algebra over `\\QQ` (using the ``corresponding_basis_over`` hack)\n from the case when it isn\'t (in which case it transforms everything\n into the Schur basis, which is slow).\n ' parent = self.parent() if parent.has_coerce_map_from(QQ): from sage.combinat.partition import Partition from sage.rings.arith import gcd, lcm from itertools import product, repeat, chain p = parent.realization_of().power() def f(lam, mu): term_iterable = chain.from_iterable((repeat(lcm(pair), times=gcd(pair)) for pair in product(lam, mu))) term_list = sorted(term_iterable, reverse=True) res = Partition(term_list) return p(res) return parent(p._apply_multi_module_morphism(p(self), p(x), f)) comp_parent = parent comp_self = self corresponding_parent_over_QQ = parent.corresponding_basis_over(QQ) if (corresponding_parent_over_QQ is None): comp_parent = parent.realization_of().schur() comp_self = comp_parent(self) from sage.combinat.sf.sf import SymmetricFunctions corresponding_parent_over_QQ = SymmetricFunctions(QQ).schur() comp_x = comp_parent(x) result = comp_parent.zero() for (lam, a) in comp_self.monomial_coefficients().items(): for (mu, b) in comp_x.monomial_coefficients().items(): lam_star_mu = corresponding_parent_over_QQ(lam).arithmetic_product(corresponding_parent_over_QQ(mu)) for (nu, c) in lam_star_mu.monomial_coefficients().items(): result += (((a * b) * comp_parent.base_ring()(c)) * comp_parent(nu)) return parent(result)
Return the arithmetic product of ``self`` and ``x`` in the basis of ``self``. The arithmetic product is a binary operation `\boxdot` on the ring of symmetric functions which is bilinear in its two arguments and satisfies .. MATH:: p_{\lambda} \boxdot p_{\mu} = \prod\limits_{i \geq 1, j \geq 1} p_{\mathrm{lcm}(\lambda_i, \mu_j)}^{\mathrm{gcd}(\lambda_i, \mu_j)} for any two partitions `\lambda = (\lambda_1, \lambda_2, \lambda_3, \dots )` and `\mu = (\mu_1, \mu_2, \mu_3, \dots )` (where `p_{\nu}` denotes the power-sum symmetric function indexed by the partition `\nu`, and `p_i` denotes the `i`-th power-sum symmetric function). This is enough to define the arithmetic product if the base ring is torsion-free as a `\ZZ`-module; for all other cases the arithmetic product is uniquely determined by requiring it to be functorial in the base ring. See http://mathoverflow.net/questions/138148/ for a discussion of this arithmetic product. If `f` and `g` are two symmetric functions which are homogeneous of degrees `a` and `b`, respectively, then `f \boxdot g` is homogeneous of degree `ab`. The arithmetic product is commutative and associative and has unity `e_1 = p_1 = h_1`. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` OUTPUT: Arithmetic product of ``self`` with ``x``; this is a symmetric function over the same base ring as ``self``. EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s([2]).arithmetic_product(s([2])) s[1, 1, 1, 1] + 2*s[2, 2] + s[4] sage: s([2]).arithmetic_product(s([1,1])) s[2, 1, 1] + s[3, 1] The symmetric function ``e[1]`` is the unity for the arithmetic product:: sage: e = SymmetricFunctions(ZZ).e() sage: all( e([1]).arithmetic_product(e(q)) == e(q) for q in Partitions(4) ) True The arithmetic product is commutative:: sage: e = SymmetricFunctions(FiniteField(19)).e() sage: m = SymmetricFunctions(FiniteField(19)).m() sage: all( all( e(p).arithmetic_product(m(q)) == m(q).arithmetic_product(e(p)) # long time (26s on sage.math, 2013) ....: for q in Partitions(4) ) ....: for p in Partitions(4) ) True .. NOTE:: The currently existing implementation of this function is technically unsatisfactory. It distinguishes the case when the base ring is a `\QQ`-algebra (in which case the arithmetic product can be easily computed using the power sum basis) from the case where it isn't. In the latter, it does a computation using universal coefficients, again distinguishing the case when it is able to compute the "corresponding" basis of the symmetric function algebra over `\QQ` (using the ``corresponding_basis_over`` hack) from the case when it isn't (in which case it transforms everything into the Schur basis, which is slow).
src/sage/combinat/sf/sfa.py
arithmetic_product
bopopescu/sagesmc
5
python
def arithmetic_product(self, x): '\n Return the arithmetic product of ``self`` and ``x`` in the\n basis of ``self``.\n\n The arithmetic product is a binary operation `\\boxdot` on the\n ring of symmetric functions which is bilinear in its two\n arguments and satisfies\n\n .. MATH::\n\n p_{\\lambda} \\boxdot p_{\\mu} = \\prod\\limits_{i \\geq 1, j \\geq 1}\n p_{\\mathrm{lcm}(\\lambda_i, \\mu_j)}^{\\mathrm{gcd}(\\lambda_i, \\mu_j)}\n\n for any two partitions `\\lambda = (\\lambda_1, \\lambda_2, \\lambda_3,\n \\dots )` and `\\mu = (\\mu_1, \\mu_2, \\mu_3, \\dots )` (where `p_{\\nu}`\n denotes the power-sum symmetric function indexed by the partition\n `\\nu`, and `p_i` denotes the `i`-th power-sum symmetric function).\n This is enough to define the arithmetic product if the base ring\n is torsion-free as a `\\ZZ`-module; for all other cases the\n arithmetic product is uniquely determined by requiring it to be\n functorial in the base ring. See\n http://mathoverflow.net/questions/138148/ for a discussion of\n this arithmetic product.\n\n If `f` and `g` are two symmetric functions which are homogeneous\n of degrees `a` and `b`, respectively, then `f \\boxdot g` is\n homogeneous of degree `ab`.\n\n The arithmetic product is commutative and associative and has\n unity `e_1 = p_1 = h_1`.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n\n OUTPUT:\n\n Arithmetic product of ``self`` with ``x``; this is a symmetric\n function over the same base ring as ``self``.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([2]).arithmetic_product(s([2]))\n s[1, 1, 1, 1] + 2*s[2, 2] + s[4]\n sage: s([2]).arithmetic_product(s([1,1]))\n s[2, 1, 1] + s[3, 1]\n\n The symmetric function ``e[1]`` is the unity for the arithmetic\n product::\n\n sage: e = SymmetricFunctions(ZZ).e()\n sage: all( e([1]).arithmetic_product(e(q)) == e(q) for q in Partitions(4) )\n True\n\n The arithmetic product is commutative::\n\n sage: e = SymmetricFunctions(FiniteField(19)).e()\n sage: m = SymmetricFunctions(FiniteField(19)).m()\n sage: all( all( e(p).arithmetic_product(m(q)) == m(q).arithmetic_product(e(p)) # long time (26s on sage.math, 2013)\n ....: for q in Partitions(4) )\n ....: for p in Partitions(4) )\n True\n\n .. NOTE::\n\n The currently existing implementation of this function is\n technically unsatisfactory. It distinguishes the case when the\n base ring is a `\\QQ`-algebra (in which case the arithmetic product\n can be easily computed using the power sum basis) from the case\n where it isn\'t. In the latter, it does a computation using\n universal coefficients, again distinguishing the case when it is\n able to compute the "corresponding" basis of the symmetric function\n algebra over `\\QQ` (using the ``corresponding_basis_over`` hack)\n from the case when it isn\'t (in which case it transforms everything\n into the Schur basis, which is slow).\n ' parent = self.parent() if parent.has_coerce_map_from(QQ): from sage.combinat.partition import Partition from sage.rings.arith import gcd, lcm from itertools import product, repeat, chain p = parent.realization_of().power() def f(lam, mu): term_iterable = chain.from_iterable((repeat(lcm(pair), times=gcd(pair)) for pair in product(lam, mu))) term_list = sorted(term_iterable, reverse=True) res = Partition(term_list) return p(res) return parent(p._apply_multi_module_morphism(p(self), p(x), f)) comp_parent = parent comp_self = self corresponding_parent_over_QQ = parent.corresponding_basis_over(QQ) if (corresponding_parent_over_QQ is None): comp_parent = parent.realization_of().schur() comp_self = comp_parent(self) from sage.combinat.sf.sf import SymmetricFunctions corresponding_parent_over_QQ = SymmetricFunctions(QQ).schur() comp_x = comp_parent(x) result = comp_parent.zero() for (lam, a) in comp_self.monomial_coefficients().items(): for (mu, b) in comp_x.monomial_coefficients().items(): lam_star_mu = corresponding_parent_over_QQ(lam).arithmetic_product(corresponding_parent_over_QQ(mu)) for (nu, c) in lam_star_mu.monomial_coefficients().items(): result += (((a * b) * comp_parent.base_ring()(c)) * comp_parent(nu)) return parent(result)
def arithmetic_product(self, x): '\n Return the arithmetic product of ``self`` and ``x`` in the\n basis of ``self``.\n\n The arithmetic product is a binary operation `\\boxdot` on the\n ring of symmetric functions which is bilinear in its two\n arguments and satisfies\n\n .. MATH::\n\n p_{\\lambda} \\boxdot p_{\\mu} = \\prod\\limits_{i \\geq 1, j \\geq 1}\n p_{\\mathrm{lcm}(\\lambda_i, \\mu_j)}^{\\mathrm{gcd}(\\lambda_i, \\mu_j)}\n\n for any two partitions `\\lambda = (\\lambda_1, \\lambda_2, \\lambda_3,\n \\dots )` and `\\mu = (\\mu_1, \\mu_2, \\mu_3, \\dots )` (where `p_{\\nu}`\n denotes the power-sum symmetric function indexed by the partition\n `\\nu`, and `p_i` denotes the `i`-th power-sum symmetric function).\n This is enough to define the arithmetic product if the base ring\n is torsion-free as a `\\ZZ`-module; for all other cases the\n arithmetic product is uniquely determined by requiring it to be\n functorial in the base ring. See\n http://mathoverflow.net/questions/138148/ for a discussion of\n this arithmetic product.\n\n If `f` and `g` are two symmetric functions which are homogeneous\n of degrees `a` and `b`, respectively, then `f \\boxdot g` is\n homogeneous of degree `ab`.\n\n The arithmetic product is commutative and associative and has\n unity `e_1 = p_1 = h_1`.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n\n OUTPUT:\n\n Arithmetic product of ``self`` with ``x``; this is a symmetric\n function over the same base ring as ``self``.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([2]).arithmetic_product(s([2]))\n s[1, 1, 1, 1] + 2*s[2, 2] + s[4]\n sage: s([2]).arithmetic_product(s([1,1]))\n s[2, 1, 1] + s[3, 1]\n\n The symmetric function ``e[1]`` is the unity for the arithmetic\n product::\n\n sage: e = SymmetricFunctions(ZZ).e()\n sage: all( e([1]).arithmetic_product(e(q)) == e(q) for q in Partitions(4) )\n True\n\n The arithmetic product is commutative::\n\n sage: e = SymmetricFunctions(FiniteField(19)).e()\n sage: m = SymmetricFunctions(FiniteField(19)).m()\n sage: all( all( e(p).arithmetic_product(m(q)) == m(q).arithmetic_product(e(p)) # long time (26s on sage.math, 2013)\n ....: for q in Partitions(4) )\n ....: for p in Partitions(4) )\n True\n\n .. NOTE::\n\n The currently existing implementation of this function is\n technically unsatisfactory. It distinguishes the case when the\n base ring is a `\\QQ`-algebra (in which case the arithmetic product\n can be easily computed using the power sum basis) from the case\n where it isn\'t. In the latter, it does a computation using\n universal coefficients, again distinguishing the case when it is\n able to compute the "corresponding" basis of the symmetric function\n algebra over `\\QQ` (using the ``corresponding_basis_over`` hack)\n from the case when it isn\'t (in which case it transforms everything\n into the Schur basis, which is slow).\n ' parent = self.parent() if parent.has_coerce_map_from(QQ): from sage.combinat.partition import Partition from sage.rings.arith import gcd, lcm from itertools import product, repeat, chain p = parent.realization_of().power() def f(lam, mu): term_iterable = chain.from_iterable((repeat(lcm(pair), times=gcd(pair)) for pair in product(lam, mu))) term_list = sorted(term_iterable, reverse=True) res = Partition(term_list) return p(res) return parent(p._apply_multi_module_morphism(p(self), p(x), f)) comp_parent = parent comp_self = self corresponding_parent_over_QQ = parent.corresponding_basis_over(QQ) if (corresponding_parent_over_QQ is None): comp_parent = parent.realization_of().schur() comp_self = comp_parent(self) from sage.combinat.sf.sf import SymmetricFunctions corresponding_parent_over_QQ = SymmetricFunctions(QQ).schur() comp_x = comp_parent(x) result = comp_parent.zero() for (lam, a) in comp_self.monomial_coefficients().items(): for (mu, b) in comp_x.monomial_coefficients().items(): lam_star_mu = corresponding_parent_over_QQ(lam).arithmetic_product(corresponding_parent_over_QQ(mu)) for (nu, c) in lam_star_mu.monomial_coefficients().items(): result += (((a * b) * comp_parent.base_ring()(c)) * comp_parent(nu)) return parent(result)<|docstring|>Return the arithmetic product of ``self`` and ``x`` in the basis of ``self``. The arithmetic product is a binary operation `\boxdot` on the ring of symmetric functions which is bilinear in its two arguments and satisfies .. MATH:: p_{\lambda} \boxdot p_{\mu} = \prod\limits_{i \geq 1, j \geq 1} p_{\mathrm{lcm}(\lambda_i, \mu_j)}^{\mathrm{gcd}(\lambda_i, \mu_j)} for any two partitions `\lambda = (\lambda_1, \lambda_2, \lambda_3, \dots )` and `\mu = (\mu_1, \mu_2, \mu_3, \dots )` (where `p_{\nu}` denotes the power-sum symmetric function indexed by the partition `\nu`, and `p_i` denotes the `i`-th power-sum symmetric function). This is enough to define the arithmetic product if the base ring is torsion-free as a `\ZZ`-module; for all other cases the arithmetic product is uniquely determined by requiring it to be functorial in the base ring. See http://mathoverflow.net/questions/138148/ for a discussion of this arithmetic product. If `f` and `g` are two symmetric functions which are homogeneous of degrees `a` and `b`, respectively, then `f \boxdot g` is homogeneous of degree `ab`. The arithmetic product is commutative and associative and has unity `e_1 = p_1 = h_1`. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` OUTPUT: Arithmetic product of ``self`` with ``x``; this is a symmetric function over the same base ring as ``self``. EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s([2]).arithmetic_product(s([2])) s[1, 1, 1, 1] + 2*s[2, 2] + s[4] sage: s([2]).arithmetic_product(s([1,1])) s[2, 1, 1] + s[3, 1] The symmetric function ``e[1]`` is the unity for the arithmetic product:: sage: e = SymmetricFunctions(ZZ).e() sage: all( e([1]).arithmetic_product(e(q)) == e(q) for q in Partitions(4) ) True The arithmetic product is commutative:: sage: e = SymmetricFunctions(FiniteField(19)).e() sage: m = SymmetricFunctions(FiniteField(19)).m() sage: all( all( e(p).arithmetic_product(m(q)) == m(q).arithmetic_product(e(p)) # long time (26s on sage.math, 2013) ....: for q in Partitions(4) ) ....: for p in Partitions(4) ) True .. NOTE:: The currently existing implementation of this function is technically unsatisfactory. It distinguishes the case when the base ring is a `\QQ`-algebra (in which case the arithmetic product can be easily computed using the power sum basis) from the case where it isn't. In the latter, it does a computation using universal coefficients, again distinguishing the case when it is able to compute the "corresponding" basis of the symmetric function algebra over `\QQ` (using the ``corresponding_basis_over`` hack) from the case when it isn't (in which case it transforms everything into the Schur basis, which is slow).<|endoftext|>
eae7a1ee7188ae66bccfce0d9ec5d2cf2ce763a565e532087c50c862c90283ab
def nabla(self, q=None, t=None, power=1): "\n Return the value of the nabla operator applied to ``self``.\n\n The eigenvectors of the nabla operator are the Macdonald polynomials in\n the Ht basis.\n\n If the parameter ``power`` is an integer then it calculates\n nabla to that integer. The default value of ``power`` is 1.\n\n INPUT:\n\n - ``q``, ``t`` -- optional parameters (default: ``None``, in which\n case ``q`` and ``t`` are used)\n - ``power`` -- (default: ``1``) an integer indicating how many times to\n apply the operator `\\nabla`. Negative values of ``power``\n indicate powers of `\\nabla^{-1}`.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))\n sage: p = Sym.power()\n sage: p([1,1]).nabla()\n (-1/2*q*t+1/2*q+1/2*t+1/2)*p[1, 1] + (1/2*q*t-1/2*q-1/2*t+1/2)*p[2]\n sage: p([2,1]).nabla(q=1)\n (-t-1)*p[1, 1, 1] + t*p[2, 1]\n sage: p([2]).nabla(q=1)*p([1]).nabla(q=1)\n (-t-1)*p[1, 1, 1] + t*p[2, 1]\n sage: s = Sym.schur()\n sage: s([2,1]).nabla()\n (-q^3*t-q^2*t^2-q*t^3)*s[1, 1, 1] + (-q^2*t-q*t^2)*s[2, 1]\n sage: s([1,1,1]).nabla()\n (q^3+q^2*t+q*t^2+t^3+q*t)*s[1, 1, 1] + (q^2+q*t+t^2+q+t)*s[2, 1] + s[3]\n sage: s([1,1,1]).nabla(t=1)\n (q^3+q^2+2*q+1)*s[1, 1, 1] + (q^2+2*q+2)*s[2, 1] + s[3]\n sage: s(0).nabla()\n 0\n sage: s(1).nabla()\n s[]\n sage: s([2,1]).nabla(power=-1)\n ((-q-t)/(q^2*t^2))*s[2, 1] + ((-q^2-q*t-t^2)/(q^3*t^3))*s[3]\n sage: (s([2])+s([3])).nabla()\n (-q*t)*s[1, 1] + (q^3*t^2+q^2*t^3)*s[1, 1, 1] + q^2*t^2*s[2, 1]\n " parent = self.parent() BR = parent.base_ring() if (q is None): if hasattr(parent, 'q'): q = parent.q else: q = BR(QQ['q'].gen()) if (t is None): if hasattr(parent, 't'): t = parent.t else: t = BR(QQ['t'].gen()) Ht = parent.realization_of().macdonald(q=q, t=t).Ht() return parent(Ht(self).nabla(power=power))
Return the value of the nabla operator applied to ``self``. The eigenvectors of the nabla operator are the Macdonald polynomials in the Ht basis. If the parameter ``power`` is an integer then it calculates nabla to that integer. The default value of ``power`` is 1. INPUT: - ``q``, ``t`` -- optional parameters (default: ``None``, in which case ``q`` and ``t`` are used) - ``power`` -- (default: ``1``) an integer indicating how many times to apply the operator `\nabla`. Negative values of ``power`` indicate powers of `\nabla^{-1}`. EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['q','t'])) sage: p = Sym.power() sage: p([1,1]).nabla() (-1/2*q*t+1/2*q+1/2*t+1/2)*p[1, 1] + (1/2*q*t-1/2*q-1/2*t+1/2)*p[2] sage: p([2,1]).nabla(q=1) (-t-1)*p[1, 1, 1] + t*p[2, 1] sage: p([2]).nabla(q=1)*p([1]).nabla(q=1) (-t-1)*p[1, 1, 1] + t*p[2, 1] sage: s = Sym.schur() sage: s([2,1]).nabla() (-q^3*t-q^2*t^2-q*t^3)*s[1, 1, 1] + (-q^2*t-q*t^2)*s[2, 1] sage: s([1,1,1]).nabla() (q^3+q^2*t+q*t^2+t^3+q*t)*s[1, 1, 1] + (q^2+q*t+t^2+q+t)*s[2, 1] + s[3] sage: s([1,1,1]).nabla(t=1) (q^3+q^2+2*q+1)*s[1, 1, 1] + (q^2+2*q+2)*s[2, 1] + s[3] sage: s(0).nabla() 0 sage: s(1).nabla() s[] sage: s([2,1]).nabla(power=-1) ((-q-t)/(q^2*t^2))*s[2, 1] + ((-q^2-q*t-t^2)/(q^3*t^3))*s[3] sage: (s([2])+s([3])).nabla() (-q*t)*s[1, 1] + (q^3*t^2+q^2*t^3)*s[1, 1, 1] + q^2*t^2*s[2, 1]
src/sage/combinat/sf/sfa.py
nabla
bopopescu/sagesmc
5
python
def nabla(self, q=None, t=None, power=1): "\n Return the value of the nabla operator applied to ``self``.\n\n The eigenvectors of the nabla operator are the Macdonald polynomials in\n the Ht basis.\n\n If the parameter ``power`` is an integer then it calculates\n nabla to that integer. The default value of ``power`` is 1.\n\n INPUT:\n\n - ``q``, ``t`` -- optional parameters (default: ``None``, in which\n case ``q`` and ``t`` are used)\n - ``power`` -- (default: ``1``) an integer indicating how many times to\n apply the operator `\\nabla`. Negative values of ``power``\n indicate powers of `\\nabla^{-1}`.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))\n sage: p = Sym.power()\n sage: p([1,1]).nabla()\n (-1/2*q*t+1/2*q+1/2*t+1/2)*p[1, 1] + (1/2*q*t-1/2*q-1/2*t+1/2)*p[2]\n sage: p([2,1]).nabla(q=1)\n (-t-1)*p[1, 1, 1] + t*p[2, 1]\n sage: p([2]).nabla(q=1)*p([1]).nabla(q=1)\n (-t-1)*p[1, 1, 1] + t*p[2, 1]\n sage: s = Sym.schur()\n sage: s([2,1]).nabla()\n (-q^3*t-q^2*t^2-q*t^3)*s[1, 1, 1] + (-q^2*t-q*t^2)*s[2, 1]\n sage: s([1,1,1]).nabla()\n (q^3+q^2*t+q*t^2+t^3+q*t)*s[1, 1, 1] + (q^2+q*t+t^2+q+t)*s[2, 1] + s[3]\n sage: s([1,1,1]).nabla(t=1)\n (q^3+q^2+2*q+1)*s[1, 1, 1] + (q^2+2*q+2)*s[2, 1] + s[3]\n sage: s(0).nabla()\n 0\n sage: s(1).nabla()\n s[]\n sage: s([2,1]).nabla(power=-1)\n ((-q-t)/(q^2*t^2))*s[2, 1] + ((-q^2-q*t-t^2)/(q^3*t^3))*s[3]\n sage: (s([2])+s([3])).nabla()\n (-q*t)*s[1, 1] + (q^3*t^2+q^2*t^3)*s[1, 1, 1] + q^2*t^2*s[2, 1]\n " parent = self.parent() BR = parent.base_ring() if (q is None): if hasattr(parent, 'q'): q = parent.q else: q = BR(QQ['q'].gen()) if (t is None): if hasattr(parent, 't'): t = parent.t else: t = BR(QQ['t'].gen()) Ht = parent.realization_of().macdonald(q=q, t=t).Ht() return parent(Ht(self).nabla(power=power))
def nabla(self, q=None, t=None, power=1): "\n Return the value of the nabla operator applied to ``self``.\n\n The eigenvectors of the nabla operator are the Macdonald polynomials in\n the Ht basis.\n\n If the parameter ``power`` is an integer then it calculates\n nabla to that integer. The default value of ``power`` is 1.\n\n INPUT:\n\n - ``q``, ``t`` -- optional parameters (default: ``None``, in which\n case ``q`` and ``t`` are used)\n - ``power`` -- (default: ``1``) an integer indicating how many times to\n apply the operator `\\nabla`. Negative values of ``power``\n indicate powers of `\\nabla^{-1}`.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))\n sage: p = Sym.power()\n sage: p([1,1]).nabla()\n (-1/2*q*t+1/2*q+1/2*t+1/2)*p[1, 1] + (1/2*q*t-1/2*q-1/2*t+1/2)*p[2]\n sage: p([2,1]).nabla(q=1)\n (-t-1)*p[1, 1, 1] + t*p[2, 1]\n sage: p([2]).nabla(q=1)*p([1]).nabla(q=1)\n (-t-1)*p[1, 1, 1] + t*p[2, 1]\n sage: s = Sym.schur()\n sage: s([2,1]).nabla()\n (-q^3*t-q^2*t^2-q*t^3)*s[1, 1, 1] + (-q^2*t-q*t^2)*s[2, 1]\n sage: s([1,1,1]).nabla()\n (q^3+q^2*t+q*t^2+t^3+q*t)*s[1, 1, 1] + (q^2+q*t+t^2+q+t)*s[2, 1] + s[3]\n sage: s([1,1,1]).nabla(t=1)\n (q^3+q^2+2*q+1)*s[1, 1, 1] + (q^2+2*q+2)*s[2, 1] + s[3]\n sage: s(0).nabla()\n 0\n sage: s(1).nabla()\n s[]\n sage: s([2,1]).nabla(power=-1)\n ((-q-t)/(q^2*t^2))*s[2, 1] + ((-q^2-q*t-t^2)/(q^3*t^3))*s[3]\n sage: (s([2])+s([3])).nabla()\n (-q*t)*s[1, 1] + (q^3*t^2+q^2*t^3)*s[1, 1, 1] + q^2*t^2*s[2, 1]\n " parent = self.parent() BR = parent.base_ring() if (q is None): if hasattr(parent, 'q'): q = parent.q else: q = BR(QQ['q'].gen()) if (t is None): if hasattr(parent, 't'): t = parent.t else: t = BR(QQ['t'].gen()) Ht = parent.realization_of().macdonald(q=q, t=t).Ht() return parent(Ht(self).nabla(power=power))<|docstring|>Return the value of the nabla operator applied to ``self``. The eigenvectors of the nabla operator are the Macdonald polynomials in the Ht basis. If the parameter ``power`` is an integer then it calculates nabla to that integer. The default value of ``power`` is 1. INPUT: - ``q``, ``t`` -- optional parameters (default: ``None``, in which case ``q`` and ``t`` are used) - ``power`` -- (default: ``1``) an integer indicating how many times to apply the operator `\nabla`. Negative values of ``power`` indicate powers of `\nabla^{-1}`. EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['q','t'])) sage: p = Sym.power() sage: p([1,1]).nabla() (-1/2*q*t+1/2*q+1/2*t+1/2)*p[1, 1] + (1/2*q*t-1/2*q-1/2*t+1/2)*p[2] sage: p([2,1]).nabla(q=1) (-t-1)*p[1, 1, 1] + t*p[2, 1] sage: p([2]).nabla(q=1)*p([1]).nabla(q=1) (-t-1)*p[1, 1, 1] + t*p[2, 1] sage: s = Sym.schur() sage: s([2,1]).nabla() (-q^3*t-q^2*t^2-q*t^3)*s[1, 1, 1] + (-q^2*t-q*t^2)*s[2, 1] sage: s([1,1,1]).nabla() (q^3+q^2*t+q*t^2+t^3+q*t)*s[1, 1, 1] + (q^2+q*t+t^2+q+t)*s[2, 1] + s[3] sage: s([1,1,1]).nabla(t=1) (q^3+q^2+2*q+1)*s[1, 1, 1] + (q^2+2*q+2)*s[2, 1] + s[3] sage: s(0).nabla() 0 sage: s(1).nabla() s[] sage: s([2,1]).nabla(power=-1) ((-q-t)/(q^2*t^2))*s[2, 1] + ((-q^2-q*t-t^2)/(q^3*t^3))*s[3] sage: (s([2])+s([3])).nabla() (-q*t)*s[1, 1] + (q^3*t^2+q^2*t^3)*s[1, 1, 1] + q^2*t^2*s[2, 1]<|endoftext|>
4fc253ea207b8b72b0a814469a2607125ebd97e8a2ad61df0e545db9b7aa867d
def scalar(self, x, zee=None): '\n Return standard scalar product between ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n\n - ``zee`` -- an optional function on partitions giving\n the value for the scalar product between `p_{\\mu}` and `p_{\\mu}`\n (default is to use the standard :meth:`~sage.combinat.sf.sfa.zee` function)\n\n This is the default implementation that converts both ``self`` and\n ``x`` into either Schur functions (if ``zee`` is not specified) or\n power-sum functions (if ``zee`` is specified) and performs the scalar\n product in that basis.\n\n EXAMPLES::\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: h = SymmetricFunctions(QQ).h()\n sage: m = SymmetricFunctions(QQ).m()\n sage: p4 = Partitions(4)\n sage: matrix([ [e(a).scalar(h(b)) for a in p4] for b in p4])\n [ 0 0 0 0 1]\n [ 0 0 0 1 4]\n [ 0 0 1 2 6]\n [ 0 1 2 5 12]\n [ 1 4 6 12 24]\n sage: matrix([ [h(a).scalar(e(b)) for a in p4] for b in p4])\n [ 0 0 0 0 1]\n [ 0 0 0 1 4]\n [ 0 0 1 2 6]\n [ 0 1 2 5 12]\n [ 1 4 6 12 24]\n sage: matrix([ [m(a).scalar(e(b)) for a in p4] for b in p4])\n [-1 2 1 -3 1]\n [ 0 1 0 -2 1]\n [ 0 0 1 -2 1]\n [ 0 0 0 -1 1]\n [ 0 0 0 0 1]\n sage: matrix([ [m(a).scalar(h(b)) for a in p4] for b in p4])\n [1 0 0 0 0]\n [0 1 0 0 0]\n [0 0 1 0 0]\n [0 0 0 1 0]\n [0 0 0 0 1]\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: m(p[3,2]).scalar(p[3,2], zee=lambda mu: 2**mu.length())\n 4\n sage: m(p[3,2]).scalar(p[2,2,1], lambda mu: 1)\n 0\n sage: m[3,2].scalar(h[3,2], zee=lambda mu: 2**mu.length())\n 2/3\n\n TESTS::\n\n sage: m(1).scalar(h(1))\n 1\n sage: m(0).scalar(h(1))\n 0\n sage: m(1).scalar(h(0))\n 0\n sage: m(0).scalar(h(0))\n 0\n\n Over the integers, too (as long as ``zee`` is not set)::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: m = Sym.m()\n sage: m([2]).scalar(m([2]))\n 2\n ' if (zee is None): s = self.parent().realization_of().schur() s_self = s(self) s_x = s(x) return s_self.scalar(s_x) else: p = self.parent().realization_of().power() p_self = p(self) p_x = p(x) return sum((((zee(mu) * p_x.coefficient(mu)) * p_self.coefficient(mu)) for mu in p_self.support()))
Return standard scalar product between ``self`` and ``x``. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``zee`` -- an optional function on partitions giving the value for the scalar product between `p_{\mu}` and `p_{\mu}` (default is to use the standard :meth:`~sage.combinat.sf.sfa.zee` function) This is the default implementation that converts both ``self`` and ``x`` into either Schur functions (if ``zee`` is not specified) or power-sum functions (if ``zee`` is specified) and performs the scalar product in that basis. EXAMPLES:: sage: e = SymmetricFunctions(QQ).e() sage: h = SymmetricFunctions(QQ).h() sage: m = SymmetricFunctions(QQ).m() sage: p4 = Partitions(4) sage: matrix([ [e(a).scalar(h(b)) for a in p4] for b in p4]) [ 0 0 0 0 1] [ 0 0 0 1 4] [ 0 0 1 2 6] [ 0 1 2 5 12] [ 1 4 6 12 24] sage: matrix([ [h(a).scalar(e(b)) for a in p4] for b in p4]) [ 0 0 0 0 1] [ 0 0 0 1 4] [ 0 0 1 2 6] [ 0 1 2 5 12] [ 1 4 6 12 24] sage: matrix([ [m(a).scalar(e(b)) for a in p4] for b in p4]) [-1 2 1 -3 1] [ 0 1 0 -2 1] [ 0 0 1 -2 1] [ 0 0 0 -1 1] [ 0 0 0 0 1] sage: matrix([ [m(a).scalar(h(b)) for a in p4] for b in p4]) [1 0 0 0 0] [0 1 0 0 0] [0 0 1 0 0] [0 0 0 1 0] [0 0 0 0 1] sage: p = SymmetricFunctions(QQ).p() sage: m(p[3,2]).scalar(p[3,2], zee=lambda mu: 2**mu.length()) 4 sage: m(p[3,2]).scalar(p[2,2,1], lambda mu: 1) 0 sage: m[3,2].scalar(h[3,2], zee=lambda mu: 2**mu.length()) 2/3 TESTS:: sage: m(1).scalar(h(1)) 1 sage: m(0).scalar(h(1)) 0 sage: m(1).scalar(h(0)) 0 sage: m(0).scalar(h(0)) 0 Over the integers, too (as long as ``zee`` is not set):: sage: Sym = SymmetricFunctions(ZZ) sage: m = Sym.m() sage: m([2]).scalar(m([2])) 2
src/sage/combinat/sf/sfa.py
scalar
bopopescu/sagesmc
5
python
def scalar(self, x, zee=None): '\n Return standard scalar product between ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n\n - ``zee`` -- an optional function on partitions giving\n the value for the scalar product between `p_{\\mu}` and `p_{\\mu}`\n (default is to use the standard :meth:`~sage.combinat.sf.sfa.zee` function)\n\n This is the default implementation that converts both ``self`` and\n ``x`` into either Schur functions (if ``zee`` is not specified) or\n power-sum functions (if ``zee`` is specified) and performs the scalar\n product in that basis.\n\n EXAMPLES::\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: h = SymmetricFunctions(QQ).h()\n sage: m = SymmetricFunctions(QQ).m()\n sage: p4 = Partitions(4)\n sage: matrix([ [e(a).scalar(h(b)) for a in p4] for b in p4])\n [ 0 0 0 0 1]\n [ 0 0 0 1 4]\n [ 0 0 1 2 6]\n [ 0 1 2 5 12]\n [ 1 4 6 12 24]\n sage: matrix([ [h(a).scalar(e(b)) for a in p4] for b in p4])\n [ 0 0 0 0 1]\n [ 0 0 0 1 4]\n [ 0 0 1 2 6]\n [ 0 1 2 5 12]\n [ 1 4 6 12 24]\n sage: matrix([ [m(a).scalar(e(b)) for a in p4] for b in p4])\n [-1 2 1 -3 1]\n [ 0 1 0 -2 1]\n [ 0 0 1 -2 1]\n [ 0 0 0 -1 1]\n [ 0 0 0 0 1]\n sage: matrix([ [m(a).scalar(h(b)) for a in p4] for b in p4])\n [1 0 0 0 0]\n [0 1 0 0 0]\n [0 0 1 0 0]\n [0 0 0 1 0]\n [0 0 0 0 1]\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: m(p[3,2]).scalar(p[3,2], zee=lambda mu: 2**mu.length())\n 4\n sage: m(p[3,2]).scalar(p[2,2,1], lambda mu: 1)\n 0\n sage: m[3,2].scalar(h[3,2], zee=lambda mu: 2**mu.length())\n 2/3\n\n TESTS::\n\n sage: m(1).scalar(h(1))\n 1\n sage: m(0).scalar(h(1))\n 0\n sage: m(1).scalar(h(0))\n 0\n sage: m(0).scalar(h(0))\n 0\n\n Over the integers, too (as long as ``zee`` is not set)::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: m = Sym.m()\n sage: m([2]).scalar(m([2]))\n 2\n ' if (zee is None): s = self.parent().realization_of().schur() s_self = s(self) s_x = s(x) return s_self.scalar(s_x) else: p = self.parent().realization_of().power() p_self = p(self) p_x = p(x) return sum((((zee(mu) * p_x.coefficient(mu)) * p_self.coefficient(mu)) for mu in p_self.support()))
def scalar(self, x, zee=None): '\n Return standard scalar product between ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n\n - ``zee`` -- an optional function on partitions giving\n the value for the scalar product between `p_{\\mu}` and `p_{\\mu}`\n (default is to use the standard :meth:`~sage.combinat.sf.sfa.zee` function)\n\n This is the default implementation that converts both ``self`` and\n ``x`` into either Schur functions (if ``zee`` is not specified) or\n power-sum functions (if ``zee`` is specified) and performs the scalar\n product in that basis.\n\n EXAMPLES::\n\n sage: e = SymmetricFunctions(QQ).e()\n sage: h = SymmetricFunctions(QQ).h()\n sage: m = SymmetricFunctions(QQ).m()\n sage: p4 = Partitions(4)\n sage: matrix([ [e(a).scalar(h(b)) for a in p4] for b in p4])\n [ 0 0 0 0 1]\n [ 0 0 0 1 4]\n [ 0 0 1 2 6]\n [ 0 1 2 5 12]\n [ 1 4 6 12 24]\n sage: matrix([ [h(a).scalar(e(b)) for a in p4] for b in p4])\n [ 0 0 0 0 1]\n [ 0 0 0 1 4]\n [ 0 0 1 2 6]\n [ 0 1 2 5 12]\n [ 1 4 6 12 24]\n sage: matrix([ [m(a).scalar(e(b)) for a in p4] for b in p4])\n [-1 2 1 -3 1]\n [ 0 1 0 -2 1]\n [ 0 0 1 -2 1]\n [ 0 0 0 -1 1]\n [ 0 0 0 0 1]\n sage: matrix([ [m(a).scalar(h(b)) for a in p4] for b in p4])\n [1 0 0 0 0]\n [0 1 0 0 0]\n [0 0 1 0 0]\n [0 0 0 1 0]\n [0 0 0 0 1]\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: m(p[3,2]).scalar(p[3,2], zee=lambda mu: 2**mu.length())\n 4\n sage: m(p[3,2]).scalar(p[2,2,1], lambda mu: 1)\n 0\n sage: m[3,2].scalar(h[3,2], zee=lambda mu: 2**mu.length())\n 2/3\n\n TESTS::\n\n sage: m(1).scalar(h(1))\n 1\n sage: m(0).scalar(h(1))\n 0\n sage: m(1).scalar(h(0))\n 0\n sage: m(0).scalar(h(0))\n 0\n\n Over the integers, too (as long as ``zee`` is not set)::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: m = Sym.m()\n sage: m([2]).scalar(m([2]))\n 2\n ' if (zee is None): s = self.parent().realization_of().schur() s_self = s(self) s_x = s(x) return s_self.scalar(s_x) else: p = self.parent().realization_of().power() p_self = p(self) p_x = p(x) return sum((((zee(mu) * p_x.coefficient(mu)) * p_self.coefficient(mu)) for mu in p_self.support()))<|docstring|>Return standard scalar product between ``self`` and ``x``. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``zee`` -- an optional function on partitions giving the value for the scalar product between `p_{\mu}` and `p_{\mu}` (default is to use the standard :meth:`~sage.combinat.sf.sfa.zee` function) This is the default implementation that converts both ``self`` and ``x`` into either Schur functions (if ``zee`` is not specified) or power-sum functions (if ``zee`` is specified) and performs the scalar product in that basis. EXAMPLES:: sage: e = SymmetricFunctions(QQ).e() sage: h = SymmetricFunctions(QQ).h() sage: m = SymmetricFunctions(QQ).m() sage: p4 = Partitions(4) sage: matrix([ [e(a).scalar(h(b)) for a in p4] for b in p4]) [ 0 0 0 0 1] [ 0 0 0 1 4] [ 0 0 1 2 6] [ 0 1 2 5 12] [ 1 4 6 12 24] sage: matrix([ [h(a).scalar(e(b)) for a in p4] for b in p4]) [ 0 0 0 0 1] [ 0 0 0 1 4] [ 0 0 1 2 6] [ 0 1 2 5 12] [ 1 4 6 12 24] sage: matrix([ [m(a).scalar(e(b)) for a in p4] for b in p4]) [-1 2 1 -3 1] [ 0 1 0 -2 1] [ 0 0 1 -2 1] [ 0 0 0 -1 1] [ 0 0 0 0 1] sage: matrix([ [m(a).scalar(h(b)) for a in p4] for b in p4]) [1 0 0 0 0] [0 1 0 0 0] [0 0 1 0 0] [0 0 0 1 0] [0 0 0 0 1] sage: p = SymmetricFunctions(QQ).p() sage: m(p[3,2]).scalar(p[3,2], zee=lambda mu: 2**mu.length()) 4 sage: m(p[3,2]).scalar(p[2,2,1], lambda mu: 1) 0 sage: m[3,2].scalar(h[3,2], zee=lambda mu: 2**mu.length()) 2/3 TESTS:: sage: m(1).scalar(h(1)) 1 sage: m(0).scalar(h(1)) 0 sage: m(1).scalar(h(0)) 0 sage: m(0).scalar(h(0)) 0 Over the integers, too (as long as ``zee`` is not set):: sage: Sym = SymmetricFunctions(ZZ) sage: m = Sym.m() sage: m([2]).scalar(m([2])) 2<|endoftext|>
7dc5781ba34711d04a897ce99acb774bd7bd2f63363b14d8019083ac98034acc
def scalar_qt(self, x, q=None, t=None): "\n Returns the `q,t`-deformed standard Hall-Littlewood scalar product of\n ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n - ``q``, ``t`` -- parameters (default: ``None`` in which case ``q``\n and ``t`` are used)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1])\n sage: sp = a.scalar_qt(a); factor(sp)\n (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1)\n sage: sp.parent()\n Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: a.scalar_qt(a,q=0)\n (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1)\n sage: a.scalar_qt(a,t=0)\n -q^3 + 2*q^2 - 2*q + 1\n sage: a.scalar_qt(a,5,7) # q=5 and t=7\n 490/1539\n sage: (x,y) = var('x,y')\n sage: a.scalar_qt(a,q=x,t=y)\n 1/3*(x^3 - 1)/(y^3 - 1) + 2/3*(x - 1)^3/(y - 1)^3\n sage: Rn = QQ['q','t','y','z'].fraction_field()\n sage: (q,t,y,z) = Rn.gens()\n sage: Mac = SymmetricFunctions(Rn).macdonald(q=y,t=z)\n sage: a = Mac._sym.schur()([2,1])\n sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a),q,t))\n (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1)\n sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a)))\n (z - 1)^-3 * (y - 1) * (z^2 + z + 1)^-1 * (y^2*z^2 - y*z^2 + y^2 - 2*y*z + z^2 - y + 1)\n " parent = self.parent() p = parent.realization_of().power() if (t is None): if hasattr(parent, 't'): t = self.parent().t elif (q is None): t = QQ[('q', 't')].gens()[1] else: t = QQ['t'].gen() if (q is None): if hasattr(parent, 'q'): q = parent.q else: q = QQ[('q', 't')].gens()[0] f = (lambda part1, part2: part1.centralizer_size(t=t, q=q)) return p._apply_multi_module_morphism(p(self), p(x), f, orthogonal=True)
Returns the `q,t`-deformed standard Hall-Littlewood scalar product of ``self`` and ``x``. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``q``, ``t`` -- parameters (default: ``None`` in which case ``q`` and ``t`` are used) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) sage: sp = a.scalar_qt(a); factor(sp) (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1) sage: sp.parent() Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field sage: a.scalar_qt(a,q=0) (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1) sage: a.scalar_qt(a,t=0) -q^3 + 2*q^2 - 2*q + 1 sage: a.scalar_qt(a,5,7) # q=5 and t=7 490/1539 sage: (x,y) = var('x,y') sage: a.scalar_qt(a,q=x,t=y) 1/3*(x^3 - 1)/(y^3 - 1) + 2/3*(x - 1)^3/(y - 1)^3 sage: Rn = QQ['q','t','y','z'].fraction_field() sage: (q,t,y,z) = Rn.gens() sage: Mac = SymmetricFunctions(Rn).macdonald(q=y,t=z) sage: a = Mac._sym.schur()([2,1]) sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a),q,t)) (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1) sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a))) (z - 1)^-3 * (y - 1) * (z^2 + z + 1)^-1 * (y^2*z^2 - y*z^2 + y^2 - 2*y*z + z^2 - y + 1)
src/sage/combinat/sf/sfa.py
scalar_qt
bopopescu/sagesmc
5
python
def scalar_qt(self, x, q=None, t=None): "\n Returns the `q,t`-deformed standard Hall-Littlewood scalar product of\n ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n - ``q``, ``t`` -- parameters (default: ``None`` in which case ``q``\n and ``t`` are used)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1])\n sage: sp = a.scalar_qt(a); factor(sp)\n (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1)\n sage: sp.parent()\n Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: a.scalar_qt(a,q=0)\n (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1)\n sage: a.scalar_qt(a,t=0)\n -q^3 + 2*q^2 - 2*q + 1\n sage: a.scalar_qt(a,5,7) # q=5 and t=7\n 490/1539\n sage: (x,y) = var('x,y')\n sage: a.scalar_qt(a,q=x,t=y)\n 1/3*(x^3 - 1)/(y^3 - 1) + 2/3*(x - 1)^3/(y - 1)^3\n sage: Rn = QQ['q','t','y','z'].fraction_field()\n sage: (q,t,y,z) = Rn.gens()\n sage: Mac = SymmetricFunctions(Rn).macdonald(q=y,t=z)\n sage: a = Mac._sym.schur()([2,1])\n sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a),q,t))\n (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1)\n sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a)))\n (z - 1)^-3 * (y - 1) * (z^2 + z + 1)^-1 * (y^2*z^2 - y*z^2 + y^2 - 2*y*z + z^2 - y + 1)\n " parent = self.parent() p = parent.realization_of().power() if (t is None): if hasattr(parent, 't'): t = self.parent().t elif (q is None): t = QQ[('q', 't')].gens()[1] else: t = QQ['t'].gen() if (q is None): if hasattr(parent, 'q'): q = parent.q else: q = QQ[('q', 't')].gens()[0] f = (lambda part1, part2: part1.centralizer_size(t=t, q=q)) return p._apply_multi_module_morphism(p(self), p(x), f, orthogonal=True)
def scalar_qt(self, x, q=None, t=None): "\n Returns the `q,t`-deformed standard Hall-Littlewood scalar product of\n ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n - ``q``, ``t`` -- parameters (default: ``None`` in which case ``q``\n and ``t`` are used)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1])\n sage: sp = a.scalar_qt(a); factor(sp)\n (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1)\n sage: sp.parent()\n Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: a.scalar_qt(a,q=0)\n (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1)\n sage: a.scalar_qt(a,t=0)\n -q^3 + 2*q^2 - 2*q + 1\n sage: a.scalar_qt(a,5,7) # q=5 and t=7\n 490/1539\n sage: (x,y) = var('x,y')\n sage: a.scalar_qt(a,q=x,t=y)\n 1/3*(x^3 - 1)/(y^3 - 1) + 2/3*(x - 1)^3/(y - 1)^3\n sage: Rn = QQ['q','t','y','z'].fraction_field()\n sage: (q,t,y,z) = Rn.gens()\n sage: Mac = SymmetricFunctions(Rn).macdonald(q=y,t=z)\n sage: a = Mac._sym.schur()([2,1])\n sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a),q,t))\n (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1)\n sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a)))\n (z - 1)^-3 * (y - 1) * (z^2 + z + 1)^-1 * (y^2*z^2 - y*z^2 + y^2 - 2*y*z + z^2 - y + 1)\n " parent = self.parent() p = parent.realization_of().power() if (t is None): if hasattr(parent, 't'): t = self.parent().t elif (q is None): t = QQ[('q', 't')].gens()[1] else: t = QQ['t'].gen() if (q is None): if hasattr(parent, 'q'): q = parent.q else: q = QQ[('q', 't')].gens()[0] f = (lambda part1, part2: part1.centralizer_size(t=t, q=q)) return p._apply_multi_module_morphism(p(self), p(x), f, orthogonal=True)<|docstring|>Returns the `q,t`-deformed standard Hall-Littlewood scalar product of ``self`` and ``x``. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``q``, ``t`` -- parameters (default: ``None`` in which case ``q`` and ``t`` are used) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) sage: sp = a.scalar_qt(a); factor(sp) (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1) sage: sp.parent() Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field sage: a.scalar_qt(a,q=0) (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1) sage: a.scalar_qt(a,t=0) -q^3 + 2*q^2 - 2*q + 1 sage: a.scalar_qt(a,5,7) # q=5 and t=7 490/1539 sage: (x,y) = var('x,y') sage: a.scalar_qt(a,q=x,t=y) 1/3*(x^3 - 1)/(y^3 - 1) + 2/3*(x - 1)^3/(y - 1)^3 sage: Rn = QQ['q','t','y','z'].fraction_field() sage: (q,t,y,z) = Rn.gens() sage: Mac = SymmetricFunctions(Rn).macdonald(q=y,t=z) sage: a = Mac._sym.schur()([2,1]) sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a),q,t)) (t - 1)^-3 * (q - 1) * (t^2 + t + 1)^-1 * (q^2*t^2 - q*t^2 + q^2 - 2*q*t + t^2 - q + 1) sage: factor(Mac.P()(a).scalar_qt(Mac.Q()(a))) (z - 1)^-3 * (y - 1) * (z^2 + z + 1)^-1 * (y^2*z^2 - y*z^2 + y^2 - 2*y*z + z^2 - y + 1)<|endoftext|>
185a92258e3e1c6e1b95b36e789d082e071cf8289657630636671986755a50f0
def scalar_t(self, x, t=None): '\n Return the `t`-deformed standard Hall-Littlewood scalar product of\n ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n - ``t`` -- parameter (default: ``None``, in which case ``t`` is used)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1])\n sage: sp = a.scalar_t(a); sp\n (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1)\n sage: sp.parent()\n Fraction Field of Univariate Polynomial Ring in t over Rational Field\n ' return self.scalar_qt(x, q=self.base_ring().zero(), t=t)
Return the `t`-deformed standard Hall-Littlewood scalar product of ``self`` and ``x``. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``t`` -- parameter (default: ``None``, in which case ``t`` is used) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) sage: sp = a.scalar_t(a); sp (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1) sage: sp.parent() Fraction Field of Univariate Polynomial Ring in t over Rational Field
src/sage/combinat/sf/sfa.py
scalar_t
bopopescu/sagesmc
5
python
def scalar_t(self, x, t=None): '\n Return the `t`-deformed standard Hall-Littlewood scalar product of\n ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n - ``t`` -- parameter (default: ``None``, in which case ``t`` is used)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1])\n sage: sp = a.scalar_t(a); sp\n (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1)\n sage: sp.parent()\n Fraction Field of Univariate Polynomial Ring in t over Rational Field\n ' return self.scalar_qt(x, q=self.base_ring().zero(), t=t)
def scalar_t(self, x, t=None): '\n Return the `t`-deformed standard Hall-Littlewood scalar product of\n ``self`` and ``x``.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n - ``t`` -- parameter (default: ``None``, in which case ``t`` is used)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1])\n sage: sp = a.scalar_t(a); sp\n (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1)\n sage: sp.parent()\n Fraction Field of Univariate Polynomial Ring in t over Rational Field\n ' return self.scalar_qt(x, q=self.base_ring().zero(), t=t)<|docstring|>Return the `t`-deformed standard Hall-Littlewood scalar product of ``self`` and ``x``. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``t`` -- parameter (default: ``None``, in which case ``t`` is used) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) sage: sp = a.scalar_t(a); sp (-t^2 - 1)/(t^5 - 2*t^4 + t^3 - t^2 + 2*t - 1) sage: sp.parent() Fraction Field of Univariate Polynomial Ring in t over Rational Field<|endoftext|>
e390b6784cb5771cd1647f80f32084a431ca8ead0ecd6ba5fd628c462cb804cb
def scalar_jack(self, x, t=None): "\n Return the Jack-scalar product beween ``self`` and ``x``.\n\n This scalar product is defined so that the power sum elements\n `p_{\\mu}` are orthogonal and `\\langle p_{\\mu}, p_{\\mu} \\rangle =\n z_{\\mu} t^{\\ell(\\mu)}`, where `\\ell(\\mu)` denotes the length of\n `\\mu`.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n - ``t`` -- an optional parameter (default: ``None`` in which\n case ``t`` is used)\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ['t']).power()\n sage: matrix([[p(mu).scalar_jack(p(nu)) for nu in Partitions(4)] for mu in Partitions(4)])\n [ 4*t 0 0 0 0]\n [ 0 3*t^2 0 0 0]\n [ 0 0 8*t^2 0 0]\n [ 0 0 0 4*t^3 0]\n [ 0 0 0 0 24*t^4]\n sage: matrix([[p(mu).scalar_jack(p(nu),2) for nu in Partitions(4)] for mu in Partitions(4)])\n [ 8 0 0 0 0]\n [ 0 12 0 0 0]\n [ 0 0 32 0 0]\n [ 0 0 0 32 0]\n [ 0 0 0 0 384]\n sage: JQ = SymmetricFunctions(QQ['t'].fraction_field()).jack().Q()\n sage: matrix([[JQ(mu).scalar_jack(JQ(nu)) for nu in Partitions(3)] for mu in Partitions(3)])\n [(2*t^2 + 3*t + 1)/(6*t^3) 0 0]\n [ 0 (t + 2)/(2*t^3 + t^2) 0]\n [ 0 0 6/(t^3 + 3*t^2 + 2*t)]\n " parent = self.parent() if (t is None): if hasattr(parent, 't'): t = self.parent().t else: t = QQ['t'].gen() zee = (lambda part: (part.centralizer_size() * (t ** part.length()))) return self.scalar(x, zee)
Return the Jack-scalar product beween ``self`` and ``x``. This scalar product is defined so that the power sum elements `p_{\mu}` are orthogonal and `\langle p_{\mu}, p_{\mu} \rangle = z_{\mu} t^{\ell(\mu)}`, where `\ell(\mu)` denotes the length of `\mu`. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``t`` -- an optional parameter (default: ``None`` in which case ``t`` is used) EXAMPLES:: sage: p = SymmetricFunctions(QQ['t']).power() sage: matrix([[p(mu).scalar_jack(p(nu)) for nu in Partitions(4)] for mu in Partitions(4)]) [ 4*t 0 0 0 0] [ 0 3*t^2 0 0 0] [ 0 0 8*t^2 0 0] [ 0 0 0 4*t^3 0] [ 0 0 0 0 24*t^4] sage: matrix([[p(mu).scalar_jack(p(nu),2) for nu in Partitions(4)] for mu in Partitions(4)]) [ 8 0 0 0 0] [ 0 12 0 0 0] [ 0 0 32 0 0] [ 0 0 0 32 0] [ 0 0 0 0 384] sage: JQ = SymmetricFunctions(QQ['t'].fraction_field()).jack().Q() sage: matrix([[JQ(mu).scalar_jack(JQ(nu)) for nu in Partitions(3)] for mu in Partitions(3)]) [(2*t^2 + 3*t + 1)/(6*t^3) 0 0] [ 0 (t + 2)/(2*t^3 + t^2) 0] [ 0 0 6/(t^3 + 3*t^2 + 2*t)]
src/sage/combinat/sf/sfa.py
scalar_jack
bopopescu/sagesmc
5
python
def scalar_jack(self, x, t=None): "\n Return the Jack-scalar product beween ``self`` and ``x``.\n\n This scalar product is defined so that the power sum elements\n `p_{\\mu}` are orthogonal and `\\langle p_{\\mu}, p_{\\mu} \\rangle =\n z_{\\mu} t^{\\ell(\\mu)}`, where `\\ell(\\mu)` denotes the length of\n `\\mu`.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n - ``t`` -- an optional parameter (default: ``None`` in which\n case ``t`` is used)\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ['t']).power()\n sage: matrix([[p(mu).scalar_jack(p(nu)) for nu in Partitions(4)] for mu in Partitions(4)])\n [ 4*t 0 0 0 0]\n [ 0 3*t^2 0 0 0]\n [ 0 0 8*t^2 0 0]\n [ 0 0 0 4*t^3 0]\n [ 0 0 0 0 24*t^4]\n sage: matrix([[p(mu).scalar_jack(p(nu),2) for nu in Partitions(4)] for mu in Partitions(4)])\n [ 8 0 0 0 0]\n [ 0 12 0 0 0]\n [ 0 0 32 0 0]\n [ 0 0 0 32 0]\n [ 0 0 0 0 384]\n sage: JQ = SymmetricFunctions(QQ['t'].fraction_field()).jack().Q()\n sage: matrix([[JQ(mu).scalar_jack(JQ(nu)) for nu in Partitions(3)] for mu in Partitions(3)])\n [(2*t^2 + 3*t + 1)/(6*t^3) 0 0]\n [ 0 (t + 2)/(2*t^3 + t^2) 0]\n [ 0 0 6/(t^3 + 3*t^2 + 2*t)]\n " parent = self.parent() if (t is None): if hasattr(parent, 't'): t = self.parent().t else: t = QQ['t'].gen() zee = (lambda part: (part.centralizer_size() * (t ** part.length()))) return self.scalar(x, zee)
def scalar_jack(self, x, t=None): "\n Return the Jack-scalar product beween ``self`` and ``x``.\n\n This scalar product is defined so that the power sum elements\n `p_{\\mu}` are orthogonal and `\\langle p_{\\mu}, p_{\\mu} \\rangle =\n z_{\\mu} t^{\\ell(\\mu)}`, where `\\ell(\\mu)` denotes the length of\n `\\mu`.\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the\n same base ring as ``self``\n - ``t`` -- an optional parameter (default: ``None`` in which\n case ``t`` is used)\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ['t']).power()\n sage: matrix([[p(mu).scalar_jack(p(nu)) for nu in Partitions(4)] for mu in Partitions(4)])\n [ 4*t 0 0 0 0]\n [ 0 3*t^2 0 0 0]\n [ 0 0 8*t^2 0 0]\n [ 0 0 0 4*t^3 0]\n [ 0 0 0 0 24*t^4]\n sage: matrix([[p(mu).scalar_jack(p(nu),2) for nu in Partitions(4)] for mu in Partitions(4)])\n [ 8 0 0 0 0]\n [ 0 12 0 0 0]\n [ 0 0 32 0 0]\n [ 0 0 0 32 0]\n [ 0 0 0 0 384]\n sage: JQ = SymmetricFunctions(QQ['t'].fraction_field()).jack().Q()\n sage: matrix([[JQ(mu).scalar_jack(JQ(nu)) for nu in Partitions(3)] for mu in Partitions(3)])\n [(2*t^2 + 3*t + 1)/(6*t^3) 0 0]\n [ 0 (t + 2)/(2*t^3 + t^2) 0]\n [ 0 0 6/(t^3 + 3*t^2 + 2*t)]\n " parent = self.parent() if (t is None): if hasattr(parent, 't'): t = self.parent().t else: t = QQ['t'].gen() zee = (lambda part: (part.centralizer_size() * (t ** part.length()))) return self.scalar(x, zee)<|docstring|>Return the Jack-scalar product beween ``self`` and ``x``. This scalar product is defined so that the power sum elements `p_{\mu}` are orthogonal and `\langle p_{\mu}, p_{\mu} \rangle = z_{\mu} t^{\ell(\mu)}`, where `\ell(\mu)` denotes the length of `\mu`. INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` - ``t`` -- an optional parameter (default: ``None`` in which case ``t`` is used) EXAMPLES:: sage: p = SymmetricFunctions(QQ['t']).power() sage: matrix([[p(mu).scalar_jack(p(nu)) for nu in Partitions(4)] for mu in Partitions(4)]) [ 4*t 0 0 0 0] [ 0 3*t^2 0 0 0] [ 0 0 8*t^2 0 0] [ 0 0 0 4*t^3 0] [ 0 0 0 0 24*t^4] sage: matrix([[p(mu).scalar_jack(p(nu),2) for nu in Partitions(4)] for mu in Partitions(4)]) [ 8 0 0 0 0] [ 0 12 0 0 0] [ 0 0 32 0 0] [ 0 0 0 32 0] [ 0 0 0 0 384] sage: JQ = SymmetricFunctions(QQ['t'].fraction_field()).jack().Q() sage: matrix([[JQ(mu).scalar_jack(JQ(nu)) for nu in Partitions(3)] for mu in Partitions(3)]) [(2*t^2 + 3*t + 1)/(6*t^3) 0 0] [ 0 (t + 2)/(2*t^3 + t^2) 0] [ 0 0 6/(t^3 + 3*t^2 + 2*t)]<|endoftext|>
655b20f3ea0f2b041723e83ec744a9eea8d5a85619937fd295ec496ccc670b38
def derivative_with_respect_to_p1(self, n=1): "\n Return the symmetric function obtained by taking the derivative of\n ``self`` with respect to the power-sum symmetric function `p_1`\n when the expansion of ``self`` in the power-sum basis is considered\n as a polynomial in `p_k`'s (with `k \\geq 1`).\n\n This is the same as skewing ``self`` by the first power-sum symmetric\n function `p_1`.\n\n INPUT:\n\n - ``n`` -- (default: 1) nonnegative integer which determines\n which power of the derivative is taken\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: a = p([1,1,1])\n sage: a.derivative_with_respect_to_p1()\n 3*p[1, 1]\n sage: a.derivative_with_respect_to_p1(1)\n 3*p[1, 1]\n sage: a.derivative_with_respect_to_p1(2)\n 6*p[1]\n sage: a.derivative_with_respect_to_p1(3)\n 6*p[]\n\n ::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([3]).derivative_with_respect_to_p1()\n s[2]\n sage: s([2,1]).derivative_with_respect_to_p1()\n s[1, 1] + s[2]\n sage: s([1,1,1]).derivative_with_respect_to_p1()\n s[1, 1]\n sage: s(0).derivative_with_respect_to_p1()\n 0\n sage: s(1).derivative_with_respect_to_p1()\n 0\n sage: s([1]).derivative_with_respect_to_p1()\n s[]\n\n Let us check that taking the derivative with respect to ``p[1]``\n is equivalent to skewing by ``p[1]``::\n\n sage: p1 = s([1])\n sage: all( s(lam).derivative_with_respect_to_p1()\n ....: == s(lam).skew_by(p1) for lam in Partitions(4) )\n True\n " p = self.parent().realization_of().power() res = p(self) for i in range(n): res = res._derivative_with_respect_to_p1() return self.parent()(res)
Return the symmetric function obtained by taking the derivative of ``self`` with respect to the power-sum symmetric function `p_1` when the expansion of ``self`` in the power-sum basis is considered as a polynomial in `p_k`'s (with `k \geq 1`). This is the same as skewing ``self`` by the first power-sum symmetric function `p_1`. INPUT: - ``n`` -- (default: 1) nonnegative integer which determines which power of the derivative is taken EXAMPLES:: sage: p = SymmetricFunctions(QQ).p() sage: a = p([1,1,1]) sage: a.derivative_with_respect_to_p1() 3*p[1, 1] sage: a.derivative_with_respect_to_p1(1) 3*p[1, 1] sage: a.derivative_with_respect_to_p1(2) 6*p[1] sage: a.derivative_with_respect_to_p1(3) 6*p[] :: sage: s = SymmetricFunctions(QQ).s() sage: s([3]).derivative_with_respect_to_p1() s[2] sage: s([2,1]).derivative_with_respect_to_p1() s[1, 1] + s[2] sage: s([1,1,1]).derivative_with_respect_to_p1() s[1, 1] sage: s(0).derivative_with_respect_to_p1() 0 sage: s(1).derivative_with_respect_to_p1() 0 sage: s([1]).derivative_with_respect_to_p1() s[] Let us check that taking the derivative with respect to ``p[1]`` is equivalent to skewing by ``p[1]``:: sage: p1 = s([1]) sage: all( s(lam).derivative_with_respect_to_p1() ....: == s(lam).skew_by(p1) for lam in Partitions(4) ) True
src/sage/combinat/sf/sfa.py
derivative_with_respect_to_p1
bopopescu/sagesmc
5
python
def derivative_with_respect_to_p1(self, n=1): "\n Return the symmetric function obtained by taking the derivative of\n ``self`` with respect to the power-sum symmetric function `p_1`\n when the expansion of ``self`` in the power-sum basis is considered\n as a polynomial in `p_k`'s (with `k \\geq 1`).\n\n This is the same as skewing ``self`` by the first power-sum symmetric\n function `p_1`.\n\n INPUT:\n\n - ``n`` -- (default: 1) nonnegative integer which determines\n which power of the derivative is taken\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: a = p([1,1,1])\n sage: a.derivative_with_respect_to_p1()\n 3*p[1, 1]\n sage: a.derivative_with_respect_to_p1(1)\n 3*p[1, 1]\n sage: a.derivative_with_respect_to_p1(2)\n 6*p[1]\n sage: a.derivative_with_respect_to_p1(3)\n 6*p[]\n\n ::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([3]).derivative_with_respect_to_p1()\n s[2]\n sage: s([2,1]).derivative_with_respect_to_p1()\n s[1, 1] + s[2]\n sage: s([1,1,1]).derivative_with_respect_to_p1()\n s[1, 1]\n sage: s(0).derivative_with_respect_to_p1()\n 0\n sage: s(1).derivative_with_respect_to_p1()\n 0\n sage: s([1]).derivative_with_respect_to_p1()\n s[]\n\n Let us check that taking the derivative with respect to ``p[1]``\n is equivalent to skewing by ``p[1]``::\n\n sage: p1 = s([1])\n sage: all( s(lam).derivative_with_respect_to_p1()\n ....: == s(lam).skew_by(p1) for lam in Partitions(4) )\n True\n " p = self.parent().realization_of().power() res = p(self) for i in range(n): res = res._derivative_with_respect_to_p1() return self.parent()(res)
def derivative_with_respect_to_p1(self, n=1): "\n Return the symmetric function obtained by taking the derivative of\n ``self`` with respect to the power-sum symmetric function `p_1`\n when the expansion of ``self`` in the power-sum basis is considered\n as a polynomial in `p_k`'s (with `k \\geq 1`).\n\n This is the same as skewing ``self`` by the first power-sum symmetric\n function `p_1`.\n\n INPUT:\n\n - ``n`` -- (default: 1) nonnegative integer which determines\n which power of the derivative is taken\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: a = p([1,1,1])\n sage: a.derivative_with_respect_to_p1()\n 3*p[1, 1]\n sage: a.derivative_with_respect_to_p1(1)\n 3*p[1, 1]\n sage: a.derivative_with_respect_to_p1(2)\n 6*p[1]\n sage: a.derivative_with_respect_to_p1(3)\n 6*p[]\n\n ::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([3]).derivative_with_respect_to_p1()\n s[2]\n sage: s([2,1]).derivative_with_respect_to_p1()\n s[1, 1] + s[2]\n sage: s([1,1,1]).derivative_with_respect_to_p1()\n s[1, 1]\n sage: s(0).derivative_with_respect_to_p1()\n 0\n sage: s(1).derivative_with_respect_to_p1()\n 0\n sage: s([1]).derivative_with_respect_to_p1()\n s[]\n\n Let us check that taking the derivative with respect to ``p[1]``\n is equivalent to skewing by ``p[1]``::\n\n sage: p1 = s([1])\n sage: all( s(lam).derivative_with_respect_to_p1()\n ....: == s(lam).skew_by(p1) for lam in Partitions(4) )\n True\n " p = self.parent().realization_of().power() res = p(self) for i in range(n): res = res._derivative_with_respect_to_p1() return self.parent()(res)<|docstring|>Return the symmetric function obtained by taking the derivative of ``self`` with respect to the power-sum symmetric function `p_1` when the expansion of ``self`` in the power-sum basis is considered as a polynomial in `p_k`'s (with `k \geq 1`). This is the same as skewing ``self`` by the first power-sum symmetric function `p_1`. INPUT: - ``n`` -- (default: 1) nonnegative integer which determines which power of the derivative is taken EXAMPLES:: sage: p = SymmetricFunctions(QQ).p() sage: a = p([1,1,1]) sage: a.derivative_with_respect_to_p1() 3*p[1, 1] sage: a.derivative_with_respect_to_p1(1) 3*p[1, 1] sage: a.derivative_with_respect_to_p1(2) 6*p[1] sage: a.derivative_with_respect_to_p1(3) 6*p[] :: sage: s = SymmetricFunctions(QQ).s() sage: s([3]).derivative_with_respect_to_p1() s[2] sage: s([2,1]).derivative_with_respect_to_p1() s[1, 1] + s[2] sage: s([1,1,1]).derivative_with_respect_to_p1() s[1, 1] sage: s(0).derivative_with_respect_to_p1() 0 sage: s(1).derivative_with_respect_to_p1() 0 sage: s([1]).derivative_with_respect_to_p1() s[] Let us check that taking the derivative with respect to ``p[1]`` is equivalent to skewing by ``p[1]``:: sage: p1 = s([1]) sage: all( s(lam).derivative_with_respect_to_p1() ....: == s(lam).skew_by(p1) for lam in Partitions(4) ) True<|endoftext|>
8be38db63656c992d2f159bfae00a5624f3a328fdba2db41badfed0de6f353cf
def frobenius(self, n): '\n Return the image of the symmetric function ``self`` under the\n `n`-th Frobenius operator.\n\n The `n`-th Frobenius operator `\\mathbf{f}_n` is defined to be the\n map from the ring of symmetric functions to itself that sends\n every symmetric function `P(x_1, x_2, x_3, \\ldots)` to\n `P(x_1^n, x_2^n, x_3^n, \\ldots)`. This operator `\\mathbf{f}_n`\n is a Hopf algebra endomorphism, and satisfies\n\n .. MATH::\n\n \\mathbf{f}_n m_{(\\lambda_1, \\lambda_2, \\lambda_3, \\ldots)} =\n m_{(n\\lambda_1, n\\lambda_2, n\\lambda_3, \\ldots)}\n\n for every partition `(\\lambda_1, \\lambda_2, \\lambda_3, \\ldots)`\n (where `m` means the monomial basis). Moreover,\n `\\mathbf{f}_n (p_r) = p_{nr}` for every positive integer `r` (where\n `p_k` denotes the `k`-th powersum symmetric function).\n\n The `n`-th Frobenius operator is also called the `n`-th\n Frobenius endomorphism. It is not related to the Frobenius map\n which connects the ring of symmetric functions with the\n representation theory of the symmetric group.\n\n The `n`-th Frobenius operator is also the `n`-th Adams operator\n of the `\\Lambda`-ring of symmetric functions over the integers.\n\n The `n`-th Frobenius operator can also be described via plethysm:\n Every symmetric function `P` satisfies\n `\\mathbf{f}_n(P) = p_n \\circ P = P \\circ p_n`,\n where `p_n` is the `n`-th powersum symmetric function, and `\\circ`\n denotes (outer) plethysm.\n\n :meth:`adams_operation` serves as alias for :meth:`frobenius`, since the\n Frobenius operators are the Adams operations of the `\\Lambda`-ring\n of symmetric functions.\n\n INPUT:\n\n - ``n`` -- a positive integer\n\n OUTPUT:\n\n The result of applying the `n`-th Frobenius operator (on the ring of\n symmetric functions) to ``self``.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: h = Sym.h()\n sage: s = Sym.s()\n sage: m = Sym.m()\n sage: s[3].frobenius(2)\n -s[3, 3] + s[4, 2] - s[5, 1] + s[6]\n sage: m[4,2,1].frobenius(3)\n m[12, 6, 3]\n sage: p[4,2,1].frobenius(3)\n p[12, 6, 3]\n sage: h[4].frobenius(2)\n h[4, 4] - 2*h[5, 3] + 2*h[6, 2] - 2*h[7, 1] + 2*h[8]\n\n The Frobenius endomorphisms are multiplicative::\n\n sage: all( all( s(lam).frobenius(3) * s(mu).frobenius(3)\n ....: == (s(lam) * s(mu)).frobenius(3)\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(3) )\n True\n sage: all( all( m(lam).frobenius(2) * m(mu).frobenius(2)\n ....: == (m(lam) * m(mu)).frobenius(2)\n ....: for mu in Partitions(4) )\n ....: for lam in Partitions(4) )\n True\n sage: all( all( p(lam).frobenius(2) * p(mu).frobenius(2)\n ....: == (p(lam) * p(mu)).frobenius(2)\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(4) )\n True\n\n Being Hopf algebra endomorphisms, the Frobenius operators\n commute with the antipode::\n\n sage: all( p(lam).frobenius(4).antipode()\n ....: == p(lam).antipode().frobenius(4)\n ....: for lam in Partitions(3) )\n True\n\n Testing the `\\mathbf{f}_n(P) = p_n \\circ P = P \\circ p_n`\n equality (over `\\QQ`, since plethysm is currently not\n defined over `\\ZZ` in Sage)::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: s = Sym.s()\n sage: p = Sym.p()\n sage: all( s(lam).frobenius(3) == s(lam).plethysm(p[3])\n ....: == s(p[3].plethysm(s(lam)))\n ....: for lam in Partitions(4) )\n True\n\n By Exercise 7.61 in Stanley\'s EC2 [STA]_ (see the errata on his\n website), `\\mathbf{f}_n(h_m)` is a linear combination of\n Schur polynomials (of straight shapes) using coefficients `0`,\n `1` and `-1` only; moreover, all partitions whose Schur\n polynomials occur with coefficient `\\neq 0` in this\n combination have empty `n`-cores. Let us check this on\n examples::\n\n sage: all( all( all( (coeff == -1 or coeff == 1)\n ....: and lam.core(n) == Partition([])\n ....: for lam, coeff in s([m]).frobenius(n).monomial_coefficients().items() )\n ....: for n in range(2, 4) )\n ....: for m in range(4) )\n True\n\n .. SEEALSO::\n\n :meth:`plethysm`\n\n .. TODO::\n\n This method is fast on the monomial and the powersum\n bases, while all other bases get converted to the\n monomial basis. For most bases, this is probably the\n quickest way to do, but at least the Schur basis should\n have a better option. (Quoting from Stanley\'s EC2 [STA]_:\n "D. G. Duncan, J. London Math. Soc. 27 (1952), 235-236,\n or Y. M. Chen, A. M. Garsia, and J. B. Remmel, Contemp.\n Math. 34 (1984), 109-153".)\n ' parent = self.parent() m = parent.realization_of().monomial() from sage.combinat.partition import Partition dct = {Partition(map((lambda i: (n * i)), lam)): coeff for (lam, coeff) in m(self).monomial_coefficients().items()} result_in_m_basis = m._from_dict(dct) return parent(result_in_m_basis)
Return the image of the symmetric function ``self`` under the `n`-th Frobenius operator. The `n`-th Frobenius operator `\mathbf{f}_n` is defined to be the map from the ring of symmetric functions to itself that sends every symmetric function `P(x_1, x_2, x_3, \ldots)` to `P(x_1^n, x_2^n, x_3^n, \ldots)`. This operator `\mathbf{f}_n` is a Hopf algebra endomorphism, and satisfies .. MATH:: \mathbf{f}_n m_{(\lambda_1, \lambda_2, \lambda_3, \ldots)} = m_{(n\lambda_1, n\lambda_2, n\lambda_3, \ldots)} for every partition `(\lambda_1, \lambda_2, \lambda_3, \ldots)` (where `m` means the monomial basis). Moreover, `\mathbf{f}_n (p_r) = p_{nr}` for every positive integer `r` (where `p_k` denotes the `k`-th powersum symmetric function). The `n`-th Frobenius operator is also called the `n`-th Frobenius endomorphism. It is not related to the Frobenius map which connects the ring of symmetric functions with the representation theory of the symmetric group. The `n`-th Frobenius operator is also the `n`-th Adams operator of the `\Lambda`-ring of symmetric functions over the integers. The `n`-th Frobenius operator can also be described via plethysm: Every symmetric function `P` satisfies `\mathbf{f}_n(P) = p_n \circ P = P \circ p_n`, where `p_n` is the `n`-th powersum symmetric function, and `\circ` denotes (outer) plethysm. :meth:`adams_operation` serves as alias for :meth:`frobenius`, since the Frobenius operators are the Adams operations of the `\Lambda`-ring of symmetric functions. INPUT: - ``n`` -- a positive integer OUTPUT: The result of applying the `n`-th Frobenius operator (on the ring of symmetric functions) to ``self``. EXAMPLES:: sage: Sym = SymmetricFunctions(ZZ) sage: p = Sym.p() sage: h = Sym.h() sage: s = Sym.s() sage: m = Sym.m() sage: s[3].frobenius(2) -s[3, 3] + s[4, 2] - s[5, 1] + s[6] sage: m[4,2,1].frobenius(3) m[12, 6, 3] sage: p[4,2,1].frobenius(3) p[12, 6, 3] sage: h[4].frobenius(2) h[4, 4] - 2*h[5, 3] + 2*h[6, 2] - 2*h[7, 1] + 2*h[8] The Frobenius endomorphisms are multiplicative:: sage: all( all( s(lam).frobenius(3) * s(mu).frobenius(3) ....: == (s(lam) * s(mu)).frobenius(3) ....: for mu in Partitions(3) ) ....: for lam in Partitions(3) ) True sage: all( all( m(lam).frobenius(2) * m(mu).frobenius(2) ....: == (m(lam) * m(mu)).frobenius(2) ....: for mu in Partitions(4) ) ....: for lam in Partitions(4) ) True sage: all( all( p(lam).frobenius(2) * p(mu).frobenius(2) ....: == (p(lam) * p(mu)).frobenius(2) ....: for mu in Partitions(3) ) ....: for lam in Partitions(4) ) True Being Hopf algebra endomorphisms, the Frobenius operators commute with the antipode:: sage: all( p(lam).frobenius(4).antipode() ....: == p(lam).antipode().frobenius(4) ....: for lam in Partitions(3) ) True Testing the `\mathbf{f}_n(P) = p_n \circ P = P \circ p_n` equality (over `\QQ`, since plethysm is currently not defined over `\ZZ` in Sage):: sage: Sym = SymmetricFunctions(QQ) sage: s = Sym.s() sage: p = Sym.p() sage: all( s(lam).frobenius(3) == s(lam).plethysm(p[3]) ....: == s(p[3].plethysm(s(lam))) ....: for lam in Partitions(4) ) True By Exercise 7.61 in Stanley's EC2 [STA]_ (see the errata on his website), `\mathbf{f}_n(h_m)` is a linear combination of Schur polynomials (of straight shapes) using coefficients `0`, `1` and `-1` only; moreover, all partitions whose Schur polynomials occur with coefficient `\neq 0` in this combination have empty `n`-cores. Let us check this on examples:: sage: all( all( all( (coeff == -1 or coeff == 1) ....: and lam.core(n) == Partition([]) ....: for lam, coeff in s([m]).frobenius(n).monomial_coefficients().items() ) ....: for n in range(2, 4) ) ....: for m in range(4) ) True .. SEEALSO:: :meth:`plethysm` .. TODO:: This method is fast on the monomial and the powersum bases, while all other bases get converted to the monomial basis. For most bases, this is probably the quickest way to do, but at least the Schur basis should have a better option. (Quoting from Stanley's EC2 [STA]_: "D. G. Duncan, J. London Math. Soc. 27 (1952), 235-236, or Y. M. Chen, A. M. Garsia, and J. B. Remmel, Contemp. Math. 34 (1984), 109-153".)
src/sage/combinat/sf/sfa.py
frobenius
bopopescu/sagesmc
5
python
def frobenius(self, n): '\n Return the image of the symmetric function ``self`` under the\n `n`-th Frobenius operator.\n\n The `n`-th Frobenius operator `\\mathbf{f}_n` is defined to be the\n map from the ring of symmetric functions to itself that sends\n every symmetric function `P(x_1, x_2, x_3, \\ldots)` to\n `P(x_1^n, x_2^n, x_3^n, \\ldots)`. This operator `\\mathbf{f}_n`\n is a Hopf algebra endomorphism, and satisfies\n\n .. MATH::\n\n \\mathbf{f}_n m_{(\\lambda_1, \\lambda_2, \\lambda_3, \\ldots)} =\n m_{(n\\lambda_1, n\\lambda_2, n\\lambda_3, \\ldots)}\n\n for every partition `(\\lambda_1, \\lambda_2, \\lambda_3, \\ldots)`\n (where `m` means the monomial basis). Moreover,\n `\\mathbf{f}_n (p_r) = p_{nr}` for every positive integer `r` (where\n `p_k` denotes the `k`-th powersum symmetric function).\n\n The `n`-th Frobenius operator is also called the `n`-th\n Frobenius endomorphism. It is not related to the Frobenius map\n which connects the ring of symmetric functions with the\n representation theory of the symmetric group.\n\n The `n`-th Frobenius operator is also the `n`-th Adams operator\n of the `\\Lambda`-ring of symmetric functions over the integers.\n\n The `n`-th Frobenius operator can also be described via plethysm:\n Every symmetric function `P` satisfies\n `\\mathbf{f}_n(P) = p_n \\circ P = P \\circ p_n`,\n where `p_n` is the `n`-th powersum symmetric function, and `\\circ`\n denotes (outer) plethysm.\n\n :meth:`adams_operation` serves as alias for :meth:`frobenius`, since the\n Frobenius operators are the Adams operations of the `\\Lambda`-ring\n of symmetric functions.\n\n INPUT:\n\n - ``n`` -- a positive integer\n\n OUTPUT:\n\n The result of applying the `n`-th Frobenius operator (on the ring of\n symmetric functions) to ``self``.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: h = Sym.h()\n sage: s = Sym.s()\n sage: m = Sym.m()\n sage: s[3].frobenius(2)\n -s[3, 3] + s[4, 2] - s[5, 1] + s[6]\n sage: m[4,2,1].frobenius(3)\n m[12, 6, 3]\n sage: p[4,2,1].frobenius(3)\n p[12, 6, 3]\n sage: h[4].frobenius(2)\n h[4, 4] - 2*h[5, 3] + 2*h[6, 2] - 2*h[7, 1] + 2*h[8]\n\n The Frobenius endomorphisms are multiplicative::\n\n sage: all( all( s(lam).frobenius(3) * s(mu).frobenius(3)\n ....: == (s(lam) * s(mu)).frobenius(3)\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(3) )\n True\n sage: all( all( m(lam).frobenius(2) * m(mu).frobenius(2)\n ....: == (m(lam) * m(mu)).frobenius(2)\n ....: for mu in Partitions(4) )\n ....: for lam in Partitions(4) )\n True\n sage: all( all( p(lam).frobenius(2) * p(mu).frobenius(2)\n ....: == (p(lam) * p(mu)).frobenius(2)\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(4) )\n True\n\n Being Hopf algebra endomorphisms, the Frobenius operators\n commute with the antipode::\n\n sage: all( p(lam).frobenius(4).antipode()\n ....: == p(lam).antipode().frobenius(4)\n ....: for lam in Partitions(3) )\n True\n\n Testing the `\\mathbf{f}_n(P) = p_n \\circ P = P \\circ p_n`\n equality (over `\\QQ`, since plethysm is currently not\n defined over `\\ZZ` in Sage)::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: s = Sym.s()\n sage: p = Sym.p()\n sage: all( s(lam).frobenius(3) == s(lam).plethysm(p[3])\n ....: == s(p[3].plethysm(s(lam)))\n ....: for lam in Partitions(4) )\n True\n\n By Exercise 7.61 in Stanley\'s EC2 [STA]_ (see the errata on his\n website), `\\mathbf{f}_n(h_m)` is a linear combination of\n Schur polynomials (of straight shapes) using coefficients `0`,\n `1` and `-1` only; moreover, all partitions whose Schur\n polynomials occur with coefficient `\\neq 0` in this\n combination have empty `n`-cores. Let us check this on\n examples::\n\n sage: all( all( all( (coeff == -1 or coeff == 1)\n ....: and lam.core(n) == Partition([])\n ....: for lam, coeff in s([m]).frobenius(n).monomial_coefficients().items() )\n ....: for n in range(2, 4) )\n ....: for m in range(4) )\n True\n\n .. SEEALSO::\n\n :meth:`plethysm`\n\n .. TODO::\n\n This method is fast on the monomial and the powersum\n bases, while all other bases get converted to the\n monomial basis. For most bases, this is probably the\n quickest way to do, but at least the Schur basis should\n have a better option. (Quoting from Stanley\'s EC2 [STA]_:\n "D. G. Duncan, J. London Math. Soc. 27 (1952), 235-236,\n or Y. M. Chen, A. M. Garsia, and J. B. Remmel, Contemp.\n Math. 34 (1984), 109-153".)\n ' parent = self.parent() m = parent.realization_of().monomial() from sage.combinat.partition import Partition dct = {Partition(map((lambda i: (n * i)), lam)): coeff for (lam, coeff) in m(self).monomial_coefficients().items()} result_in_m_basis = m._from_dict(dct) return parent(result_in_m_basis)
def frobenius(self, n): '\n Return the image of the symmetric function ``self`` under the\n `n`-th Frobenius operator.\n\n The `n`-th Frobenius operator `\\mathbf{f}_n` is defined to be the\n map from the ring of symmetric functions to itself that sends\n every symmetric function `P(x_1, x_2, x_3, \\ldots)` to\n `P(x_1^n, x_2^n, x_3^n, \\ldots)`. This operator `\\mathbf{f}_n`\n is a Hopf algebra endomorphism, and satisfies\n\n .. MATH::\n\n \\mathbf{f}_n m_{(\\lambda_1, \\lambda_2, \\lambda_3, \\ldots)} =\n m_{(n\\lambda_1, n\\lambda_2, n\\lambda_3, \\ldots)}\n\n for every partition `(\\lambda_1, \\lambda_2, \\lambda_3, \\ldots)`\n (where `m` means the monomial basis). Moreover,\n `\\mathbf{f}_n (p_r) = p_{nr}` for every positive integer `r` (where\n `p_k` denotes the `k`-th powersum symmetric function).\n\n The `n`-th Frobenius operator is also called the `n`-th\n Frobenius endomorphism. It is not related to the Frobenius map\n which connects the ring of symmetric functions with the\n representation theory of the symmetric group.\n\n The `n`-th Frobenius operator is also the `n`-th Adams operator\n of the `\\Lambda`-ring of symmetric functions over the integers.\n\n The `n`-th Frobenius operator can also be described via plethysm:\n Every symmetric function `P` satisfies\n `\\mathbf{f}_n(P) = p_n \\circ P = P \\circ p_n`,\n where `p_n` is the `n`-th powersum symmetric function, and `\\circ`\n denotes (outer) plethysm.\n\n :meth:`adams_operation` serves as alias for :meth:`frobenius`, since the\n Frobenius operators are the Adams operations of the `\\Lambda`-ring\n of symmetric functions.\n\n INPUT:\n\n - ``n`` -- a positive integer\n\n OUTPUT:\n\n The result of applying the `n`-th Frobenius operator (on the ring of\n symmetric functions) to ``self``.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: h = Sym.h()\n sage: s = Sym.s()\n sage: m = Sym.m()\n sage: s[3].frobenius(2)\n -s[3, 3] + s[4, 2] - s[5, 1] + s[6]\n sage: m[4,2,1].frobenius(3)\n m[12, 6, 3]\n sage: p[4,2,1].frobenius(3)\n p[12, 6, 3]\n sage: h[4].frobenius(2)\n h[4, 4] - 2*h[5, 3] + 2*h[6, 2] - 2*h[7, 1] + 2*h[8]\n\n The Frobenius endomorphisms are multiplicative::\n\n sage: all( all( s(lam).frobenius(3) * s(mu).frobenius(3)\n ....: == (s(lam) * s(mu)).frobenius(3)\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(3) )\n True\n sage: all( all( m(lam).frobenius(2) * m(mu).frobenius(2)\n ....: == (m(lam) * m(mu)).frobenius(2)\n ....: for mu in Partitions(4) )\n ....: for lam in Partitions(4) )\n True\n sage: all( all( p(lam).frobenius(2) * p(mu).frobenius(2)\n ....: == (p(lam) * p(mu)).frobenius(2)\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(4) )\n True\n\n Being Hopf algebra endomorphisms, the Frobenius operators\n commute with the antipode::\n\n sage: all( p(lam).frobenius(4).antipode()\n ....: == p(lam).antipode().frobenius(4)\n ....: for lam in Partitions(3) )\n True\n\n Testing the `\\mathbf{f}_n(P) = p_n \\circ P = P \\circ p_n`\n equality (over `\\QQ`, since plethysm is currently not\n defined over `\\ZZ` in Sage)::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: s = Sym.s()\n sage: p = Sym.p()\n sage: all( s(lam).frobenius(3) == s(lam).plethysm(p[3])\n ....: == s(p[3].plethysm(s(lam)))\n ....: for lam in Partitions(4) )\n True\n\n By Exercise 7.61 in Stanley\'s EC2 [STA]_ (see the errata on his\n website), `\\mathbf{f}_n(h_m)` is a linear combination of\n Schur polynomials (of straight shapes) using coefficients `0`,\n `1` and `-1` only; moreover, all partitions whose Schur\n polynomials occur with coefficient `\\neq 0` in this\n combination have empty `n`-cores. Let us check this on\n examples::\n\n sage: all( all( all( (coeff == -1 or coeff == 1)\n ....: and lam.core(n) == Partition([])\n ....: for lam, coeff in s([m]).frobenius(n).monomial_coefficients().items() )\n ....: for n in range(2, 4) )\n ....: for m in range(4) )\n True\n\n .. SEEALSO::\n\n :meth:`plethysm`\n\n .. TODO::\n\n This method is fast on the monomial and the powersum\n bases, while all other bases get converted to the\n monomial basis. For most bases, this is probably the\n quickest way to do, but at least the Schur basis should\n have a better option. (Quoting from Stanley\'s EC2 [STA]_:\n "D. G. Duncan, J. London Math. Soc. 27 (1952), 235-236,\n or Y. M. Chen, A. M. Garsia, and J. B. Remmel, Contemp.\n Math. 34 (1984), 109-153".)\n ' parent = self.parent() m = parent.realization_of().monomial() from sage.combinat.partition import Partition dct = {Partition(map((lambda i: (n * i)), lam)): coeff for (lam, coeff) in m(self).monomial_coefficients().items()} result_in_m_basis = m._from_dict(dct) return parent(result_in_m_basis)<|docstring|>Return the image of the symmetric function ``self`` under the `n`-th Frobenius operator. The `n`-th Frobenius operator `\mathbf{f}_n` is defined to be the map from the ring of symmetric functions to itself that sends every symmetric function `P(x_1, x_2, x_3, \ldots)` to `P(x_1^n, x_2^n, x_3^n, \ldots)`. This operator `\mathbf{f}_n` is a Hopf algebra endomorphism, and satisfies .. MATH:: \mathbf{f}_n m_{(\lambda_1, \lambda_2, \lambda_3, \ldots)} = m_{(n\lambda_1, n\lambda_2, n\lambda_3, \ldots)} for every partition `(\lambda_1, \lambda_2, \lambda_3, \ldots)` (where `m` means the monomial basis). Moreover, `\mathbf{f}_n (p_r) = p_{nr}` for every positive integer `r` (where `p_k` denotes the `k`-th powersum symmetric function). The `n`-th Frobenius operator is also called the `n`-th Frobenius endomorphism. It is not related to the Frobenius map which connects the ring of symmetric functions with the representation theory of the symmetric group. The `n`-th Frobenius operator is also the `n`-th Adams operator of the `\Lambda`-ring of symmetric functions over the integers. The `n`-th Frobenius operator can also be described via plethysm: Every symmetric function `P` satisfies `\mathbf{f}_n(P) = p_n \circ P = P \circ p_n`, where `p_n` is the `n`-th powersum symmetric function, and `\circ` denotes (outer) plethysm. :meth:`adams_operation` serves as alias for :meth:`frobenius`, since the Frobenius operators are the Adams operations of the `\Lambda`-ring of symmetric functions. INPUT: - ``n`` -- a positive integer OUTPUT: The result of applying the `n`-th Frobenius operator (on the ring of symmetric functions) to ``self``. EXAMPLES:: sage: Sym = SymmetricFunctions(ZZ) sage: p = Sym.p() sage: h = Sym.h() sage: s = Sym.s() sage: m = Sym.m() sage: s[3].frobenius(2) -s[3, 3] + s[4, 2] - s[5, 1] + s[6] sage: m[4,2,1].frobenius(3) m[12, 6, 3] sage: p[4,2,1].frobenius(3) p[12, 6, 3] sage: h[4].frobenius(2) h[4, 4] - 2*h[5, 3] + 2*h[6, 2] - 2*h[7, 1] + 2*h[8] The Frobenius endomorphisms are multiplicative:: sage: all( all( s(lam).frobenius(3) * s(mu).frobenius(3) ....: == (s(lam) * s(mu)).frobenius(3) ....: for mu in Partitions(3) ) ....: for lam in Partitions(3) ) True sage: all( all( m(lam).frobenius(2) * m(mu).frobenius(2) ....: == (m(lam) * m(mu)).frobenius(2) ....: for mu in Partitions(4) ) ....: for lam in Partitions(4) ) True sage: all( all( p(lam).frobenius(2) * p(mu).frobenius(2) ....: == (p(lam) * p(mu)).frobenius(2) ....: for mu in Partitions(3) ) ....: for lam in Partitions(4) ) True Being Hopf algebra endomorphisms, the Frobenius operators commute with the antipode:: sage: all( p(lam).frobenius(4).antipode() ....: == p(lam).antipode().frobenius(4) ....: for lam in Partitions(3) ) True Testing the `\mathbf{f}_n(P) = p_n \circ P = P \circ p_n` equality (over `\QQ`, since plethysm is currently not defined over `\ZZ` in Sage):: sage: Sym = SymmetricFunctions(QQ) sage: s = Sym.s() sage: p = Sym.p() sage: all( s(lam).frobenius(3) == s(lam).plethysm(p[3]) ....: == s(p[3].plethysm(s(lam))) ....: for lam in Partitions(4) ) True By Exercise 7.61 in Stanley's EC2 [STA]_ (see the errata on his website), `\mathbf{f}_n(h_m)` is a linear combination of Schur polynomials (of straight shapes) using coefficients `0`, `1` and `-1` only; moreover, all partitions whose Schur polynomials occur with coefficient `\neq 0` in this combination have empty `n`-cores. Let us check this on examples:: sage: all( all( all( (coeff == -1 or coeff == 1) ....: and lam.core(n) == Partition([]) ....: for lam, coeff in s([m]).frobenius(n).monomial_coefficients().items() ) ....: for n in range(2, 4) ) ....: for m in range(4) ) True .. SEEALSO:: :meth:`plethysm` .. TODO:: This method is fast on the monomial and the powersum bases, while all other bases get converted to the monomial basis. For most bases, this is probably the quickest way to do, but at least the Schur basis should have a better option. (Quoting from Stanley's EC2 [STA]_: "D. G. Duncan, J. London Math. Soc. 27 (1952), 235-236, or Y. M. Chen, A. M. Garsia, and J. B. Remmel, Contemp. Math. 34 (1984), 109-153".)<|endoftext|>
14d6f658c1c83d4133a3ba4bd48caab351108bbdb6545982eacb8589a1b131ca
def verschiebung(self, n): '\n Return the image of the symmetric function ``self`` under the\n `n`-th Verschiebung operator.\n\n The `n`-th Verschiebung operator `\\mathbf{V}_n` is defined to be\n the unique algebra endomorphism `V` of the ring of symmetric\n functions that satisfies `V(h_r) = h_{r/n}` for every positive\n integer `r` divisible by `n`, and satisfies `V(h_r) = 0` for\n every positive integer `r` not divisible by `n`. This operator\n `\\mathbf{V}_n` is a Hopf algebra endomorphism. For every\n nonnegative integer `r` with `n \\mid r`, it satisfies\n\n .. MATH::\n\n \\mathbf{V}_n(h_r) = h_{r/n},\n \\quad \\mathbf{V}_n(p_r) = n p_{r/n},\n \\quad \\mathbf{V}_n(e_r) = (-1)^{r - r/n} e_{r/n}\n\n (where `h` is the complete homogeneous basis, `p` is the\n powersum basis, and `e` is the elementary basis). For every\n nonnegative integer `r` with `n \\nmid r`, it satisfes\n\n .. MATH::\n\n \\mathbf{V}_n(h_r) = \\mathbf{V}_n(p_r) = \\mathbf{V}_n(e_r) = 0.\n\n The `n`-th Verschiebung operator is also called the `n`-th\n Verschiebung endomorphism. Its name derives from the Verschiebung\n (German for "shift") endomorphism of the Witt vectors.\n\n The `n`-th Verschiebung operator is adjoint to the `n`-th\n Frobenius operator (see :meth:`frobenius` for its definition)\n with respect to the Hall scalar product (:meth:`scalar`).\n\n The action of the `n`-th Verschiebung operator on the Schur basis\n can also be computed explicitly. The following (probably clumsier\n than necessary) description can be obtained by solving exercise\n 7.61 in Stanley\'s [STA]_.\n\n Let `\\lambda` be a partition. Let `n` be a positive integer. If\n the `n`-core of `\\lambda` is nonempty, then\n `\\mathbf{V}_n(s_\\lambda) = 0`. Otherwise, the following method\n computes `\\mathbf{V}_n(s_\\lambda)`: Write the partition `\\lambda`\n in the form `(\\lambda_1, \\lambda_2, \\ldots, \\lambda_{ns})` for some\n nonnegative integer `s`. (If `n` does not divide the length of\n `\\lambda`, then this is achieved by adding trailing zeroes to\n `\\lambda`.) Set `\\beta_i = \\lambda_i + ns - i` for every\n `s \\in \\{ 1, 2, \\ldots, ns \\}`. Then,\n `(\\beta_1, \\beta_2, \\ldots, \\beta_{ns})` is a strictly decreasing\n sequence of nonnegative integers. Stably sort the list\n `(1, 2, \\ldots, ns)` in order of (weakly) increasing remainder of\n `-1 - \\beta_i` modulo `n`. Let `\\xi` be the sign of the\n permutation that is used for this sorting. Let `\\psi` be the sign\n of the permutation that is used to stably sort the list\n `(1, 2, \\ldots, ns)` in order of (weakly) increasing remainder of\n `i - 1` modulo `n`. (Notice that `\\psi = (-1)^{n(n-1)s(s-1)/4}`.)\n Then, `\\mathbf{V}_n(s_\\lambda) = \\xi \\psi \\prod_{i = 0}^{n - 1}\n s_{\\lambda^{(i)}}`, where\n `(\\lambda^{(0)}, \\lambda^{(1)}, \\ldots, \\lambda^{(n - 1)})`\n is the `n`-quotient of `\\lambda`.\n\n INPUT:\n\n - ``n`` -- a positive integer\n\n OUTPUT:\n\n The result of applying the `n`-th Verschiebung operator (on the ring of\n symmetric functions) to ``self``.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: h = Sym.h()\n sage: s = Sym.s()\n sage: m = Sym.m()\n sage: s[3].verschiebung(2)\n 0\n sage: s[3].verschiebung(3)\n s[1]\n sage: p[3].verschiebung(3)\n 3*p[1]\n sage: m[3,2,1].verschiebung(3)\n -18*m[1, 1] - 3*m[2]\n sage: p[3,2,1].verschiebung(3)\n 0\n sage: h[4].verschiebung(2)\n h[2]\n sage: p[2].verschiebung(2)\n 2*p[1]\n sage: m[3,2,1].verschiebung(6)\n 12*m[1]\n\n The Verschiebung endomorphisms are multiplicative::\n\n sage: all( all( s(lam).verschiebung(2) * s(mu).verschiebung(2)\n ....: == (s(lam) * s(mu)).verschiebung(2)\n ....: for mu in Partitions(4) )\n ....: for lam in Partitions(4) )\n True\n\n Being Hopf algebra endomorphisms, the Verschiebung operators\n commute with the antipode::\n\n sage: all( p(lam).verschiebung(3).antipode()\n ....: == p(lam).antipode().verschiebung(3)\n ....: for lam in Partitions(6) )\n True\n\n Testing the adjointness between the Frobenius operators\n `\\mathbf{f}_n` and the Verschiebung operators\n `\\mathbf{V}_n`::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: s = Sym.s()\n sage: p = Sym.p()\n sage: all( all( s(lam).verschiebung(2).scalar(p(mu))\n ....: == s(lam).scalar(p(mu).frobenius(2))\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(6) )\n True\n ' parent = self.parent() h = parent.realization_of().homogeneous() h_coords_of_self = h(self).monomial_coefficients().items() from sage.combinat.partition import Partition dct = {Partition(map((lambda i: (i // n)), lam)): coeff for (lam, coeff) in h_coords_of_self if all((((i % n) == 0) for i in lam))} result_in_h_basis = h._from_dict(dct) return parent(result_in_h_basis)
Return the image of the symmetric function ``self`` under the `n`-th Verschiebung operator. The `n`-th Verschiebung operator `\mathbf{V}_n` is defined to be the unique algebra endomorphism `V` of the ring of symmetric functions that satisfies `V(h_r) = h_{r/n}` for every positive integer `r` divisible by `n`, and satisfies `V(h_r) = 0` for every positive integer `r` not divisible by `n`. This operator `\mathbf{V}_n` is a Hopf algebra endomorphism. For every nonnegative integer `r` with `n \mid r`, it satisfies .. MATH:: \mathbf{V}_n(h_r) = h_{r/n}, \quad \mathbf{V}_n(p_r) = n p_{r/n}, \quad \mathbf{V}_n(e_r) = (-1)^{r - r/n} e_{r/n} (where `h` is the complete homogeneous basis, `p` is the powersum basis, and `e` is the elementary basis). For every nonnegative integer `r` with `n \nmid r`, it satisfes .. MATH:: \mathbf{V}_n(h_r) = \mathbf{V}_n(p_r) = \mathbf{V}_n(e_r) = 0. The `n`-th Verschiebung operator is also called the `n`-th Verschiebung endomorphism. Its name derives from the Verschiebung (German for "shift") endomorphism of the Witt vectors. The `n`-th Verschiebung operator is adjoint to the `n`-th Frobenius operator (see :meth:`frobenius` for its definition) with respect to the Hall scalar product (:meth:`scalar`). The action of the `n`-th Verschiebung operator on the Schur basis can also be computed explicitly. The following (probably clumsier than necessary) description can be obtained by solving exercise 7.61 in Stanley's [STA]_. Let `\lambda` be a partition. Let `n` be a positive integer. If the `n`-core of `\lambda` is nonempty, then `\mathbf{V}_n(s_\lambda) = 0`. Otherwise, the following method computes `\mathbf{V}_n(s_\lambda)`: Write the partition `\lambda` in the form `(\lambda_1, \lambda_2, \ldots, \lambda_{ns})` for some nonnegative integer `s`. (If `n` does not divide the length of `\lambda`, then this is achieved by adding trailing zeroes to `\lambda`.) Set `\beta_i = \lambda_i + ns - i` for every `s \in \{ 1, 2, \ldots, ns \}`. Then, `(\beta_1, \beta_2, \ldots, \beta_{ns})` is a strictly decreasing sequence of nonnegative integers. Stably sort the list `(1, 2, \ldots, ns)` in order of (weakly) increasing remainder of `-1 - \beta_i` modulo `n`. Let `\xi` be the sign of the permutation that is used for this sorting. Let `\psi` be the sign of the permutation that is used to stably sort the list `(1, 2, \ldots, ns)` in order of (weakly) increasing remainder of `i - 1` modulo `n`. (Notice that `\psi = (-1)^{n(n-1)s(s-1)/4}`.) Then, `\mathbf{V}_n(s_\lambda) = \xi \psi \prod_{i = 0}^{n - 1} s_{\lambda^{(i)}}`, where `(\lambda^{(0)}, \lambda^{(1)}, \ldots, \lambda^{(n - 1)})` is the `n`-quotient of `\lambda`. INPUT: - ``n`` -- a positive integer OUTPUT: The result of applying the `n`-th Verschiebung operator (on the ring of symmetric functions) to ``self``. EXAMPLES:: sage: Sym = SymmetricFunctions(ZZ) sage: p = Sym.p() sage: h = Sym.h() sage: s = Sym.s() sage: m = Sym.m() sage: s[3].verschiebung(2) 0 sage: s[3].verschiebung(3) s[1] sage: p[3].verschiebung(3) 3*p[1] sage: m[3,2,1].verschiebung(3) -18*m[1, 1] - 3*m[2] sage: p[3,2,1].verschiebung(3) 0 sage: h[4].verschiebung(2) h[2] sage: p[2].verschiebung(2) 2*p[1] sage: m[3,2,1].verschiebung(6) 12*m[1] The Verschiebung endomorphisms are multiplicative:: sage: all( all( s(lam).verschiebung(2) * s(mu).verschiebung(2) ....: == (s(lam) * s(mu)).verschiebung(2) ....: for mu in Partitions(4) ) ....: for lam in Partitions(4) ) True Being Hopf algebra endomorphisms, the Verschiebung operators commute with the antipode:: sage: all( p(lam).verschiebung(3).antipode() ....: == p(lam).antipode().verschiebung(3) ....: for lam in Partitions(6) ) True Testing the adjointness between the Frobenius operators `\mathbf{f}_n` and the Verschiebung operators `\mathbf{V}_n`:: sage: Sym = SymmetricFunctions(QQ) sage: s = Sym.s() sage: p = Sym.p() sage: all( all( s(lam).verschiebung(2).scalar(p(mu)) ....: == s(lam).scalar(p(mu).frobenius(2)) ....: for mu in Partitions(3) ) ....: for lam in Partitions(6) ) True
src/sage/combinat/sf/sfa.py
verschiebung
bopopescu/sagesmc
5
python
def verschiebung(self, n): '\n Return the image of the symmetric function ``self`` under the\n `n`-th Verschiebung operator.\n\n The `n`-th Verschiebung operator `\\mathbf{V}_n` is defined to be\n the unique algebra endomorphism `V` of the ring of symmetric\n functions that satisfies `V(h_r) = h_{r/n}` for every positive\n integer `r` divisible by `n`, and satisfies `V(h_r) = 0` for\n every positive integer `r` not divisible by `n`. This operator\n `\\mathbf{V}_n` is a Hopf algebra endomorphism. For every\n nonnegative integer `r` with `n \\mid r`, it satisfies\n\n .. MATH::\n\n \\mathbf{V}_n(h_r) = h_{r/n},\n \\quad \\mathbf{V}_n(p_r) = n p_{r/n},\n \\quad \\mathbf{V}_n(e_r) = (-1)^{r - r/n} e_{r/n}\n\n (where `h` is the complete homogeneous basis, `p` is the\n powersum basis, and `e` is the elementary basis). For every\n nonnegative integer `r` with `n \\nmid r`, it satisfes\n\n .. MATH::\n\n \\mathbf{V}_n(h_r) = \\mathbf{V}_n(p_r) = \\mathbf{V}_n(e_r) = 0.\n\n The `n`-th Verschiebung operator is also called the `n`-th\n Verschiebung endomorphism. Its name derives from the Verschiebung\n (German for "shift") endomorphism of the Witt vectors.\n\n The `n`-th Verschiebung operator is adjoint to the `n`-th\n Frobenius operator (see :meth:`frobenius` for its definition)\n with respect to the Hall scalar product (:meth:`scalar`).\n\n The action of the `n`-th Verschiebung operator on the Schur basis\n can also be computed explicitly. The following (probably clumsier\n than necessary) description can be obtained by solving exercise\n 7.61 in Stanley\'s [STA]_.\n\n Let `\\lambda` be a partition. Let `n` be a positive integer. If\n the `n`-core of `\\lambda` is nonempty, then\n `\\mathbf{V}_n(s_\\lambda) = 0`. Otherwise, the following method\n computes `\\mathbf{V}_n(s_\\lambda)`: Write the partition `\\lambda`\n in the form `(\\lambda_1, \\lambda_2, \\ldots, \\lambda_{ns})` for some\n nonnegative integer `s`. (If `n` does not divide the length of\n `\\lambda`, then this is achieved by adding trailing zeroes to\n `\\lambda`.) Set `\\beta_i = \\lambda_i + ns - i` for every\n `s \\in \\{ 1, 2, \\ldots, ns \\}`. Then,\n `(\\beta_1, \\beta_2, \\ldots, \\beta_{ns})` is a strictly decreasing\n sequence of nonnegative integers. Stably sort the list\n `(1, 2, \\ldots, ns)` in order of (weakly) increasing remainder of\n `-1 - \\beta_i` modulo `n`. Let `\\xi` be the sign of the\n permutation that is used for this sorting. Let `\\psi` be the sign\n of the permutation that is used to stably sort the list\n `(1, 2, \\ldots, ns)` in order of (weakly) increasing remainder of\n `i - 1` modulo `n`. (Notice that `\\psi = (-1)^{n(n-1)s(s-1)/4}`.)\n Then, `\\mathbf{V}_n(s_\\lambda) = \\xi \\psi \\prod_{i = 0}^{n - 1}\n s_{\\lambda^{(i)}}`, where\n `(\\lambda^{(0)}, \\lambda^{(1)}, \\ldots, \\lambda^{(n - 1)})`\n is the `n`-quotient of `\\lambda`.\n\n INPUT:\n\n - ``n`` -- a positive integer\n\n OUTPUT:\n\n The result of applying the `n`-th Verschiebung operator (on the ring of\n symmetric functions) to ``self``.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: h = Sym.h()\n sage: s = Sym.s()\n sage: m = Sym.m()\n sage: s[3].verschiebung(2)\n 0\n sage: s[3].verschiebung(3)\n s[1]\n sage: p[3].verschiebung(3)\n 3*p[1]\n sage: m[3,2,1].verschiebung(3)\n -18*m[1, 1] - 3*m[2]\n sage: p[3,2,1].verschiebung(3)\n 0\n sage: h[4].verschiebung(2)\n h[2]\n sage: p[2].verschiebung(2)\n 2*p[1]\n sage: m[3,2,1].verschiebung(6)\n 12*m[1]\n\n The Verschiebung endomorphisms are multiplicative::\n\n sage: all( all( s(lam).verschiebung(2) * s(mu).verschiebung(2)\n ....: == (s(lam) * s(mu)).verschiebung(2)\n ....: for mu in Partitions(4) )\n ....: for lam in Partitions(4) )\n True\n\n Being Hopf algebra endomorphisms, the Verschiebung operators\n commute with the antipode::\n\n sage: all( p(lam).verschiebung(3).antipode()\n ....: == p(lam).antipode().verschiebung(3)\n ....: for lam in Partitions(6) )\n True\n\n Testing the adjointness between the Frobenius operators\n `\\mathbf{f}_n` and the Verschiebung operators\n `\\mathbf{V}_n`::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: s = Sym.s()\n sage: p = Sym.p()\n sage: all( all( s(lam).verschiebung(2).scalar(p(mu))\n ....: == s(lam).scalar(p(mu).frobenius(2))\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(6) )\n True\n ' parent = self.parent() h = parent.realization_of().homogeneous() h_coords_of_self = h(self).monomial_coefficients().items() from sage.combinat.partition import Partition dct = {Partition(map((lambda i: (i // n)), lam)): coeff for (lam, coeff) in h_coords_of_self if all((((i % n) == 0) for i in lam))} result_in_h_basis = h._from_dict(dct) return parent(result_in_h_basis)
def verschiebung(self, n): '\n Return the image of the symmetric function ``self`` under the\n `n`-th Verschiebung operator.\n\n The `n`-th Verschiebung operator `\\mathbf{V}_n` is defined to be\n the unique algebra endomorphism `V` of the ring of symmetric\n functions that satisfies `V(h_r) = h_{r/n}` for every positive\n integer `r` divisible by `n`, and satisfies `V(h_r) = 0` for\n every positive integer `r` not divisible by `n`. This operator\n `\\mathbf{V}_n` is a Hopf algebra endomorphism. For every\n nonnegative integer `r` with `n \\mid r`, it satisfies\n\n .. MATH::\n\n \\mathbf{V}_n(h_r) = h_{r/n},\n \\quad \\mathbf{V}_n(p_r) = n p_{r/n},\n \\quad \\mathbf{V}_n(e_r) = (-1)^{r - r/n} e_{r/n}\n\n (where `h` is the complete homogeneous basis, `p` is the\n powersum basis, and `e` is the elementary basis). For every\n nonnegative integer `r` with `n \\nmid r`, it satisfes\n\n .. MATH::\n\n \\mathbf{V}_n(h_r) = \\mathbf{V}_n(p_r) = \\mathbf{V}_n(e_r) = 0.\n\n The `n`-th Verschiebung operator is also called the `n`-th\n Verschiebung endomorphism. Its name derives from the Verschiebung\n (German for "shift") endomorphism of the Witt vectors.\n\n The `n`-th Verschiebung operator is adjoint to the `n`-th\n Frobenius operator (see :meth:`frobenius` for its definition)\n with respect to the Hall scalar product (:meth:`scalar`).\n\n The action of the `n`-th Verschiebung operator on the Schur basis\n can also be computed explicitly. The following (probably clumsier\n than necessary) description can be obtained by solving exercise\n 7.61 in Stanley\'s [STA]_.\n\n Let `\\lambda` be a partition. Let `n` be a positive integer. If\n the `n`-core of `\\lambda` is nonempty, then\n `\\mathbf{V}_n(s_\\lambda) = 0`. Otherwise, the following method\n computes `\\mathbf{V}_n(s_\\lambda)`: Write the partition `\\lambda`\n in the form `(\\lambda_1, \\lambda_2, \\ldots, \\lambda_{ns})` for some\n nonnegative integer `s`. (If `n` does not divide the length of\n `\\lambda`, then this is achieved by adding trailing zeroes to\n `\\lambda`.) Set `\\beta_i = \\lambda_i + ns - i` for every\n `s \\in \\{ 1, 2, \\ldots, ns \\}`. Then,\n `(\\beta_1, \\beta_2, \\ldots, \\beta_{ns})` is a strictly decreasing\n sequence of nonnegative integers. Stably sort the list\n `(1, 2, \\ldots, ns)` in order of (weakly) increasing remainder of\n `-1 - \\beta_i` modulo `n`. Let `\\xi` be the sign of the\n permutation that is used for this sorting. Let `\\psi` be the sign\n of the permutation that is used to stably sort the list\n `(1, 2, \\ldots, ns)` in order of (weakly) increasing remainder of\n `i - 1` modulo `n`. (Notice that `\\psi = (-1)^{n(n-1)s(s-1)/4}`.)\n Then, `\\mathbf{V}_n(s_\\lambda) = \\xi \\psi \\prod_{i = 0}^{n - 1}\n s_{\\lambda^{(i)}}`, where\n `(\\lambda^{(0)}, \\lambda^{(1)}, \\ldots, \\lambda^{(n - 1)})`\n is the `n`-quotient of `\\lambda`.\n\n INPUT:\n\n - ``n`` -- a positive integer\n\n OUTPUT:\n\n The result of applying the `n`-th Verschiebung operator (on the ring of\n symmetric functions) to ``self``.\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: h = Sym.h()\n sage: s = Sym.s()\n sage: m = Sym.m()\n sage: s[3].verschiebung(2)\n 0\n sage: s[3].verschiebung(3)\n s[1]\n sage: p[3].verschiebung(3)\n 3*p[1]\n sage: m[3,2,1].verschiebung(3)\n -18*m[1, 1] - 3*m[2]\n sage: p[3,2,1].verschiebung(3)\n 0\n sage: h[4].verschiebung(2)\n h[2]\n sage: p[2].verschiebung(2)\n 2*p[1]\n sage: m[3,2,1].verschiebung(6)\n 12*m[1]\n\n The Verschiebung endomorphisms are multiplicative::\n\n sage: all( all( s(lam).verschiebung(2) * s(mu).verschiebung(2)\n ....: == (s(lam) * s(mu)).verschiebung(2)\n ....: for mu in Partitions(4) )\n ....: for lam in Partitions(4) )\n True\n\n Being Hopf algebra endomorphisms, the Verschiebung operators\n commute with the antipode::\n\n sage: all( p(lam).verschiebung(3).antipode()\n ....: == p(lam).antipode().verschiebung(3)\n ....: for lam in Partitions(6) )\n True\n\n Testing the adjointness between the Frobenius operators\n `\\mathbf{f}_n` and the Verschiebung operators\n `\\mathbf{V}_n`::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: s = Sym.s()\n sage: p = Sym.p()\n sage: all( all( s(lam).verschiebung(2).scalar(p(mu))\n ....: == s(lam).scalar(p(mu).frobenius(2))\n ....: for mu in Partitions(3) )\n ....: for lam in Partitions(6) )\n True\n ' parent = self.parent() h = parent.realization_of().homogeneous() h_coords_of_self = h(self).monomial_coefficients().items() from sage.combinat.partition import Partition dct = {Partition(map((lambda i: (i // n)), lam)): coeff for (lam, coeff) in h_coords_of_self if all((((i % n) == 0) for i in lam))} result_in_h_basis = h._from_dict(dct) return parent(result_in_h_basis)<|docstring|>Return the image of the symmetric function ``self`` under the `n`-th Verschiebung operator. The `n`-th Verschiebung operator `\mathbf{V}_n` is defined to be the unique algebra endomorphism `V` of the ring of symmetric functions that satisfies `V(h_r) = h_{r/n}` for every positive integer `r` divisible by `n`, and satisfies `V(h_r) = 0` for every positive integer `r` not divisible by `n`. This operator `\mathbf{V}_n` is a Hopf algebra endomorphism. For every nonnegative integer `r` with `n \mid r`, it satisfies .. MATH:: \mathbf{V}_n(h_r) = h_{r/n}, \quad \mathbf{V}_n(p_r) = n p_{r/n}, \quad \mathbf{V}_n(e_r) = (-1)^{r - r/n} e_{r/n} (where `h` is the complete homogeneous basis, `p` is the powersum basis, and `e` is the elementary basis). For every nonnegative integer `r` with `n \nmid r`, it satisfes .. MATH:: \mathbf{V}_n(h_r) = \mathbf{V}_n(p_r) = \mathbf{V}_n(e_r) = 0. The `n`-th Verschiebung operator is also called the `n`-th Verschiebung endomorphism. Its name derives from the Verschiebung (German for "shift") endomorphism of the Witt vectors. The `n`-th Verschiebung operator is adjoint to the `n`-th Frobenius operator (see :meth:`frobenius` for its definition) with respect to the Hall scalar product (:meth:`scalar`). The action of the `n`-th Verschiebung operator on the Schur basis can also be computed explicitly. The following (probably clumsier than necessary) description can be obtained by solving exercise 7.61 in Stanley's [STA]_. Let `\lambda` be a partition. Let `n` be a positive integer. If the `n`-core of `\lambda` is nonempty, then `\mathbf{V}_n(s_\lambda) = 0`. Otherwise, the following method computes `\mathbf{V}_n(s_\lambda)`: Write the partition `\lambda` in the form `(\lambda_1, \lambda_2, \ldots, \lambda_{ns})` for some nonnegative integer `s`. (If `n` does not divide the length of `\lambda`, then this is achieved by adding trailing zeroes to `\lambda`.) Set `\beta_i = \lambda_i + ns - i` for every `s \in \{ 1, 2, \ldots, ns \}`. Then, `(\beta_1, \beta_2, \ldots, \beta_{ns})` is a strictly decreasing sequence of nonnegative integers. Stably sort the list `(1, 2, \ldots, ns)` in order of (weakly) increasing remainder of `-1 - \beta_i` modulo `n`. Let `\xi` be the sign of the permutation that is used for this sorting. Let `\psi` be the sign of the permutation that is used to stably sort the list `(1, 2, \ldots, ns)` in order of (weakly) increasing remainder of `i - 1` modulo `n`. (Notice that `\psi = (-1)^{n(n-1)s(s-1)/4}`.) Then, `\mathbf{V}_n(s_\lambda) = \xi \psi \prod_{i = 0}^{n - 1} s_{\lambda^{(i)}}`, where `(\lambda^{(0)}, \lambda^{(1)}, \ldots, \lambda^{(n - 1)})` is the `n`-quotient of `\lambda`. INPUT: - ``n`` -- a positive integer OUTPUT: The result of applying the `n`-th Verschiebung operator (on the ring of symmetric functions) to ``self``. EXAMPLES:: sage: Sym = SymmetricFunctions(ZZ) sage: p = Sym.p() sage: h = Sym.h() sage: s = Sym.s() sage: m = Sym.m() sage: s[3].verschiebung(2) 0 sage: s[3].verschiebung(3) s[1] sage: p[3].verschiebung(3) 3*p[1] sage: m[3,2,1].verschiebung(3) -18*m[1, 1] - 3*m[2] sage: p[3,2,1].verschiebung(3) 0 sage: h[4].verschiebung(2) h[2] sage: p[2].verschiebung(2) 2*p[1] sage: m[3,2,1].verschiebung(6) 12*m[1] The Verschiebung endomorphisms are multiplicative:: sage: all( all( s(lam).verschiebung(2) * s(mu).verschiebung(2) ....: == (s(lam) * s(mu)).verschiebung(2) ....: for mu in Partitions(4) ) ....: for lam in Partitions(4) ) True Being Hopf algebra endomorphisms, the Verschiebung operators commute with the antipode:: sage: all( p(lam).verschiebung(3).antipode() ....: == p(lam).antipode().verschiebung(3) ....: for lam in Partitions(6) ) True Testing the adjointness between the Frobenius operators `\mathbf{f}_n` and the Verschiebung operators `\mathbf{V}_n`:: sage: Sym = SymmetricFunctions(QQ) sage: s = Sym.s() sage: p = Sym.p() sage: all( all( s(lam).verschiebung(2).scalar(p(mu)) ....: == s(lam).scalar(p(mu).frobenius(2)) ....: for mu in Partitions(3) ) ....: for lam in Partitions(6) ) True<|endoftext|>
704cb400316b4bde9033f4136dfbc94840289ff4e69f52fe4dcbf622679cd697
def _expand(self, condition, n, alphabet='x'): "\n Expand the symmetric function as a symmetric polynomial in ``n``\n variables.\n\n INPUT:\n\n - ``condition`` -- a function on partitions with a boolean output,\n selecting only certain terms (namely, only the items failing\n the condition are being expanded)\n\n - ``n`` -- a nonnegative integer\n\n - ``alphabet`` -- (default: ``'x'``) a variable for the expansion\n\n OUTPUT:\n\n A monomial expansion of an instance of ``self`` in `n` variables.\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: a = p([2])+p([3])\n sage: a._expand(lambda part: False, 3)\n x0^3 + x1^3 + x2^3 + x0^2 + x1^2 + x2^2\n sage: a._expand(lambda part: max(part)>2, 3)\n x0^2 + x1^2 + x2^2\n sage: p(0).expand(3)\n 0\n sage: p([]).expand(3)\n 1\n\n .. NOTE::\n\n The term corresponding to the empty partition is always\n selected, even if ``condition`` returns ``False`` or an\n error when applied to the empty partition. This is in\n order to simplify using the ``_expand`` method with\n conditions like ``lambda part: max(part) < 3`` which\n would require extra work to handle the empty partition.\n " import classical parent = self.parent() resPR = PolynomialRing(parent.base_ring(), n, alphabet) if (self == parent.zero()): return resPR.zero() e = eval((('symmetrica.compute_' + str(classical.translate[parent.basis_name()]).lower()) + '_with_alphabet')) def f(part): if (part == []): return resPR.one() else: return (resPR.zero() if condition(part) else resPR(e(part, n, alphabet))) return parent._apply_module_morphism(self, f)
Expand the symmetric function as a symmetric polynomial in ``n`` variables. INPUT: - ``condition`` -- a function on partitions with a boolean output, selecting only certain terms (namely, only the items failing the condition are being expanded) - ``n`` -- a nonnegative integer - ``alphabet`` -- (default: ``'x'``) a variable for the expansion OUTPUT: A monomial expansion of an instance of ``self`` in `n` variables. EXAMPLES:: sage: p = SymmetricFunctions(QQ).p() sage: a = p([2])+p([3]) sage: a._expand(lambda part: False, 3) x0^3 + x1^3 + x2^3 + x0^2 + x1^2 + x2^2 sage: a._expand(lambda part: max(part)>2, 3) x0^2 + x1^2 + x2^2 sage: p(0).expand(3) 0 sage: p([]).expand(3) 1 .. NOTE:: The term corresponding to the empty partition is always selected, even if ``condition`` returns ``False`` or an error when applied to the empty partition. This is in order to simplify using the ``_expand`` method with conditions like ``lambda part: max(part) < 3`` which would require extra work to handle the empty partition.
src/sage/combinat/sf/sfa.py
_expand
bopopescu/sagesmc
5
python
def _expand(self, condition, n, alphabet='x'): "\n Expand the symmetric function as a symmetric polynomial in ``n``\n variables.\n\n INPUT:\n\n - ``condition`` -- a function on partitions with a boolean output,\n selecting only certain terms (namely, only the items failing\n the condition are being expanded)\n\n - ``n`` -- a nonnegative integer\n\n - ``alphabet`` -- (default: ``'x'``) a variable for the expansion\n\n OUTPUT:\n\n A monomial expansion of an instance of ``self`` in `n` variables.\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: a = p([2])+p([3])\n sage: a._expand(lambda part: False, 3)\n x0^3 + x1^3 + x2^3 + x0^2 + x1^2 + x2^2\n sage: a._expand(lambda part: max(part)>2, 3)\n x0^2 + x1^2 + x2^2\n sage: p(0).expand(3)\n 0\n sage: p([]).expand(3)\n 1\n\n .. NOTE::\n\n The term corresponding to the empty partition is always\n selected, even if ``condition`` returns ``False`` or an\n error when applied to the empty partition. This is in\n order to simplify using the ``_expand`` method with\n conditions like ``lambda part: max(part) < 3`` which\n would require extra work to handle the empty partition.\n " import classical parent = self.parent() resPR = PolynomialRing(parent.base_ring(), n, alphabet) if (self == parent.zero()): return resPR.zero() e = eval((('symmetrica.compute_' + str(classical.translate[parent.basis_name()]).lower()) + '_with_alphabet')) def f(part): if (part == []): return resPR.one() else: return (resPR.zero() if condition(part) else resPR(e(part, n, alphabet))) return parent._apply_module_morphism(self, f)
def _expand(self, condition, n, alphabet='x'): "\n Expand the symmetric function as a symmetric polynomial in ``n``\n variables.\n\n INPUT:\n\n - ``condition`` -- a function on partitions with a boolean output,\n selecting only certain terms (namely, only the items failing\n the condition are being expanded)\n\n - ``n`` -- a nonnegative integer\n\n - ``alphabet`` -- (default: ``'x'``) a variable for the expansion\n\n OUTPUT:\n\n A monomial expansion of an instance of ``self`` in `n` variables.\n\n EXAMPLES::\n\n sage: p = SymmetricFunctions(QQ).p()\n sage: a = p([2])+p([3])\n sage: a._expand(lambda part: False, 3)\n x0^3 + x1^3 + x2^3 + x0^2 + x1^2 + x2^2\n sage: a._expand(lambda part: max(part)>2, 3)\n x0^2 + x1^2 + x2^2\n sage: p(0).expand(3)\n 0\n sage: p([]).expand(3)\n 1\n\n .. NOTE::\n\n The term corresponding to the empty partition is always\n selected, even if ``condition`` returns ``False`` or an\n error when applied to the empty partition. This is in\n order to simplify using the ``_expand`` method with\n conditions like ``lambda part: max(part) < 3`` which\n would require extra work to handle the empty partition.\n " import classical parent = self.parent() resPR = PolynomialRing(parent.base_ring(), n, alphabet) if (self == parent.zero()): return resPR.zero() e = eval((('symmetrica.compute_' + str(classical.translate[parent.basis_name()]).lower()) + '_with_alphabet')) def f(part): if (part == []): return resPR.one() else: return (resPR.zero() if condition(part) else resPR(e(part, n, alphabet))) return parent._apply_module_morphism(self, f)<|docstring|>Expand the symmetric function as a symmetric polynomial in ``n`` variables. INPUT: - ``condition`` -- a function on partitions with a boolean output, selecting only certain terms (namely, only the items failing the condition are being expanded) - ``n`` -- a nonnegative integer - ``alphabet`` -- (default: ``'x'``) a variable for the expansion OUTPUT: A monomial expansion of an instance of ``self`` in `n` variables. EXAMPLES:: sage: p = SymmetricFunctions(QQ).p() sage: a = p([2])+p([3]) sage: a._expand(lambda part: False, 3) x0^3 + x1^3 + x2^3 + x0^2 + x1^2 + x2^2 sage: a._expand(lambda part: max(part)>2, 3) x0^2 + x1^2 + x2^2 sage: p(0).expand(3) 0 sage: p([]).expand(3) 1 .. NOTE:: The term corresponding to the empty partition is always selected, even if ``condition`` returns ``False`` or an error when applied to the empty partition. This is in order to simplify using the ``_expand`` method with conditions like ``lambda part: max(part) < 3`` which would require extra work to handle the empty partition.<|endoftext|>
4834db11b9cce49f14e6dc990927be6e9caf3ae96c622802d625559c1a2793fd
def is_schur_positive(self): "\n Return ``True`` if and only if ``self`` is Schur positive.\n\n If `s` is the space of Schur functions over ``self``'s base ring, then\n this is the same as ``self._is_positive(s)``.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1]) + s([3])\n sage: a.is_schur_positive()\n True\n sage: a = s([2,1]) - s([3])\n sage: a.is_schur_positive()\n False\n\n ::\n\n sage: QQx = QQ['x']\n sage: s = SymmetricFunctions(QQx).s()\n sage: x = QQx.gen()\n sage: a = (1+x)*s([2,1])\n sage: a.is_schur_positive()\n True\n sage: a = (1-x)*s([2,1])\n sage: a.is_schur_positive()\n False\n sage: s(0).is_schur_positive()\n True\n sage: s(1+x).is_schur_positive()\n True\n " return self._is_positive(self.parent().realization_of().schur())
Return ``True`` if and only if ``self`` is Schur positive. If `s` is the space of Schur functions over ``self``'s base ring, then this is the same as ``self._is_positive(s)``. EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) + s([3]) sage: a.is_schur_positive() True sage: a = s([2,1]) - s([3]) sage: a.is_schur_positive() False :: sage: QQx = QQ['x'] sage: s = SymmetricFunctions(QQx).s() sage: x = QQx.gen() sage: a = (1+x)*s([2,1]) sage: a.is_schur_positive() True sage: a = (1-x)*s([2,1]) sage: a.is_schur_positive() False sage: s(0).is_schur_positive() True sage: s(1+x).is_schur_positive() True
src/sage/combinat/sf/sfa.py
is_schur_positive
bopopescu/sagesmc
5
python
def is_schur_positive(self): "\n Return ``True`` if and only if ``self`` is Schur positive.\n\n If `s` is the space of Schur functions over ``self``'s base ring, then\n this is the same as ``self._is_positive(s)``.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1]) + s([3])\n sage: a.is_schur_positive()\n True\n sage: a = s([2,1]) - s([3])\n sage: a.is_schur_positive()\n False\n\n ::\n\n sage: QQx = QQ['x']\n sage: s = SymmetricFunctions(QQx).s()\n sage: x = QQx.gen()\n sage: a = (1+x)*s([2,1])\n sage: a.is_schur_positive()\n True\n sage: a = (1-x)*s([2,1])\n sage: a.is_schur_positive()\n False\n sage: s(0).is_schur_positive()\n True\n sage: s(1+x).is_schur_positive()\n True\n " return self._is_positive(self.parent().realization_of().schur())
def is_schur_positive(self): "\n Return ``True`` if and only if ``self`` is Schur positive.\n\n If `s` is the space of Schur functions over ``self``'s base ring, then\n this is the same as ``self._is_positive(s)``.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1]) + s([3])\n sage: a.is_schur_positive()\n True\n sage: a = s([2,1]) - s([3])\n sage: a.is_schur_positive()\n False\n\n ::\n\n sage: QQx = QQ['x']\n sage: s = SymmetricFunctions(QQx).s()\n sage: x = QQx.gen()\n sage: a = (1+x)*s([2,1])\n sage: a.is_schur_positive()\n True\n sage: a = (1-x)*s([2,1])\n sage: a.is_schur_positive()\n False\n sage: s(0).is_schur_positive()\n True\n sage: s(1+x).is_schur_positive()\n True\n " return self._is_positive(self.parent().realization_of().schur())<|docstring|>Return ``True`` if and only if ``self`` is Schur positive. If `s` is the space of Schur functions over ``self``'s base ring, then this is the same as ``self._is_positive(s)``. EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) + s([3]) sage: a.is_schur_positive() True sage: a = s([2,1]) - s([3]) sage: a.is_schur_positive() False :: sage: QQx = QQ['x'] sage: s = SymmetricFunctions(QQx).s() sage: x = QQx.gen() sage: a = (1+x)*s([2,1]) sage: a.is_schur_positive() True sage: a = (1-x)*s([2,1]) sage: a.is_schur_positive() False sage: s(0).is_schur_positive() True sage: s(1+x).is_schur_positive() True<|endoftext|>
6e6e2a5311f931bde5e9eadacb25ede375460ffd86c068bad67734af86bf1906
def _is_positive(self, s): '\n Return ``True`` if and only if ``self`` has nonnegative coefficients\n in the basis `s`.\n\n INPUT:\n\n - ``s`` -- a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1]) + s([3])\n sage: a._is_positive(s)\n True\n sage: a = s([2,1]) - s([3])\n sage: a._is_positive(s)\n False\n\n sage: m = SymmetricFunctions(QQ).m()\n sage: a = s([2,1]) + s([3])\n sage: a._is_positive(m)\n True\n sage: a = -s[2,1]\n sage: a._is_positive(m)\n False\n\n sage: (s[2,1] - s[1,1,1])._is_positive(s)\n False\n sage: (s[2,1] - s[1,1,1])._is_positive(m)\n True\n ' s_self = s(self) return all([_nonnegative_coefficients(c) for c in s_self.coefficients()])
Return ``True`` if and only if ``self`` has nonnegative coefficients in the basis `s`. INPUT: - ``s`` -- a basis of the ring of symmetric functions EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) + s([3]) sage: a._is_positive(s) True sage: a = s([2,1]) - s([3]) sage: a._is_positive(s) False sage: m = SymmetricFunctions(QQ).m() sage: a = s([2,1]) + s([3]) sage: a._is_positive(m) True sage: a = -s[2,1] sage: a._is_positive(m) False sage: (s[2,1] - s[1,1,1])._is_positive(s) False sage: (s[2,1] - s[1,1,1])._is_positive(m) True
src/sage/combinat/sf/sfa.py
_is_positive
bopopescu/sagesmc
5
python
def _is_positive(self, s): '\n Return ``True`` if and only if ``self`` has nonnegative coefficients\n in the basis `s`.\n\n INPUT:\n\n - ``s`` -- a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1]) + s([3])\n sage: a._is_positive(s)\n True\n sage: a = s([2,1]) - s([3])\n sage: a._is_positive(s)\n False\n\n sage: m = SymmetricFunctions(QQ).m()\n sage: a = s([2,1]) + s([3])\n sage: a._is_positive(m)\n True\n sage: a = -s[2,1]\n sage: a._is_positive(m)\n False\n\n sage: (s[2,1] - s[1,1,1])._is_positive(s)\n False\n sage: (s[2,1] - s[1,1,1])._is_positive(m)\n True\n ' s_self = s(self) return all([_nonnegative_coefficients(c) for c in s_self.coefficients()])
def _is_positive(self, s): '\n Return ``True`` if and only if ``self`` has nonnegative coefficients\n in the basis `s`.\n\n INPUT:\n\n - ``s`` -- a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: a = s([2,1]) + s([3])\n sage: a._is_positive(s)\n True\n sage: a = s([2,1]) - s([3])\n sage: a._is_positive(s)\n False\n\n sage: m = SymmetricFunctions(QQ).m()\n sage: a = s([2,1]) + s([3])\n sage: a._is_positive(m)\n True\n sage: a = -s[2,1]\n sage: a._is_positive(m)\n False\n\n sage: (s[2,1] - s[1,1,1])._is_positive(s)\n False\n sage: (s[2,1] - s[1,1,1])._is_positive(m)\n True\n ' s_self = s(self) return all([_nonnegative_coefficients(c) for c in s_self.coefficients()])<|docstring|>Return ``True`` if and only if ``self`` has nonnegative coefficients in the basis `s`. INPUT: - ``s`` -- a basis of the ring of symmetric functions EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: a = s([2,1]) + s([3]) sage: a._is_positive(s) True sage: a = s([2,1]) - s([3]) sage: a._is_positive(s) False sage: m = SymmetricFunctions(QQ).m() sage: a = s([2,1]) + s([3]) sage: a._is_positive(m) True sage: a = -s[2,1] sage: a._is_positive(m) False sage: (s[2,1] - s[1,1,1])._is_positive(s) False sage: (s[2,1] - s[1,1,1])._is_positive(m) True<|endoftext|>
5aff2ee6990164bd79043c9d152e77465a185e80513f94d2a69c2a96fbdce681
def degree(self): '\n Return the degree of ``self`` (which is defined to be `0`\n for the zero element).\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) + 3\n sage: z.degree()\n 4\n sage: s(1).degree()\n 0\n sage: s(0).degree()\n 0\n ' return max((map(sum, self._monomial_coefficients) + [0]))
Return the degree of ``self`` (which is defined to be `0` for the zero element). EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) + 3 sage: z.degree() 4 sage: s(1).degree() 0 sage: s(0).degree() 0
src/sage/combinat/sf/sfa.py
degree
bopopescu/sagesmc
5
python
def degree(self): '\n Return the degree of ``self`` (which is defined to be `0`\n for the zero element).\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) + 3\n sage: z.degree()\n 4\n sage: s(1).degree()\n 0\n sage: s(0).degree()\n 0\n ' return max((map(sum, self._monomial_coefficients) + [0]))
def degree(self): '\n Return the degree of ``self`` (which is defined to be `0`\n for the zero element).\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) + 3\n sage: z.degree()\n 4\n sage: s(1).degree()\n 0\n sage: s(0).degree()\n 0\n ' return max((map(sum, self._monomial_coefficients) + [0]))<|docstring|>Return the degree of ``self`` (which is defined to be `0` for the zero element). EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) + 3 sage: z.degree() 4 sage: s(1).degree() 0 sage: s(0).degree() 0<|endoftext|>
afa8029488bf424e1aa619e0c8af5f06f38840385b13b57c63cda85754eb73d6
def restrict_degree(self, d, exact=True): '\n Return the degree ``d`` component of ``self``.\n\n INPUT:\n\n - ``d`` -- positive integer, degree of the terms to be returned\n\n - ``exact`` -- boolean, if ``True``, returns the terms of degree\n exactly ``d``, otherwise returns all terms of degree less than\n or equal to ``d``\n\n OUTPUT:\n\n - the homogeneous component of ``self`` of degree ``d``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_degree(2)\n 0\n sage: z.restrict_degree(1)\n s[1]\n sage: z.restrict_degree(3)\n s[1, 1, 1] + s[2, 1]\n sage: z.restrict_degree(3, exact=False)\n s[1] + s[1, 1, 1] + s[2, 1]\n sage: z.restrict_degree(0)\n 0\n ' if exact: res = dict(filter((lambda x: (sum(x[0]) == d)), self._monomial_coefficients.items())) else: res = dict(filter((lambda x: (sum(x[0]) <= d)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)
Return the degree ``d`` component of ``self``. INPUT: - ``d`` -- positive integer, degree of the terms to be returned - ``exact`` -- boolean, if ``True``, returns the terms of degree exactly ``d``, otherwise returns all terms of degree less than or equal to ``d`` OUTPUT: - the homogeneous component of ``self`` of degree ``d`` EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) sage: z.restrict_degree(2) 0 sage: z.restrict_degree(1) s[1] sage: z.restrict_degree(3) s[1, 1, 1] + s[2, 1] sage: z.restrict_degree(3, exact=False) s[1] + s[1, 1, 1] + s[2, 1] sage: z.restrict_degree(0) 0
src/sage/combinat/sf/sfa.py
restrict_degree
bopopescu/sagesmc
5
python
def restrict_degree(self, d, exact=True): '\n Return the degree ``d`` component of ``self``.\n\n INPUT:\n\n - ``d`` -- positive integer, degree of the terms to be returned\n\n - ``exact`` -- boolean, if ``True``, returns the terms of degree\n exactly ``d``, otherwise returns all terms of degree less than\n or equal to ``d``\n\n OUTPUT:\n\n - the homogeneous component of ``self`` of degree ``d``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_degree(2)\n 0\n sage: z.restrict_degree(1)\n s[1]\n sage: z.restrict_degree(3)\n s[1, 1, 1] + s[2, 1]\n sage: z.restrict_degree(3, exact=False)\n s[1] + s[1, 1, 1] + s[2, 1]\n sage: z.restrict_degree(0)\n 0\n ' if exact: res = dict(filter((lambda x: (sum(x[0]) == d)), self._monomial_coefficients.items())) else: res = dict(filter((lambda x: (sum(x[0]) <= d)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)
def restrict_degree(self, d, exact=True): '\n Return the degree ``d`` component of ``self``.\n\n INPUT:\n\n - ``d`` -- positive integer, degree of the terms to be returned\n\n - ``exact`` -- boolean, if ``True``, returns the terms of degree\n exactly ``d``, otherwise returns all terms of degree less than\n or equal to ``d``\n\n OUTPUT:\n\n - the homogeneous component of ``self`` of degree ``d``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_degree(2)\n 0\n sage: z.restrict_degree(1)\n s[1]\n sage: z.restrict_degree(3)\n s[1, 1, 1] + s[2, 1]\n sage: z.restrict_degree(3, exact=False)\n s[1] + s[1, 1, 1] + s[2, 1]\n sage: z.restrict_degree(0)\n 0\n ' if exact: res = dict(filter((lambda x: (sum(x[0]) == d)), self._monomial_coefficients.items())) else: res = dict(filter((lambda x: (sum(x[0]) <= d)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)<|docstring|>Return the degree ``d`` component of ``self``. INPUT: - ``d`` -- positive integer, degree of the terms to be returned - ``exact`` -- boolean, if ``True``, returns the terms of degree exactly ``d``, otherwise returns all terms of degree less than or equal to ``d`` OUTPUT: - the homogeneous component of ``self`` of degree ``d`` EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) sage: z.restrict_degree(2) 0 sage: z.restrict_degree(1) s[1] sage: z.restrict_degree(3) s[1, 1, 1] + s[2, 1] sage: z.restrict_degree(3, exact=False) s[1] + s[1, 1, 1] + s[2, 1] sage: z.restrict_degree(0) 0<|endoftext|>
1838a115eec37f24dfe0ee988f3e5e583c6a902d5dc731d9b66cbc0acc1fd17e
def restrict_partition_lengths(self, l, exact=True): '\n Return the terms of ``self`` labelled by partitions of length ``l``.\n\n INPUT:\n\n - ``l`` -- nonnegative integer\n\n - ``exact`` -- boolean, defaulting to ``True``\n\n OUTPUT:\n\n - if ``True``, returns the terms labelled by\n partitions of length precisely ``l``; otherwise returns all terms\n labelled by partitions of length less than or equal to ``l``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_partition_lengths(2)\n s[2, 1]\n sage: z.restrict_partition_lengths(0)\n 0\n sage: z.restrict_partition_lengths(2, exact = False)\n s[1] + s[2, 1] + s[4]\n ' if exact: res = dict(filter((lambda x: (len(x[0]) == l)), self._monomial_coefficients.items())) else: res = dict(filter((lambda x: (len(x[0]) <= l)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)
Return the terms of ``self`` labelled by partitions of length ``l``. INPUT: - ``l`` -- nonnegative integer - ``exact`` -- boolean, defaulting to ``True`` OUTPUT: - if ``True``, returns the terms labelled by partitions of length precisely ``l``; otherwise returns all terms labelled by partitions of length less than or equal to ``l`` EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) sage: z.restrict_partition_lengths(2) s[2, 1] sage: z.restrict_partition_lengths(0) 0 sage: z.restrict_partition_lengths(2, exact = False) s[1] + s[2, 1] + s[4]
src/sage/combinat/sf/sfa.py
restrict_partition_lengths
bopopescu/sagesmc
5
python
def restrict_partition_lengths(self, l, exact=True): '\n Return the terms of ``self`` labelled by partitions of length ``l``.\n\n INPUT:\n\n - ``l`` -- nonnegative integer\n\n - ``exact`` -- boolean, defaulting to ``True``\n\n OUTPUT:\n\n - if ``True``, returns the terms labelled by\n partitions of length precisely ``l``; otherwise returns all terms\n labelled by partitions of length less than or equal to ``l``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_partition_lengths(2)\n s[2, 1]\n sage: z.restrict_partition_lengths(0)\n 0\n sage: z.restrict_partition_lengths(2, exact = False)\n s[1] + s[2, 1] + s[4]\n ' if exact: res = dict(filter((lambda x: (len(x[0]) == l)), self._monomial_coefficients.items())) else: res = dict(filter((lambda x: (len(x[0]) <= l)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)
def restrict_partition_lengths(self, l, exact=True): '\n Return the terms of ``self`` labelled by partitions of length ``l``.\n\n INPUT:\n\n - ``l`` -- nonnegative integer\n\n - ``exact`` -- boolean, defaulting to ``True``\n\n OUTPUT:\n\n - if ``True``, returns the terms labelled by\n partitions of length precisely ``l``; otherwise returns all terms\n labelled by partitions of length less than or equal to ``l``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_partition_lengths(2)\n s[2, 1]\n sage: z.restrict_partition_lengths(0)\n 0\n sage: z.restrict_partition_lengths(2, exact = False)\n s[1] + s[2, 1] + s[4]\n ' if exact: res = dict(filter((lambda x: (len(x[0]) == l)), self._monomial_coefficients.items())) else: res = dict(filter((lambda x: (len(x[0]) <= l)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)<|docstring|>Return the terms of ``self`` labelled by partitions of length ``l``. INPUT: - ``l`` -- nonnegative integer - ``exact`` -- boolean, defaulting to ``True`` OUTPUT: - if ``True``, returns the terms labelled by partitions of length precisely ``l``; otherwise returns all terms labelled by partitions of length less than or equal to ``l`` EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) sage: z.restrict_partition_lengths(2) s[2, 1] sage: z.restrict_partition_lengths(0) 0 sage: z.restrict_partition_lengths(2, exact = False) s[1] + s[2, 1] + s[4]<|endoftext|>
87303d5ac3ecb9d62cf9a54dec9e8b0993fe5968efc533a5c30856c18fb45132
def restrict_parts(self, n): '\n Return the terms of ``self`` labelled by partitions `\\lambda` with\n `\\lambda_1 \\leq n`.\n\n INPUT:\n\n - ``n`` -- positive integer, to restrict the parts of the partitions\n of the terms to be returned\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_parts(2)\n s[1] + s[1, 1, 1] + s[2, 1]\n sage: z.restrict_parts(1)\n s[1] + s[1, 1, 1]\n ' res = dict(filter((lambda x: (_lmax(x[0]) <= n)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)
Return the terms of ``self`` labelled by partitions `\lambda` with `\lambda_1 \leq n`. INPUT: - ``n`` -- positive integer, to restrict the parts of the partitions of the terms to be returned EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) sage: z.restrict_parts(2) s[1] + s[1, 1, 1] + s[2, 1] sage: z.restrict_parts(1) s[1] + s[1, 1, 1]
src/sage/combinat/sf/sfa.py
restrict_parts
bopopescu/sagesmc
5
python
def restrict_parts(self, n): '\n Return the terms of ``self`` labelled by partitions `\\lambda` with\n `\\lambda_1 \\leq n`.\n\n INPUT:\n\n - ``n`` -- positive integer, to restrict the parts of the partitions\n of the terms to be returned\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_parts(2)\n s[1] + s[1, 1, 1] + s[2, 1]\n sage: z.restrict_parts(1)\n s[1] + s[1, 1, 1]\n ' res = dict(filter((lambda x: (_lmax(x[0]) <= n)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)
def restrict_parts(self, n): '\n Return the terms of ``self`` labelled by partitions `\\lambda` with\n `\\lambda_1 \\leq n`.\n\n INPUT:\n\n - ``n`` -- positive integer, to restrict the parts of the partitions\n of the terms to be returned\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1])\n sage: z.restrict_parts(2)\n s[1] + s[1, 1, 1] + s[2, 1]\n sage: z.restrict_parts(1)\n s[1] + s[1, 1, 1]\n ' res = dict(filter((lambda x: (_lmax(x[0]) <= n)), self._monomial_coefficients.items())) return self.parent()._from_dict(res)<|docstring|>Return the terms of ``self`` labelled by partitions `\lambda` with `\lambda_1 \leq n`. INPUT: - ``n`` -- positive integer, to restrict the parts of the partitions of the terms to be returned EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: z = s([4]) + s([2,1]) + s([1,1,1]) + s([1]) sage: z.restrict_parts(2) s[1] + s[1, 1, 1] + s[2, 1] sage: z.restrict_parts(1) s[1] + s[1, 1, 1]<|endoftext|>
1bbbe6d0708227a96af868f10bdf3bf7769863e6f75161e0ef9858470ca7bb14
def expand(self, n, alphabet='x'): "\n Expand the symmetric function as a symmetric polynomial in ``n``\n variables.\n\n INPUT:\n\n - ``n`` -- a nonnegative integer\n\n - ``alphabet`` -- (default: ``'x'``) a variable for the expansion\n\n OUTPUT:\n\n A monomial expansion of an instance of ``self`` in `n` variables.\n\n EXAMPLES::\n\n sage: J = SymmetricFunctions(QQ).jack(t=2).J()\n sage: J([2,1]).expand(3)\n 4*x0^2*x1 + 4*x0*x1^2 + 4*x0^2*x2 + 6*x0*x1*x2 + 4*x1^2*x2 + 4*x0*x2^2 + 4*x1*x2^2\n " s = self.parent().realization_of().schur() condition = (lambda part: (len(part) > n)) return s(self)._expand(condition, n, alphabet)
Expand the symmetric function as a symmetric polynomial in ``n`` variables. INPUT: - ``n`` -- a nonnegative integer - ``alphabet`` -- (default: ``'x'``) a variable for the expansion OUTPUT: A monomial expansion of an instance of ``self`` in `n` variables. EXAMPLES:: sage: J = SymmetricFunctions(QQ).jack(t=2).J() sage: J([2,1]).expand(3) 4*x0^2*x1 + 4*x0*x1^2 + 4*x0^2*x2 + 6*x0*x1*x2 + 4*x1^2*x2 + 4*x0*x2^2 + 4*x1*x2^2
src/sage/combinat/sf/sfa.py
expand
bopopescu/sagesmc
5
python
def expand(self, n, alphabet='x'): "\n Expand the symmetric function as a symmetric polynomial in ``n``\n variables.\n\n INPUT:\n\n - ``n`` -- a nonnegative integer\n\n - ``alphabet`` -- (default: ``'x'``) a variable for the expansion\n\n OUTPUT:\n\n A monomial expansion of an instance of ``self`` in `n` variables.\n\n EXAMPLES::\n\n sage: J = SymmetricFunctions(QQ).jack(t=2).J()\n sage: J([2,1]).expand(3)\n 4*x0^2*x1 + 4*x0*x1^2 + 4*x0^2*x2 + 6*x0*x1*x2 + 4*x1^2*x2 + 4*x0*x2^2 + 4*x1*x2^2\n " s = self.parent().realization_of().schur() condition = (lambda part: (len(part) > n)) return s(self)._expand(condition, n, alphabet)
def expand(self, n, alphabet='x'): "\n Expand the symmetric function as a symmetric polynomial in ``n``\n variables.\n\n INPUT:\n\n - ``n`` -- a nonnegative integer\n\n - ``alphabet`` -- (default: ``'x'``) a variable for the expansion\n\n OUTPUT:\n\n A monomial expansion of an instance of ``self`` in `n` variables.\n\n EXAMPLES::\n\n sage: J = SymmetricFunctions(QQ).jack(t=2).J()\n sage: J([2,1]).expand(3)\n 4*x0^2*x1 + 4*x0*x1^2 + 4*x0^2*x2 + 6*x0*x1*x2 + 4*x1^2*x2 + 4*x0*x2^2 + 4*x1*x2^2\n " s = self.parent().realization_of().schur() condition = (lambda part: (len(part) > n)) return s(self)._expand(condition, n, alphabet)<|docstring|>Expand the symmetric function as a symmetric polynomial in ``n`` variables. INPUT: - ``n`` -- a nonnegative integer - ``alphabet`` -- (default: ``'x'``) a variable for the expansion OUTPUT: A monomial expansion of an instance of ``self`` in `n` variables. EXAMPLES:: sage: J = SymmetricFunctions(QQ).jack(t=2).J() sage: J([2,1]).expand(3) 4*x0^2*x1 + 4*x0*x1^2 + 4*x0^2*x2 + 6*x0*x1*x2 + 4*x1^2*x2 + 4*x0*x2^2 + 4*x1*x2^2<|endoftext|>
fbc19ef3ef1a074ebcaec913339f865d939c40712a04873c52a4a44e7d652056
def skew_by(self, x): '\n Return the result of skewing ``self`` by ``x``. (Skewing by ``x`` is\n the endomorphism (as additive group) of the ring of symmetric\n functions adjoint to multiplication by ``x`` with respect to the\n Hall inner product.)\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([3,2]).skew_by(s([2]))\n s[2, 1] + s[3]\n sage: s([3,2]).skew_by(s([1,1,1]))\n 0\n sage: s([3,2,1]).skew_by(s([2,1]))\n s[1, 1, 1] + 2*s[2, 1] + s[3]\n\n ::\n\n sage: p = SymmetricFunctions(QQ).powersum()\n sage: p([4,3,3,2,2,1]).skew_by(p([2,1]))\n 4*p[4, 3, 3, 2]\n sage: zee = sage.combinat.sf.sfa.zee\n sage: zee([4,3,3,2,2,1])/zee([4,3,3,2])\n 4\n sage: s(0).skew_by(s([1]))\n 0\n sage: s(1).skew_by(s([1]))\n 0\n sage: s([]).skew_by(s([]))\n s[]\n sage: s([]).skew_by(s[1])\n 0\n\n TESTS::\n\n sage: f=s[3,2]\n sage: f.skew_by([1])\n Traceback (most recent call last):\n ...\n ValueError: x needs to be a symmetric function\n ' if (x not in self.parent().realization_of()): raise ValueError('x needs to be a symmetric function') s = self.parent().realization_of().schur() f = (lambda part1, part2: (s([part1, part2]) if part1.contains(part2) else 0)) return self.parent()(s._apply_multi_module_morphism(s(self), s(x), f))
Return the result of skewing ``self`` by ``x``. (Skewing by ``x`` is the endomorphism (as additive group) of the ring of symmetric functions adjoint to multiplication by ``x`` with respect to the Hall inner product.) INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s([3,2]).skew_by(s([2])) s[2, 1] + s[3] sage: s([3,2]).skew_by(s([1,1,1])) 0 sage: s([3,2,1]).skew_by(s([2,1])) s[1, 1, 1] + 2*s[2, 1] + s[3] :: sage: p = SymmetricFunctions(QQ).powersum() sage: p([4,3,3,2,2,1]).skew_by(p([2,1])) 4*p[4, 3, 3, 2] sage: zee = sage.combinat.sf.sfa.zee sage: zee([4,3,3,2,2,1])/zee([4,3,3,2]) 4 sage: s(0).skew_by(s([1])) 0 sage: s(1).skew_by(s([1])) 0 sage: s([]).skew_by(s([])) s[] sage: s([]).skew_by(s[1]) 0 TESTS:: sage: f=s[3,2] sage: f.skew_by([1]) Traceback (most recent call last): ... ValueError: x needs to be a symmetric function
src/sage/combinat/sf/sfa.py
skew_by
bopopescu/sagesmc
5
python
def skew_by(self, x): '\n Return the result of skewing ``self`` by ``x``. (Skewing by ``x`` is\n the endomorphism (as additive group) of the ring of symmetric\n functions adjoint to multiplication by ``x`` with respect to the\n Hall inner product.)\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([3,2]).skew_by(s([2]))\n s[2, 1] + s[3]\n sage: s([3,2]).skew_by(s([1,1,1]))\n 0\n sage: s([3,2,1]).skew_by(s([2,1]))\n s[1, 1, 1] + 2*s[2, 1] + s[3]\n\n ::\n\n sage: p = SymmetricFunctions(QQ).powersum()\n sage: p([4,3,3,2,2,1]).skew_by(p([2,1]))\n 4*p[4, 3, 3, 2]\n sage: zee = sage.combinat.sf.sfa.zee\n sage: zee([4,3,3,2,2,1])/zee([4,3,3,2])\n 4\n sage: s(0).skew_by(s([1]))\n 0\n sage: s(1).skew_by(s([1]))\n 0\n sage: s([]).skew_by(s([]))\n s[]\n sage: s([]).skew_by(s[1])\n 0\n\n TESTS::\n\n sage: f=s[3,2]\n sage: f.skew_by([1])\n Traceback (most recent call last):\n ...\n ValueError: x needs to be a symmetric function\n ' if (x not in self.parent().realization_of()): raise ValueError('x needs to be a symmetric function') s = self.parent().realization_of().schur() f = (lambda part1, part2: (s([part1, part2]) if part1.contains(part2) else 0)) return self.parent()(s._apply_multi_module_morphism(s(self), s(x), f))
def skew_by(self, x): '\n Return the result of skewing ``self`` by ``x``. (Skewing by ``x`` is\n the endomorphism (as additive group) of the ring of symmetric\n functions adjoint to multiplication by ``x`` with respect to the\n Hall inner product.)\n\n INPUT:\n\n - ``x`` -- element of the ring of symmetric functions over the same\n base ring as ``self``\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s([3,2]).skew_by(s([2]))\n s[2, 1] + s[3]\n sage: s([3,2]).skew_by(s([1,1,1]))\n 0\n sage: s([3,2,1]).skew_by(s([2,1]))\n s[1, 1, 1] + 2*s[2, 1] + s[3]\n\n ::\n\n sage: p = SymmetricFunctions(QQ).powersum()\n sage: p([4,3,3,2,2,1]).skew_by(p([2,1]))\n 4*p[4, 3, 3, 2]\n sage: zee = sage.combinat.sf.sfa.zee\n sage: zee([4,3,3,2,2,1])/zee([4,3,3,2])\n 4\n sage: s(0).skew_by(s([1]))\n 0\n sage: s(1).skew_by(s([1]))\n 0\n sage: s([]).skew_by(s([]))\n s[]\n sage: s([]).skew_by(s[1])\n 0\n\n TESTS::\n\n sage: f=s[3,2]\n sage: f.skew_by([1])\n Traceback (most recent call last):\n ...\n ValueError: x needs to be a symmetric function\n ' if (x not in self.parent().realization_of()): raise ValueError('x needs to be a symmetric function') s = self.parent().realization_of().schur() f = (lambda part1, part2: (s([part1, part2]) if part1.contains(part2) else 0)) return self.parent()(s._apply_multi_module_morphism(s(self), s(x), f))<|docstring|>Return the result of skewing ``self`` by ``x``. (Skewing by ``x`` is the endomorphism (as additive group) of the ring of symmetric functions adjoint to multiplication by ``x`` with respect to the Hall inner product.) INPUT: - ``x`` -- element of the ring of symmetric functions over the same base ring as ``self`` EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s([3,2]).skew_by(s([2])) s[2, 1] + s[3] sage: s([3,2]).skew_by(s([1,1,1])) 0 sage: s([3,2,1]).skew_by(s([2,1])) s[1, 1, 1] + 2*s[2, 1] + s[3] :: sage: p = SymmetricFunctions(QQ).powersum() sage: p([4,3,3,2,2,1]).skew_by(p([2,1])) 4*p[4, 3, 3, 2] sage: zee = sage.combinat.sf.sfa.zee sage: zee([4,3,3,2,2,1])/zee([4,3,3,2]) 4 sage: s(0).skew_by(s([1])) 0 sage: s(1).skew_by(s([1])) 0 sage: s([]).skew_by(s([])) s[] sage: s([]).skew_by(s[1]) 0 TESTS:: sage: f=s[3,2] sage: f.skew_by([1]) Traceback (most recent call last): ... ValueError: x needs to be a symmetric function<|endoftext|>
c8a52ae3f633ad5e0a33dc22246faf8819c2694189783cd24a0088a502c146a7
def hl_creation_operator(self, nu, t=None): "\n This is the vertex operator that generalizes Jing's operator.\n\n It is a linear operator that raises the degree by\n `|\\nu|`. This creation operator is a t-analogue of\n multiplication by ``s(nu)`` .\n\n .. SEEALSO:: Proposition 5 in [SZ2001]_.\n\n INPUT:\n\n - ``nu`` -- a partition\n\n - ``t`` -- (default: ``None``, in which case ``t`` is used) a parameter\n\n REFERENCES:\n\n .. [SZ2001] M. Shimozono, M. Zabrocki,\n Hall-Littlewood vertex operators and generalized Kostka polynomials.\n Adv. Math. 158 (2001), no. 1, 66-85.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ['t']).s()\n sage: s([2]).hl_creation_operator([3,2])\n s[3, 2, 2] + t*s[3, 3, 1] + t*s[4, 2, 1] + t^2*s[4, 3] + t^2*s[5, 2]\n\n sage: Sym = SymmetricFunctions(FractionField(QQ['t']))\n sage: HLQp = Sym.hall_littlewood().Qp()\n sage: s = Sym.s()\n sage: HLQp(s([2]).hl_creation_operator([2]).hl_creation_operator([3]))\n HLQp[3, 2, 2]\n sage: s([2,2]).hl_creation_operator([2,1])\n t*s[2, 2, 2, 1] + t^2*s[3, 2, 1, 1] + t^2*s[3, 2, 2] + t^3*s[3, 3, 1] + t^3*s[4, 2, 1] + t^4*s[4, 3]\n sage: s(1).hl_creation_operator([2,1,1])\n s[2, 1, 1]\n sage: s(0).hl_creation_operator([2,1,1])\n 0\n sage: s([3,2]).hl_creation_operator([2,1,1])\n (t^2-t)*s[2, 2, 2, 2, 1] + t^3*s[3, 2, 2, 1, 1] + (t^3-t^2)*s[3, 2, 2, 2] + t^3*s[3, 3, 1, 1, 1] + t^4*s[3, 3, 2, 1] + t^3*s[4, 2, 1, 1, 1] + t^4*s[4, 2, 2, 1] + 2*t^4*s[4, 3, 1, 1] + t^5*s[4, 3, 2] + t^5*s[4, 4, 1] + t^4*s[5, 2, 1, 1] + t^5*s[5, 3, 1]\n\n TESTS::\n\n sage: s(0).hl_creation_operator([1])\n 0\n " s = self.parent().realization_of().schur() if (t is None): if hasattr(self.parent(), 't'): t = self.parent().t else: t = QQ['t'].gen() P = self.parent() self = s(self) return P(((self * s(nu)) + s.sum(((s.sum_of_terms(((lam, c) for (lam, c) in (s(mu) * s(nu)) if (len(lam) <= len(nu)))) * self.skew_by(s(mu).plethysm(((t - 1) * s([1]))))) for d in range(self.degree()) for mu in Partitions((d + 1), max_length=len(nu))))))
This is the vertex operator that generalizes Jing's operator. It is a linear operator that raises the degree by `|\nu|`. This creation operator is a t-analogue of multiplication by ``s(nu)`` . .. SEEALSO:: Proposition 5 in [SZ2001]_. INPUT: - ``nu`` -- a partition - ``t`` -- (default: ``None``, in which case ``t`` is used) a parameter REFERENCES: .. [SZ2001] M. Shimozono, M. Zabrocki, Hall-Littlewood vertex operators and generalized Kostka polynomials. Adv. Math. 158 (2001), no. 1, 66-85. EXAMPLES:: sage: s = SymmetricFunctions(QQ['t']).s() sage: s([2]).hl_creation_operator([3,2]) s[3, 2, 2] + t*s[3, 3, 1] + t*s[4, 2, 1] + t^2*s[4, 3] + t^2*s[5, 2] sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: HLQp = Sym.hall_littlewood().Qp() sage: s = Sym.s() sage: HLQp(s([2]).hl_creation_operator([2]).hl_creation_operator([3])) HLQp[3, 2, 2] sage: s([2,2]).hl_creation_operator([2,1]) t*s[2, 2, 2, 1] + t^2*s[3, 2, 1, 1] + t^2*s[3, 2, 2] + t^3*s[3, 3, 1] + t^3*s[4, 2, 1] + t^4*s[4, 3] sage: s(1).hl_creation_operator([2,1,1]) s[2, 1, 1] sage: s(0).hl_creation_operator([2,1,1]) 0 sage: s([3,2]).hl_creation_operator([2,1,1]) (t^2-t)*s[2, 2, 2, 2, 1] + t^3*s[3, 2, 2, 1, 1] + (t^3-t^2)*s[3, 2, 2, 2] + t^3*s[3, 3, 1, 1, 1] + t^4*s[3, 3, 2, 1] + t^3*s[4, 2, 1, 1, 1] + t^4*s[4, 2, 2, 1] + 2*t^4*s[4, 3, 1, 1] + t^5*s[4, 3, 2] + t^5*s[4, 4, 1] + t^4*s[5, 2, 1, 1] + t^5*s[5, 3, 1] TESTS:: sage: s(0).hl_creation_operator([1]) 0
src/sage/combinat/sf/sfa.py
hl_creation_operator
bopopescu/sagesmc
5
python
def hl_creation_operator(self, nu, t=None): "\n This is the vertex operator that generalizes Jing's operator.\n\n It is a linear operator that raises the degree by\n `|\\nu|`. This creation operator is a t-analogue of\n multiplication by ``s(nu)`` .\n\n .. SEEALSO:: Proposition 5 in [SZ2001]_.\n\n INPUT:\n\n - ``nu`` -- a partition\n\n - ``t`` -- (default: ``None``, in which case ``t`` is used) a parameter\n\n REFERENCES:\n\n .. [SZ2001] M. Shimozono, M. Zabrocki,\n Hall-Littlewood vertex operators and generalized Kostka polynomials.\n Adv. Math. 158 (2001), no. 1, 66-85.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ['t']).s()\n sage: s([2]).hl_creation_operator([3,2])\n s[3, 2, 2] + t*s[3, 3, 1] + t*s[4, 2, 1] + t^2*s[4, 3] + t^2*s[5, 2]\n\n sage: Sym = SymmetricFunctions(FractionField(QQ['t']))\n sage: HLQp = Sym.hall_littlewood().Qp()\n sage: s = Sym.s()\n sage: HLQp(s([2]).hl_creation_operator([2]).hl_creation_operator([3]))\n HLQp[3, 2, 2]\n sage: s([2,2]).hl_creation_operator([2,1])\n t*s[2, 2, 2, 1] + t^2*s[3, 2, 1, 1] + t^2*s[3, 2, 2] + t^3*s[3, 3, 1] + t^3*s[4, 2, 1] + t^4*s[4, 3]\n sage: s(1).hl_creation_operator([2,1,1])\n s[2, 1, 1]\n sage: s(0).hl_creation_operator([2,1,1])\n 0\n sage: s([3,2]).hl_creation_operator([2,1,1])\n (t^2-t)*s[2, 2, 2, 2, 1] + t^3*s[3, 2, 2, 1, 1] + (t^3-t^2)*s[3, 2, 2, 2] + t^3*s[3, 3, 1, 1, 1] + t^4*s[3, 3, 2, 1] + t^3*s[4, 2, 1, 1, 1] + t^4*s[4, 2, 2, 1] + 2*t^4*s[4, 3, 1, 1] + t^5*s[4, 3, 2] + t^5*s[4, 4, 1] + t^4*s[5, 2, 1, 1] + t^5*s[5, 3, 1]\n\n TESTS::\n\n sage: s(0).hl_creation_operator([1])\n 0\n " s = self.parent().realization_of().schur() if (t is None): if hasattr(self.parent(), 't'): t = self.parent().t else: t = QQ['t'].gen() P = self.parent() self = s(self) return P(((self * s(nu)) + s.sum(((s.sum_of_terms(((lam, c) for (lam, c) in (s(mu) * s(nu)) if (len(lam) <= len(nu)))) * self.skew_by(s(mu).plethysm(((t - 1) * s([1]))))) for d in range(self.degree()) for mu in Partitions((d + 1), max_length=len(nu))))))
def hl_creation_operator(self, nu, t=None): "\n This is the vertex operator that generalizes Jing's operator.\n\n It is a linear operator that raises the degree by\n `|\\nu|`. This creation operator is a t-analogue of\n multiplication by ``s(nu)`` .\n\n .. SEEALSO:: Proposition 5 in [SZ2001]_.\n\n INPUT:\n\n - ``nu`` -- a partition\n\n - ``t`` -- (default: ``None``, in which case ``t`` is used) a parameter\n\n REFERENCES:\n\n .. [SZ2001] M. Shimozono, M. Zabrocki,\n Hall-Littlewood vertex operators and generalized Kostka polynomials.\n Adv. Math. 158 (2001), no. 1, 66-85.\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ['t']).s()\n sage: s([2]).hl_creation_operator([3,2])\n s[3, 2, 2] + t*s[3, 3, 1] + t*s[4, 2, 1] + t^2*s[4, 3] + t^2*s[5, 2]\n\n sage: Sym = SymmetricFunctions(FractionField(QQ['t']))\n sage: HLQp = Sym.hall_littlewood().Qp()\n sage: s = Sym.s()\n sage: HLQp(s([2]).hl_creation_operator([2]).hl_creation_operator([3]))\n HLQp[3, 2, 2]\n sage: s([2,2]).hl_creation_operator([2,1])\n t*s[2, 2, 2, 1] + t^2*s[3, 2, 1, 1] + t^2*s[3, 2, 2] + t^3*s[3, 3, 1] + t^3*s[4, 2, 1] + t^4*s[4, 3]\n sage: s(1).hl_creation_operator([2,1,1])\n s[2, 1, 1]\n sage: s(0).hl_creation_operator([2,1,1])\n 0\n sage: s([3,2]).hl_creation_operator([2,1,1])\n (t^2-t)*s[2, 2, 2, 2, 1] + t^3*s[3, 2, 2, 1, 1] + (t^3-t^2)*s[3, 2, 2, 2] + t^3*s[3, 3, 1, 1, 1] + t^4*s[3, 3, 2, 1] + t^3*s[4, 2, 1, 1, 1] + t^4*s[4, 2, 2, 1] + 2*t^4*s[4, 3, 1, 1] + t^5*s[4, 3, 2] + t^5*s[4, 4, 1] + t^4*s[5, 2, 1, 1] + t^5*s[5, 3, 1]\n\n TESTS::\n\n sage: s(0).hl_creation_operator([1])\n 0\n " s = self.parent().realization_of().schur() if (t is None): if hasattr(self.parent(), 't'): t = self.parent().t else: t = QQ['t'].gen() P = self.parent() self = s(self) return P(((self * s(nu)) + s.sum(((s.sum_of_terms(((lam, c) for (lam, c) in (s(mu) * s(nu)) if (len(lam) <= len(nu)))) * self.skew_by(s(mu).plethysm(((t - 1) * s([1]))))) for d in range(self.degree()) for mu in Partitions((d + 1), max_length=len(nu))))))<|docstring|>This is the vertex operator that generalizes Jing's operator. It is a linear operator that raises the degree by `|\nu|`. This creation operator is a t-analogue of multiplication by ``s(nu)`` . .. SEEALSO:: Proposition 5 in [SZ2001]_. INPUT: - ``nu`` -- a partition - ``t`` -- (default: ``None``, in which case ``t`` is used) a parameter REFERENCES: .. [SZ2001] M. Shimozono, M. Zabrocki, Hall-Littlewood vertex operators and generalized Kostka polynomials. Adv. Math. 158 (2001), no. 1, 66-85. EXAMPLES:: sage: s = SymmetricFunctions(QQ['t']).s() sage: s([2]).hl_creation_operator([3,2]) s[3, 2, 2] + t*s[3, 3, 1] + t*s[4, 2, 1] + t^2*s[4, 3] + t^2*s[5, 2] sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: HLQp = Sym.hall_littlewood().Qp() sage: s = Sym.s() sage: HLQp(s([2]).hl_creation_operator([2]).hl_creation_operator([3])) HLQp[3, 2, 2] sage: s([2,2]).hl_creation_operator([2,1]) t*s[2, 2, 2, 1] + t^2*s[3, 2, 1, 1] + t^2*s[3, 2, 2] + t^3*s[3, 3, 1] + t^3*s[4, 2, 1] + t^4*s[4, 3] sage: s(1).hl_creation_operator([2,1,1]) s[2, 1, 1] sage: s(0).hl_creation_operator([2,1,1]) 0 sage: s([3,2]).hl_creation_operator([2,1,1]) (t^2-t)*s[2, 2, 2, 2, 1] + t^3*s[3, 2, 2, 1, 1] + (t^3-t^2)*s[3, 2, 2, 2] + t^3*s[3, 3, 1, 1, 1] + t^4*s[3, 3, 2, 1] + t^3*s[4, 2, 1, 1, 1] + t^4*s[4, 2, 2, 1] + 2*t^4*s[4, 3, 1, 1] + t^5*s[4, 3, 2] + t^5*s[4, 4, 1] + t^4*s[5, 2, 1, 1] + t^5*s[5, 3, 1] TESTS:: sage: s(0).hl_creation_operator([1]) 0<|endoftext|>
3d8fa118d41054cf32e963b0598a0baeed982acc64d386f3db295a959ad43b3e
def is_integral_domain(self, proof=True): '\n Return whether ``self`` is an integral domain. (It is if\n and only if the base ring is an integral domain.)\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``proof`` -- an optional argument (default value: ``True``)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_integral_domain()\n True\n\n The following doctest is disabled pending :trac:`10963`::\n\n sage: s = SymmetricFunctions(Zmod(14)).s() # not tested\n sage: s.is_integral_domain() # not tested\n False\n ' return self.base_ring().is_integral_domain()
Return whether ``self`` is an integral domain. (It is if and only if the base ring is an integral domain.) INPUT: - ``self`` -- a basis of the symmetric functions - ``proof`` -- an optional argument (default value: ``True``) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s.is_integral_domain() True The following doctest is disabled pending :trac:`10963`:: sage: s = SymmetricFunctions(Zmod(14)).s() # not tested sage: s.is_integral_domain() # not tested False
src/sage/combinat/sf/sfa.py
is_integral_domain
bopopescu/sagesmc
5
python
def is_integral_domain(self, proof=True): '\n Return whether ``self`` is an integral domain. (It is if\n and only if the base ring is an integral domain.)\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``proof`` -- an optional argument (default value: ``True``)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_integral_domain()\n True\n\n The following doctest is disabled pending :trac:`10963`::\n\n sage: s = SymmetricFunctions(Zmod(14)).s() # not tested\n sage: s.is_integral_domain() # not tested\n False\n ' return self.base_ring().is_integral_domain()
def is_integral_domain(self, proof=True): '\n Return whether ``self`` is an integral domain. (It is if\n and only if the base ring is an integral domain.)\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``proof`` -- an optional argument (default value: ``True``)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_integral_domain()\n True\n\n The following doctest is disabled pending :trac:`10963`::\n\n sage: s = SymmetricFunctions(Zmod(14)).s() # not tested\n sage: s.is_integral_domain() # not tested\n False\n ' return self.base_ring().is_integral_domain()<|docstring|>Return whether ``self`` is an integral domain. (It is if and only if the base ring is an integral domain.) INPUT: - ``self`` -- a basis of the symmetric functions - ``proof`` -- an optional argument (default value: ``True``) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s.is_integral_domain() True The following doctest is disabled pending :trac:`10963`:: sage: s = SymmetricFunctions(Zmod(14)).s() # not tested sage: s.is_integral_domain() # not tested False<|endoftext|>
3c649586bb6875f1b8d6dd972c4f6faf72143348e3b6541a97eed873c3c24ac6
def is_field(self, proof=True): '\n Return whether ``self`` is a field. (It is not.)\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``proof`` -- an optional argument (default value: ``True``)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_field()\n False\n ' return False
Return whether ``self`` is a field. (It is not.) INPUT: - ``self`` -- a basis of the symmetric functions - ``proof`` -- an optional argument (default value: ``True``) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s.is_field() False
src/sage/combinat/sf/sfa.py
is_field
bopopescu/sagesmc
5
python
def is_field(self, proof=True): '\n Return whether ``self`` is a field. (It is not.)\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``proof`` -- an optional argument (default value: ``True``)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_field()\n False\n ' return False
def is_field(self, proof=True): '\n Return whether ``self`` is a field. (It is not.)\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``proof`` -- an optional argument (default value: ``True``)\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_field()\n False\n ' return False<|docstring|>Return whether ``self`` is a field. (It is not.) INPUT: - ``self`` -- a basis of the symmetric functions - ``proof`` -- an optional argument (default value: ``True``) EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s.is_field() False<|endoftext|>
7698d217483a5760dd84d96c78b2e7db8cb59e78063492ce43397e7ea05d7e04
def is_commutative(self): '\n Returns whether this symmetric function algebra is commutative.\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_commutative()\n True\n ' return self.base_ring().is_commutative()
Returns whether this symmetric function algebra is commutative. INPUT: - ``self`` -- a basis of the symmetric functions EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s.is_commutative() True
src/sage/combinat/sf/sfa.py
is_commutative
bopopescu/sagesmc
5
python
def is_commutative(self): '\n Returns whether this symmetric function algebra is commutative.\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_commutative()\n True\n ' return self.base_ring().is_commutative()
def is_commutative(self): '\n Returns whether this symmetric function algebra is commutative.\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n\n EXAMPLES::\n\n sage: s = SymmetricFunctions(QQ).s()\n sage: s.is_commutative()\n True\n ' return self.base_ring().is_commutative()<|docstring|>Returns whether this symmetric function algebra is commutative. INPUT: - ``self`` -- a basis of the symmetric functions EXAMPLES:: sage: s = SymmetricFunctions(QQ).s() sage: s.is_commutative() True<|endoftext|>
86e4e1e109f4be4593978dccff5517bed67d9958f547b2276d55c483410fa241
def _repr_(self): '\n Text representation of this basis of symmetric functions\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(FractionField(QQ[\'q,t\'])); Sym\n Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: Sym.p()\n Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the powersum basis\n\n In the following examples, we rename {{{Sym}}} for brevity::\n\n sage: Sym.rename("Sym"); Sym\n Sym\n\n Classical bases::\n\n sage: Sym.s()\n Sym in the Schur basis\n sage: Sym.p()\n Sym in the powersum basis\n sage: Sym.m()\n Sym in the monomial basis\n sage: Sym.e()\n Sym in the elementary basis\n sage: Sym.h()\n Sym in the homogeneous basis\n sage: Sym.f()\n Sym in the forgotten basis\n\n Macdonald polynomials::\n\n sage: Sym.macdonald().P()\n Sym in the Macdonald P basis\n sage: Sym.macdonald().Q()\n Sym in the Macdonald Q basis\n sage: Sym.macdonald().J()\n Sym in the Macdonald J basis\n sage: Sym.macdonald().H()\n Sym in the Macdonald H basis\n sage: Sym.macdonald().Ht()\n Sym in the Macdonald Ht basis\n sage: Sym.macdonald().S()\n Sym in the Macdonald S basis\n\n Macdonald polynomials, with specialized parameters::\n\n sage: Sym.macdonald(q=1).S()\n Sym in the Macdonald S with q=1 basis\n sage: Sym.macdonald(q=1,t=3).P()\n Sym in the Macdonald P with q=1 and t=3 basis\n\n Hall-Littlewood polynomials:\n\n sage: Sym.hall_littlewood().P()\n Sym in the Hall-Littlewood P basis\n sage: Sym.hall_littlewood().Q()\n Sym in the Hall-Littlewood Q basis\n sage: Sym.hall_littlewood().Qp()\n Sym in the Hall-Littlewood Qp basis\n\n Hall-Littlewood polynomials, with specialized parameter::\n\n sage: Sym.hall_littlewood(t=1).P()\n Sym in the Hall-Littlewood P with t=1 basis\n\n Jack polynomials::\n\n sage: Sym.jack().J()\n Sym in the Jack J basis\n sage: Sym.jack().P()\n Sym in the Jack P basis\n sage: Sym.jack().Q()\n Sym in the Jack Q basis\n sage: Sym.jack().Qp()\n Sym in the Jack Qp basis\n\n Jack polynomials, with specialized parameter::\n\n sage: Sym.jack(t=1).J()\n Sym in the Jack J with t=1 basis\n\n Zonal polynomials::\n\n sage: Sym.zonal()\n Sym in the zonal basis\n\n LLT polynomials::\n\n sage: Sym.llt(3).hspin()\n Sym in the level 3 LLT spin basis\n sage: Sym.llt(3).hcospin()\n Sym in the level 3 LLT cospin basis\n\n LLT polynomials, with specialized parameter::\n\n sage: Sym.llt(3, t=1).hspin()\n Sym in the level 3 LLT spin with t=1 basis\n sage: Sym.llt(3, t=1).hcospin()\n Sym in the level 3 LLT cospin with t=1 basis\n\n TESTS::\n\n sage: Sym.s()._repr_()\n \'Sym in the Schur basis\'\n sage: Sym.s()._repr_.__module__\n \'sage.combinat.sf.sfa\'\n\n ::\n\n sage: Sym.rename()\n ' return ('%s in the %s basis' % (self.realization_of(), self.basis_name()))
Text representation of this basis of symmetric functions INPUT: - ``self`` -- a basis of the symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field sage: Sym.p() Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the powersum basis In the following examples, we rename {{{Sym}}} for brevity:: sage: Sym.rename("Sym"); Sym Sym Classical bases:: sage: Sym.s() Sym in the Schur basis sage: Sym.p() Sym in the powersum basis sage: Sym.m() Sym in the monomial basis sage: Sym.e() Sym in the elementary basis sage: Sym.h() Sym in the homogeneous basis sage: Sym.f() Sym in the forgotten basis Macdonald polynomials:: sage: Sym.macdonald().P() Sym in the Macdonald P basis sage: Sym.macdonald().Q() Sym in the Macdonald Q basis sage: Sym.macdonald().J() Sym in the Macdonald J basis sage: Sym.macdonald().H() Sym in the Macdonald H basis sage: Sym.macdonald().Ht() Sym in the Macdonald Ht basis sage: Sym.macdonald().S() Sym in the Macdonald S basis Macdonald polynomials, with specialized parameters:: sage: Sym.macdonald(q=1).S() Sym in the Macdonald S with q=1 basis sage: Sym.macdonald(q=1,t=3).P() Sym in the Macdonald P with q=1 and t=3 basis Hall-Littlewood polynomials: sage: Sym.hall_littlewood().P() Sym in the Hall-Littlewood P basis sage: Sym.hall_littlewood().Q() Sym in the Hall-Littlewood Q basis sage: Sym.hall_littlewood().Qp() Sym in the Hall-Littlewood Qp basis Hall-Littlewood polynomials, with specialized parameter:: sage: Sym.hall_littlewood(t=1).P() Sym in the Hall-Littlewood P with t=1 basis Jack polynomials:: sage: Sym.jack().J() Sym in the Jack J basis sage: Sym.jack().P() Sym in the Jack P basis sage: Sym.jack().Q() Sym in the Jack Q basis sage: Sym.jack().Qp() Sym in the Jack Qp basis Jack polynomials, with specialized parameter:: sage: Sym.jack(t=1).J() Sym in the Jack J with t=1 basis Zonal polynomials:: sage: Sym.zonal() Sym in the zonal basis LLT polynomials:: sage: Sym.llt(3).hspin() Sym in the level 3 LLT spin basis sage: Sym.llt(3).hcospin() Sym in the level 3 LLT cospin basis LLT polynomials, with specialized parameter:: sage: Sym.llt(3, t=1).hspin() Sym in the level 3 LLT spin with t=1 basis sage: Sym.llt(3, t=1).hcospin() Sym in the level 3 LLT cospin with t=1 basis TESTS:: sage: Sym.s()._repr_() 'Sym in the Schur basis' sage: Sym.s()._repr_.__module__ 'sage.combinat.sf.sfa' :: sage: Sym.rename()
src/sage/combinat/sf/sfa.py
_repr_
bopopescu/sagesmc
5
python
def _repr_(self): '\n Text representation of this basis of symmetric functions\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(FractionField(QQ[\'q,t\'])); Sym\n Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: Sym.p()\n Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the powersum basis\n\n In the following examples, we rename {{{Sym}}} for brevity::\n\n sage: Sym.rename("Sym"); Sym\n Sym\n\n Classical bases::\n\n sage: Sym.s()\n Sym in the Schur basis\n sage: Sym.p()\n Sym in the powersum basis\n sage: Sym.m()\n Sym in the monomial basis\n sage: Sym.e()\n Sym in the elementary basis\n sage: Sym.h()\n Sym in the homogeneous basis\n sage: Sym.f()\n Sym in the forgotten basis\n\n Macdonald polynomials::\n\n sage: Sym.macdonald().P()\n Sym in the Macdonald P basis\n sage: Sym.macdonald().Q()\n Sym in the Macdonald Q basis\n sage: Sym.macdonald().J()\n Sym in the Macdonald J basis\n sage: Sym.macdonald().H()\n Sym in the Macdonald H basis\n sage: Sym.macdonald().Ht()\n Sym in the Macdonald Ht basis\n sage: Sym.macdonald().S()\n Sym in the Macdonald S basis\n\n Macdonald polynomials, with specialized parameters::\n\n sage: Sym.macdonald(q=1).S()\n Sym in the Macdonald S with q=1 basis\n sage: Sym.macdonald(q=1,t=3).P()\n Sym in the Macdonald P with q=1 and t=3 basis\n\n Hall-Littlewood polynomials:\n\n sage: Sym.hall_littlewood().P()\n Sym in the Hall-Littlewood P basis\n sage: Sym.hall_littlewood().Q()\n Sym in the Hall-Littlewood Q basis\n sage: Sym.hall_littlewood().Qp()\n Sym in the Hall-Littlewood Qp basis\n\n Hall-Littlewood polynomials, with specialized parameter::\n\n sage: Sym.hall_littlewood(t=1).P()\n Sym in the Hall-Littlewood P with t=1 basis\n\n Jack polynomials::\n\n sage: Sym.jack().J()\n Sym in the Jack J basis\n sage: Sym.jack().P()\n Sym in the Jack P basis\n sage: Sym.jack().Q()\n Sym in the Jack Q basis\n sage: Sym.jack().Qp()\n Sym in the Jack Qp basis\n\n Jack polynomials, with specialized parameter::\n\n sage: Sym.jack(t=1).J()\n Sym in the Jack J with t=1 basis\n\n Zonal polynomials::\n\n sage: Sym.zonal()\n Sym in the zonal basis\n\n LLT polynomials::\n\n sage: Sym.llt(3).hspin()\n Sym in the level 3 LLT spin basis\n sage: Sym.llt(3).hcospin()\n Sym in the level 3 LLT cospin basis\n\n LLT polynomials, with specialized parameter::\n\n sage: Sym.llt(3, t=1).hspin()\n Sym in the level 3 LLT spin with t=1 basis\n sage: Sym.llt(3, t=1).hcospin()\n Sym in the level 3 LLT cospin with t=1 basis\n\n TESTS::\n\n sage: Sym.s()._repr_()\n \'Sym in the Schur basis\'\n sage: Sym.s()._repr_.__module__\n \'sage.combinat.sf.sfa\'\n\n ::\n\n sage: Sym.rename()\n ' return ('%s in the %s basis' % (self.realization_of(), self.basis_name()))
def _repr_(self): '\n Text representation of this basis of symmetric functions\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(FractionField(QQ[\'q,t\'])); Sym\n Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: Sym.p()\n Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the powersum basis\n\n In the following examples, we rename {{{Sym}}} for brevity::\n\n sage: Sym.rename("Sym"); Sym\n Sym\n\n Classical bases::\n\n sage: Sym.s()\n Sym in the Schur basis\n sage: Sym.p()\n Sym in the powersum basis\n sage: Sym.m()\n Sym in the monomial basis\n sage: Sym.e()\n Sym in the elementary basis\n sage: Sym.h()\n Sym in the homogeneous basis\n sage: Sym.f()\n Sym in the forgotten basis\n\n Macdonald polynomials::\n\n sage: Sym.macdonald().P()\n Sym in the Macdonald P basis\n sage: Sym.macdonald().Q()\n Sym in the Macdonald Q basis\n sage: Sym.macdonald().J()\n Sym in the Macdonald J basis\n sage: Sym.macdonald().H()\n Sym in the Macdonald H basis\n sage: Sym.macdonald().Ht()\n Sym in the Macdonald Ht basis\n sage: Sym.macdonald().S()\n Sym in the Macdonald S basis\n\n Macdonald polynomials, with specialized parameters::\n\n sage: Sym.macdonald(q=1).S()\n Sym in the Macdonald S with q=1 basis\n sage: Sym.macdonald(q=1,t=3).P()\n Sym in the Macdonald P with q=1 and t=3 basis\n\n Hall-Littlewood polynomials:\n\n sage: Sym.hall_littlewood().P()\n Sym in the Hall-Littlewood P basis\n sage: Sym.hall_littlewood().Q()\n Sym in the Hall-Littlewood Q basis\n sage: Sym.hall_littlewood().Qp()\n Sym in the Hall-Littlewood Qp basis\n\n Hall-Littlewood polynomials, with specialized parameter::\n\n sage: Sym.hall_littlewood(t=1).P()\n Sym in the Hall-Littlewood P with t=1 basis\n\n Jack polynomials::\n\n sage: Sym.jack().J()\n Sym in the Jack J basis\n sage: Sym.jack().P()\n Sym in the Jack P basis\n sage: Sym.jack().Q()\n Sym in the Jack Q basis\n sage: Sym.jack().Qp()\n Sym in the Jack Qp basis\n\n Jack polynomials, with specialized parameter::\n\n sage: Sym.jack(t=1).J()\n Sym in the Jack J with t=1 basis\n\n Zonal polynomials::\n\n sage: Sym.zonal()\n Sym in the zonal basis\n\n LLT polynomials::\n\n sage: Sym.llt(3).hspin()\n Sym in the level 3 LLT spin basis\n sage: Sym.llt(3).hcospin()\n Sym in the level 3 LLT cospin basis\n\n LLT polynomials, with specialized parameter::\n\n sage: Sym.llt(3, t=1).hspin()\n Sym in the level 3 LLT spin with t=1 basis\n sage: Sym.llt(3, t=1).hcospin()\n Sym in the level 3 LLT cospin with t=1 basis\n\n TESTS::\n\n sage: Sym.s()._repr_()\n \'Sym in the Schur basis\'\n sage: Sym.s()._repr_.__module__\n \'sage.combinat.sf.sfa\'\n\n ::\n\n sage: Sym.rename()\n ' return ('%s in the %s basis' % (self.realization_of(), self.basis_name()))<|docstring|>Text representation of this basis of symmetric functions INPUT: - ``self`` -- a basis of the symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field sage: Sym.p() Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the powersum basis In the following examples, we rename {{{Sym}}} for brevity:: sage: Sym.rename("Sym"); Sym Sym Classical bases:: sage: Sym.s() Sym in the Schur basis sage: Sym.p() Sym in the powersum basis sage: Sym.m() Sym in the monomial basis sage: Sym.e() Sym in the elementary basis sage: Sym.h() Sym in the homogeneous basis sage: Sym.f() Sym in the forgotten basis Macdonald polynomials:: sage: Sym.macdonald().P() Sym in the Macdonald P basis sage: Sym.macdonald().Q() Sym in the Macdonald Q basis sage: Sym.macdonald().J() Sym in the Macdonald J basis sage: Sym.macdonald().H() Sym in the Macdonald H basis sage: Sym.macdonald().Ht() Sym in the Macdonald Ht basis sage: Sym.macdonald().S() Sym in the Macdonald S basis Macdonald polynomials, with specialized parameters:: sage: Sym.macdonald(q=1).S() Sym in the Macdonald S with q=1 basis sage: Sym.macdonald(q=1,t=3).P() Sym in the Macdonald P with q=1 and t=3 basis Hall-Littlewood polynomials: sage: Sym.hall_littlewood().P() Sym in the Hall-Littlewood P basis sage: Sym.hall_littlewood().Q() Sym in the Hall-Littlewood Q basis sage: Sym.hall_littlewood().Qp() Sym in the Hall-Littlewood Qp basis Hall-Littlewood polynomials, with specialized parameter:: sage: Sym.hall_littlewood(t=1).P() Sym in the Hall-Littlewood P with t=1 basis Jack polynomials:: sage: Sym.jack().J() Sym in the Jack J basis sage: Sym.jack().P() Sym in the Jack P basis sage: Sym.jack().Q() Sym in the Jack Q basis sage: Sym.jack().Qp() Sym in the Jack Qp basis Jack polynomials, with specialized parameter:: sage: Sym.jack(t=1).J() Sym in the Jack J with t=1 basis Zonal polynomials:: sage: Sym.zonal() Sym in the zonal basis LLT polynomials:: sage: Sym.llt(3).hspin() Sym in the level 3 LLT spin basis sage: Sym.llt(3).hcospin() Sym in the level 3 LLT cospin basis LLT polynomials, with specialized parameter:: sage: Sym.llt(3, t=1).hspin() Sym in the level 3 LLT spin with t=1 basis sage: Sym.llt(3, t=1).hcospin() Sym in the level 3 LLT cospin with t=1 basis TESTS:: sage: Sym.s()._repr_() 'Sym in the Schur basis' sage: Sym.s()._repr_.__module__ 'sage.combinat.sf.sfa' :: sage: Sym.rename()<|endoftext|>
455d85ee84b496740547a999ee082052bda2e59405d8af5f3f52dff91f205f4a
@cached_method def one_basis(self): "\n Returns the empty partition, as per ``AlgebrasWithBasis.ParentMethods.one_basis``\n\n INPUT:\n\n - ``self`` -- a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())\n sage: s = Sym.s()\n sage: s.one_basis()\n []\n sage: Q = Sym.hall_littlewood().Q()\n sage: Q.one_basis()\n []\n\n .. TODO:: generalize to Modules.Graded.Connected.ParentMethods\n " return sage.combinat.partition.Partition([])
Returns the empty partition, as per ``AlgebrasWithBasis.ParentMethods.one_basis`` INPUT: - ``self`` -- a basis of the ring of symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ['t'].fraction_field()) sage: s = Sym.s() sage: s.one_basis() [] sage: Q = Sym.hall_littlewood().Q() sage: Q.one_basis() [] .. TODO:: generalize to Modules.Graded.Connected.ParentMethods
src/sage/combinat/sf/sfa.py
one_basis
bopopescu/sagesmc
5
python
@cached_method def one_basis(self): "\n Returns the empty partition, as per ``AlgebrasWithBasis.ParentMethods.one_basis``\n\n INPUT:\n\n - ``self`` -- a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())\n sage: s = Sym.s()\n sage: s.one_basis()\n []\n sage: Q = Sym.hall_littlewood().Q()\n sage: Q.one_basis()\n []\n\n .. TODO:: generalize to Modules.Graded.Connected.ParentMethods\n " return sage.combinat.partition.Partition([])
@cached_method def one_basis(self): "\n Returns the empty partition, as per ``AlgebrasWithBasis.ParentMethods.one_basis``\n\n INPUT:\n\n - ``self`` -- a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())\n sage: s = Sym.s()\n sage: s.one_basis()\n []\n sage: Q = Sym.hall_littlewood().Q()\n sage: Q.one_basis()\n []\n\n .. TODO:: generalize to Modules.Graded.Connected.ParentMethods\n " return sage.combinat.partition.Partition([])<|docstring|>Returns the empty partition, as per ``AlgebrasWithBasis.ParentMethods.one_basis`` INPUT: - ``self`` -- a basis of the ring of symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ['t'].fraction_field()) sage: s = Sym.s() sage: s.one_basis() [] sage: Q = Sym.hall_littlewood().Q() sage: Q.one_basis() [] .. TODO:: generalize to Modules.Graded.Connected.ParentMethods<|endoftext|>
f1fff864658267ca5096e1f88043861ae387d36f1be3ebcabc50d1b62978a76c
def degree_on_basis(self, b): "\n Return the degree of the basis element indexed by ``b``.\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``b`` -- a partition\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ['q,t'].fraction_field())\n sage: m = Sym.monomial()\n sage: m.degree_on_basis(Partition([3,2]))\n 5\n sage: P = Sym.macdonald().P()\n sage: P.degree_on_basis(Partition([]))\n 0\n " return sum(b)
Return the degree of the basis element indexed by ``b``. INPUT: - ``self`` -- a basis of the symmetric functions - ``b`` -- a partition EXAMPLES:: sage: Sym = SymmetricFunctions(QQ['q,t'].fraction_field()) sage: m = Sym.monomial() sage: m.degree_on_basis(Partition([3,2])) 5 sage: P = Sym.macdonald().P() sage: P.degree_on_basis(Partition([])) 0
src/sage/combinat/sf/sfa.py
degree_on_basis
bopopescu/sagesmc
5
python
def degree_on_basis(self, b): "\n Return the degree of the basis element indexed by ``b``.\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``b`` -- a partition\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ['q,t'].fraction_field())\n sage: m = Sym.monomial()\n sage: m.degree_on_basis(Partition([3,2]))\n 5\n sage: P = Sym.macdonald().P()\n sage: P.degree_on_basis(Partition([]))\n 0\n " return sum(b)
def degree_on_basis(self, b): "\n Return the degree of the basis element indexed by ``b``.\n\n INPUT:\n\n - ``self`` -- a basis of the symmetric functions\n - ``b`` -- a partition\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ['q,t'].fraction_field())\n sage: m = Sym.monomial()\n sage: m.degree_on_basis(Partition([3,2]))\n 5\n sage: P = Sym.macdonald().P()\n sage: P.degree_on_basis(Partition([]))\n 0\n " return sum(b)<|docstring|>Return the degree of the basis element indexed by ``b``. INPUT: - ``self`` -- a basis of the symmetric functions - ``b`` -- a partition EXAMPLES:: sage: Sym = SymmetricFunctions(QQ['q,t'].fraction_field()) sage: m = Sym.monomial() sage: m.degree_on_basis(Partition([3,2])) 5 sage: P = Sym.macdonald().P() sage: P.degree_on_basis(Partition([])) 0<|endoftext|>
c430f0e6606ddbe4b87606750e4e1818a1ff58a5e839b9528cbfbd184d0447f5
def antipode_by_coercion(self, element): '\n The antipode of ``element``.\n\n INPUT:\n\n - ``element`` -- element in a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: p = Sym.p()\n sage: s = Sym.s()\n sage: e = Sym.e()\n sage: h = Sym.h()\n sage: (h([]) + h([1])).antipode() # indirect doctest\n h[] - h[1]\n sage: (s([]) + s([1]) + s[2]).antipode()\n s[] - s[1] + s[1, 1]\n sage: (p([2]) + p([3])).antipode()\n -p[2] - p[3]\n sage: (e([2]) + e([3])).antipode()\n e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]\n sage: f = Sym.f()\n sage: f([3,2,1]).antipode()\n -f[3, 2, 1] - 4*f[3, 3] - 2*f[4, 2] - 2*f[5, 1] - 6*f[6]\n\n The antipode is an involution::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: s = Sym.s()\n sage: all( s[u].antipode().antipode() == s[u] for u in Partitions(4) )\n True\n\n The antipode is an algebra homomorphism::\n\n sage: Sym = SymmetricFunctions(FiniteField(23))\n sage: h = Sym.h()\n sage: all( all( (s[u] * s[v]).antipode() == s[u].antipode() * s[v].antipode()\n ....: for u in Partitions(3) )\n ....: for v in Partitions(3) )\n True\n\n TESTS:\n\n Everything works over `\\ZZ`::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: s = Sym.s()\n sage: e = Sym.e()\n sage: h = Sym.h()\n sage: (h([]) + h([1])).antipode() # indirect doctest\n h[] - h[1]\n sage: (s([]) + s([1]) + s[2]).antipode()\n s[] - s[1] + s[1, 1]\n sage: (p([2]) + p([3])).antipode()\n -p[2] - p[3]\n sage: (e([2]) + e([3])).antipode()\n e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]\n ' return self.degree_negation(element.omega())
The antipode of ``element``. INPUT: - ``element`` -- element in a basis of the ring of symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: p = Sym.p() sage: s = Sym.s() sage: e = Sym.e() sage: h = Sym.h() sage: (h([]) + h([1])).antipode() # indirect doctest h[] - h[1] sage: (s([]) + s([1]) + s[2]).antipode() s[] - s[1] + s[1, 1] sage: (p([2]) + p([3])).antipode() -p[2] - p[3] sage: (e([2]) + e([3])).antipode() e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3] sage: f = Sym.f() sage: f([3,2,1]).antipode() -f[3, 2, 1] - 4*f[3, 3] - 2*f[4, 2] - 2*f[5, 1] - 6*f[6] The antipode is an involution:: sage: Sym = SymmetricFunctions(ZZ) sage: s = Sym.s() sage: all( s[u].antipode().antipode() == s[u] for u in Partitions(4) ) True The antipode is an algebra homomorphism:: sage: Sym = SymmetricFunctions(FiniteField(23)) sage: h = Sym.h() sage: all( all( (s[u] * s[v]).antipode() == s[u].antipode() * s[v].antipode() ....: for u in Partitions(3) ) ....: for v in Partitions(3) ) True TESTS: Everything works over `\ZZ`:: sage: Sym = SymmetricFunctions(ZZ) sage: p = Sym.p() sage: s = Sym.s() sage: e = Sym.e() sage: h = Sym.h() sage: (h([]) + h([1])).antipode() # indirect doctest h[] - h[1] sage: (s([]) + s([1]) + s[2]).antipode() s[] - s[1] + s[1, 1] sage: (p([2]) + p([3])).antipode() -p[2] - p[3] sage: (e([2]) + e([3])).antipode() e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]
src/sage/combinat/sf/sfa.py
antipode_by_coercion
bopopescu/sagesmc
5
python
def antipode_by_coercion(self, element): '\n The antipode of ``element``.\n\n INPUT:\n\n - ``element`` -- element in a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: p = Sym.p()\n sage: s = Sym.s()\n sage: e = Sym.e()\n sage: h = Sym.h()\n sage: (h([]) + h([1])).antipode() # indirect doctest\n h[] - h[1]\n sage: (s([]) + s([1]) + s[2]).antipode()\n s[] - s[1] + s[1, 1]\n sage: (p([2]) + p([3])).antipode()\n -p[2] - p[3]\n sage: (e([2]) + e([3])).antipode()\n e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]\n sage: f = Sym.f()\n sage: f([3,2,1]).antipode()\n -f[3, 2, 1] - 4*f[3, 3] - 2*f[4, 2] - 2*f[5, 1] - 6*f[6]\n\n The antipode is an involution::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: s = Sym.s()\n sage: all( s[u].antipode().antipode() == s[u] for u in Partitions(4) )\n True\n\n The antipode is an algebra homomorphism::\n\n sage: Sym = SymmetricFunctions(FiniteField(23))\n sage: h = Sym.h()\n sage: all( all( (s[u] * s[v]).antipode() == s[u].antipode() * s[v].antipode()\n ....: for u in Partitions(3) )\n ....: for v in Partitions(3) )\n True\n\n TESTS:\n\n Everything works over `\\ZZ`::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: s = Sym.s()\n sage: e = Sym.e()\n sage: h = Sym.h()\n sage: (h([]) + h([1])).antipode() # indirect doctest\n h[] - h[1]\n sage: (s([]) + s([1]) + s[2]).antipode()\n s[] - s[1] + s[1, 1]\n sage: (p([2]) + p([3])).antipode()\n -p[2] - p[3]\n sage: (e([2]) + e([3])).antipode()\n e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]\n ' return self.degree_negation(element.omega())
def antipode_by_coercion(self, element): '\n The antipode of ``element``.\n\n INPUT:\n\n - ``element`` -- element in a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: p = Sym.p()\n sage: s = Sym.s()\n sage: e = Sym.e()\n sage: h = Sym.h()\n sage: (h([]) + h([1])).antipode() # indirect doctest\n h[] - h[1]\n sage: (s([]) + s([1]) + s[2]).antipode()\n s[] - s[1] + s[1, 1]\n sage: (p([2]) + p([3])).antipode()\n -p[2] - p[3]\n sage: (e([2]) + e([3])).antipode()\n e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]\n sage: f = Sym.f()\n sage: f([3,2,1]).antipode()\n -f[3, 2, 1] - 4*f[3, 3] - 2*f[4, 2] - 2*f[5, 1] - 6*f[6]\n\n The antipode is an involution::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: s = Sym.s()\n sage: all( s[u].antipode().antipode() == s[u] for u in Partitions(4) )\n True\n\n The antipode is an algebra homomorphism::\n\n sage: Sym = SymmetricFunctions(FiniteField(23))\n sage: h = Sym.h()\n sage: all( all( (s[u] * s[v]).antipode() == s[u].antipode() * s[v].antipode()\n ....: for u in Partitions(3) )\n ....: for v in Partitions(3) )\n True\n\n TESTS:\n\n Everything works over `\\ZZ`::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: p = Sym.p()\n sage: s = Sym.s()\n sage: e = Sym.e()\n sage: h = Sym.h()\n sage: (h([]) + h([1])).antipode() # indirect doctest\n h[] - h[1]\n sage: (s([]) + s([1]) + s[2]).antipode()\n s[] - s[1] + s[1, 1]\n sage: (p([2]) + p([3])).antipode()\n -p[2] - p[3]\n sage: (e([2]) + e([3])).antipode()\n e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]\n ' return self.degree_negation(element.omega())<|docstring|>The antipode of ``element``. INPUT: - ``element`` -- element in a basis of the ring of symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: p = Sym.p() sage: s = Sym.s() sage: e = Sym.e() sage: h = Sym.h() sage: (h([]) + h([1])).antipode() # indirect doctest h[] - h[1] sage: (s([]) + s([1]) + s[2]).antipode() s[] - s[1] + s[1, 1] sage: (p([2]) + p([3])).antipode() -p[2] - p[3] sage: (e([2]) + e([3])).antipode() e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3] sage: f = Sym.f() sage: f([3,2,1]).antipode() -f[3, 2, 1] - 4*f[3, 3] - 2*f[4, 2] - 2*f[5, 1] - 6*f[6] The antipode is an involution:: sage: Sym = SymmetricFunctions(ZZ) sage: s = Sym.s() sage: all( s[u].antipode().antipode() == s[u] for u in Partitions(4) ) True The antipode is an algebra homomorphism:: sage: Sym = SymmetricFunctions(FiniteField(23)) sage: h = Sym.h() sage: all( all( (s[u] * s[v]).antipode() == s[u].antipode() * s[v].antipode() ....: for u in Partitions(3) ) ....: for v in Partitions(3) ) True TESTS: Everything works over `\ZZ`:: sage: Sym = SymmetricFunctions(ZZ) sage: p = Sym.p() sage: s = Sym.s() sage: e = Sym.e() sage: h = Sym.h() sage: (h([]) + h([1])).antipode() # indirect doctest h[] - h[1] sage: (s([]) + s([1]) + s[2]).antipode() s[] - s[1] + s[1, 1] sage: (p([2]) + p([3])).antipode() -p[2] - p[3] sage: (e([2]) + e([3])).antipode() e[1, 1] - e[1, 1, 1] - e[2] + 2*e[2, 1] - e[3]<|endoftext|>
057ed0a534cfceb6b06f0557d3fea8fb827d3f43ea74718f97b8cab74c62172c
def counit(self, element): '\n Return the counit of ``element``.\n\n The counit is the constant term of ``element``.\n\n INPUT:\n\n - ``element`` -- element in a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 3*m[[]]\n sage: f.counit()\n 3\n ' return element.degree_zero_coefficient()
Return the counit of ``element``. The counit is the constant term of ``element``. INPUT: - ``element`` -- element in a basis of the ring of symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.monomial() sage: f = 2*m[2,1] + 3*m[[]] sage: f.counit() 3
src/sage/combinat/sf/sfa.py
counit
bopopescu/sagesmc
5
python
def counit(self, element): '\n Return the counit of ``element``.\n\n The counit is the constant term of ``element``.\n\n INPUT:\n\n - ``element`` -- element in a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 3*m[[]]\n sage: f.counit()\n 3\n ' return element.degree_zero_coefficient()
def counit(self, element): '\n Return the counit of ``element``.\n\n The counit is the constant term of ``element``.\n\n INPUT:\n\n - ``element`` -- element in a basis of the ring of symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 3*m[[]]\n sage: f.counit()\n 3\n ' return element.degree_zero_coefficient()<|docstring|>Return the counit of ``element``. The counit is the constant term of ``element``. INPUT: - ``element`` -- element in a basis of the ring of symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.monomial() sage: f = 2*m[2,1] + 3*m[[]] sage: f.counit() 3<|endoftext|>
c28e40547dda9449a0aceb7a79860173525af91ed9a58da3239ad1c4ba6c70fb
def degree_negation(self, element): '\n Return the image of ``element`` under the degree negation\n automorphism of the ring of symmetric functions.\n\n The degree negation is the automorphism which scales every\n homogeneous element of degree `k` by `(-1)^k` (for all `k`).\n\n INPUT:\n\n - ``element`` -- symmetric function written in ``self``\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 4*m[1,1] - 5*m[1] - 3*m[[]]\n sage: m.degree_negation(f)\n -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1]\n\n TESTS:\n\n Using :meth:`degree_negation` on an element of a different\n basis works correctly::\n\n sage: e = Sym.elementary()\n sage: m.degree_negation(e[3])\n -m[1, 1, 1]\n sage: m.degree_negation(m(e[3]))\n -m[1, 1, 1]\n ' return self.sum_of_terms([(lam, (((- 1) ** (sum(lam) % 2)) * a)) for (lam, a) in self(element)])
Return the image of ``element`` under the degree negation automorphism of the ring of symmetric functions. The degree negation is the automorphism which scales every homogeneous element of degree `k` by `(-1)^k` (for all `k`). INPUT: - ``element`` -- symmetric function written in ``self`` EXAMPLES:: sage: Sym = SymmetricFunctions(ZZ) sage: m = Sym.monomial() sage: f = 2*m[2,1] + 4*m[1,1] - 5*m[1] - 3*m[[]] sage: m.degree_negation(f) -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1] TESTS: Using :meth:`degree_negation` on an element of a different basis works correctly:: sage: e = Sym.elementary() sage: m.degree_negation(e[3]) -m[1, 1, 1] sage: m.degree_negation(m(e[3])) -m[1, 1, 1]
src/sage/combinat/sf/sfa.py
degree_negation
bopopescu/sagesmc
5
python
def degree_negation(self, element): '\n Return the image of ``element`` under the degree negation\n automorphism of the ring of symmetric functions.\n\n The degree negation is the automorphism which scales every\n homogeneous element of degree `k` by `(-1)^k` (for all `k`).\n\n INPUT:\n\n - ``element`` -- symmetric function written in ``self``\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 4*m[1,1] - 5*m[1] - 3*m[[]]\n sage: m.degree_negation(f)\n -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1]\n\n TESTS:\n\n Using :meth:`degree_negation` on an element of a different\n basis works correctly::\n\n sage: e = Sym.elementary()\n sage: m.degree_negation(e[3])\n -m[1, 1, 1]\n sage: m.degree_negation(m(e[3]))\n -m[1, 1, 1]\n ' return self.sum_of_terms([(lam, (((- 1) ** (sum(lam) % 2)) * a)) for (lam, a) in self(element)])
def degree_negation(self, element): '\n Return the image of ``element`` under the degree negation\n automorphism of the ring of symmetric functions.\n\n The degree negation is the automorphism which scales every\n homogeneous element of degree `k` by `(-1)^k` (for all `k`).\n\n INPUT:\n\n - ``element`` -- symmetric function written in ``self``\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(ZZ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 4*m[1,1] - 5*m[1] - 3*m[[]]\n sage: m.degree_negation(f)\n -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1]\n\n TESTS:\n\n Using :meth:`degree_negation` on an element of a different\n basis works correctly::\n\n sage: e = Sym.elementary()\n sage: m.degree_negation(e[3])\n -m[1, 1, 1]\n sage: m.degree_negation(m(e[3]))\n -m[1, 1, 1]\n ' return self.sum_of_terms([(lam, (((- 1) ** (sum(lam) % 2)) * a)) for (lam, a) in self(element)])<|docstring|>Return the image of ``element`` under the degree negation automorphism of the ring of symmetric functions. The degree negation is the automorphism which scales every homogeneous element of degree `k` by `(-1)^k` (for all `k`). INPUT: - ``element`` -- symmetric function written in ``self`` EXAMPLES:: sage: Sym = SymmetricFunctions(ZZ) sage: m = Sym.monomial() sage: f = 2*m[2,1] + 4*m[1,1] - 5*m[1] - 3*m[[]] sage: m.degree_negation(f) -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1] TESTS: Using :meth:`degree_negation` on an element of a different basis works correctly:: sage: e = Sym.elementary() sage: m.degree_negation(e[3]) -m[1, 1, 1] sage: m.degree_negation(m(e[3])) -m[1, 1, 1]<|endoftext|>
e26d5a55608c2912c3efa6790f646e9e9283e64fcff48fa77b72a1fcd4a4f3a0
def corresponding_basis_over(self, R): "\n Return the realization of symmetric functions corresponding to\n ``self`` but over the base ring ``R``. Only works when ``self``\n is one of the classical bases, not one of the `q,t`-dependent\n ones. In the latter case, ``None`` is returned instead.\n\n INPUT:\n\n - ``R`` -- a commutative ring\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: m.corresponding_basis_over(ZZ)\n Symmetric Functions over Integer Ring in the monomial basis\n\n sage: Sym = SymmetricFunctions(CyclotomicField())\n sage: s = Sym.schur()\n sage: s.corresponding_basis_over(Integers(13))\n Symmetric Functions over Ring of integers modulo 13 in the Schur basis\n\n sage: P = ZZ['q','t']\n sage: Sym = SymmetricFunctions(P)\n sage: mj = Sym.macdonald().J()\n sage: mj.corresponding_basis_over(Integers(13))\n\n TESTS:\n\n Let's check that this handles each of the bases properly::\n\n sage: P = QQ['q','t']\n sage: Sym = SymmetricFunctions(P)\n sage: Q = CyclotomicField()['q','t']\n sage: Sym.s().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the Schur basis\n sage: Sym.p().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the powersum basis\n sage: Sym.m().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the monomial basis\n sage: Sym.e().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the elementary basis\n sage: Sym.h().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the homogeneous basis\n sage: Sym.f().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the forgotten basis\n sage: Sym.w().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the Witt basis\n sage: Sym.macdonald().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().J().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().H().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().Ht().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().S().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald(q=1).S().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald(q=1,t=3).P().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().Qp().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood(t=1).P().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().J().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().Qp().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack(t=1).J().corresponding_basis_over(CyclotomicField())\n sage: Sym.zonal().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the zonal basis\n sage: Sym.llt(3).hspin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3).hcospin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3, t=1).hspin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3, t=1).hcospin().corresponding_basis_over(CyclotomicField())\n\n .. TODO::\n\n This function is an ugly hack using strings. It should be\n rewritten as soon as the bases of ``SymmetricFunctions`` are\n put on a more robust and systematic footing.\n " from sage.combinat.sf.sf import SymmetricFunctions from sage.misc.misc import attrcall try: return attrcall(self._basis)(SymmetricFunctions(R)) except AttributeError: return None
Return the realization of symmetric functions corresponding to ``self`` but over the base ring ``R``. Only works when ``self`` is one of the classical bases, not one of the `q,t`-dependent ones. In the latter case, ``None`` is returned instead. INPUT: - ``R`` -- a commutative ring EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.monomial() sage: m.corresponding_basis_over(ZZ) Symmetric Functions over Integer Ring in the monomial basis sage: Sym = SymmetricFunctions(CyclotomicField()) sage: s = Sym.schur() sage: s.corresponding_basis_over(Integers(13)) Symmetric Functions over Ring of integers modulo 13 in the Schur basis sage: P = ZZ['q','t'] sage: Sym = SymmetricFunctions(P) sage: mj = Sym.macdonald().J() sage: mj.corresponding_basis_over(Integers(13)) TESTS: Let's check that this handles each of the bases properly:: sage: P = QQ['q','t'] sage: Sym = SymmetricFunctions(P) sage: Q = CyclotomicField()['q','t'] sage: Sym.s().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the Schur basis sage: Sym.p().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the powersum basis sage: Sym.m().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the monomial basis sage: Sym.e().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the elementary basis sage: Sym.h().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the homogeneous basis sage: Sym.f().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the forgotten basis sage: Sym.w().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the Witt basis sage: Sym.macdonald().P().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().Q().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().J().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().H().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().Ht().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().S().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald(q=1).S().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald(q=1,t=3).P().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood().P().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood().Q().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood().Qp().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood(t=1).P().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().J().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().P().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().Q().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().Qp().corresponding_basis_over(CyclotomicField()) sage: Sym.jack(t=1).J().corresponding_basis_over(CyclotomicField()) sage: Sym.zonal().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the zonal basis sage: Sym.llt(3).hspin().corresponding_basis_over(CyclotomicField()) sage: Sym.llt(3).hcospin().corresponding_basis_over(CyclotomicField()) sage: Sym.llt(3, t=1).hspin().corresponding_basis_over(CyclotomicField()) sage: Sym.llt(3, t=1).hcospin().corresponding_basis_over(CyclotomicField()) .. TODO:: This function is an ugly hack using strings. It should be rewritten as soon as the bases of ``SymmetricFunctions`` are put on a more robust and systematic footing.
src/sage/combinat/sf/sfa.py
corresponding_basis_over
bopopescu/sagesmc
5
python
def corresponding_basis_over(self, R): "\n Return the realization of symmetric functions corresponding to\n ``self`` but over the base ring ``R``. Only works when ``self``\n is one of the classical bases, not one of the `q,t`-dependent\n ones. In the latter case, ``None`` is returned instead.\n\n INPUT:\n\n - ``R`` -- a commutative ring\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: m.corresponding_basis_over(ZZ)\n Symmetric Functions over Integer Ring in the monomial basis\n\n sage: Sym = SymmetricFunctions(CyclotomicField())\n sage: s = Sym.schur()\n sage: s.corresponding_basis_over(Integers(13))\n Symmetric Functions over Ring of integers modulo 13 in the Schur basis\n\n sage: P = ZZ['q','t']\n sage: Sym = SymmetricFunctions(P)\n sage: mj = Sym.macdonald().J()\n sage: mj.corresponding_basis_over(Integers(13))\n\n TESTS:\n\n Let's check that this handles each of the bases properly::\n\n sage: P = QQ['q','t']\n sage: Sym = SymmetricFunctions(P)\n sage: Q = CyclotomicField()['q','t']\n sage: Sym.s().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the Schur basis\n sage: Sym.p().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the powersum basis\n sage: Sym.m().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the monomial basis\n sage: Sym.e().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the elementary basis\n sage: Sym.h().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the homogeneous basis\n sage: Sym.f().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the forgotten basis\n sage: Sym.w().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the Witt basis\n sage: Sym.macdonald().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().J().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().H().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().Ht().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().S().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald(q=1).S().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald(q=1,t=3).P().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().Qp().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood(t=1).P().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().J().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().Qp().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack(t=1).J().corresponding_basis_over(CyclotomicField())\n sage: Sym.zonal().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the zonal basis\n sage: Sym.llt(3).hspin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3).hcospin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3, t=1).hspin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3, t=1).hcospin().corresponding_basis_over(CyclotomicField())\n\n .. TODO::\n\n This function is an ugly hack using strings. It should be\n rewritten as soon as the bases of ``SymmetricFunctions`` are\n put on a more robust and systematic footing.\n " from sage.combinat.sf.sf import SymmetricFunctions from sage.misc.misc import attrcall try: return attrcall(self._basis)(SymmetricFunctions(R)) except AttributeError: return None
def corresponding_basis_over(self, R): "\n Return the realization of symmetric functions corresponding to\n ``self`` but over the base ring ``R``. Only works when ``self``\n is one of the classical bases, not one of the `q,t`-dependent\n ones. In the latter case, ``None`` is returned instead.\n\n INPUT:\n\n - ``R`` -- a commutative ring\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: m.corresponding_basis_over(ZZ)\n Symmetric Functions over Integer Ring in the monomial basis\n\n sage: Sym = SymmetricFunctions(CyclotomicField())\n sage: s = Sym.schur()\n sage: s.corresponding_basis_over(Integers(13))\n Symmetric Functions over Ring of integers modulo 13 in the Schur basis\n\n sage: P = ZZ['q','t']\n sage: Sym = SymmetricFunctions(P)\n sage: mj = Sym.macdonald().J()\n sage: mj.corresponding_basis_over(Integers(13))\n\n TESTS:\n\n Let's check that this handles each of the bases properly::\n\n sage: P = QQ['q','t']\n sage: Sym = SymmetricFunctions(P)\n sage: Q = CyclotomicField()['q','t']\n sage: Sym.s().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the Schur basis\n sage: Sym.p().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the powersum basis\n sage: Sym.m().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the monomial basis\n sage: Sym.e().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the elementary basis\n sage: Sym.h().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the homogeneous basis\n sage: Sym.f().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the forgotten basis\n sage: Sym.w().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the Witt basis\n sage: Sym.macdonald().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().J().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().H().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().Ht().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald().S().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald(q=1).S().corresponding_basis_over(CyclotomicField())\n sage: Sym.macdonald(q=1,t=3).P().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood().Qp().corresponding_basis_over(CyclotomicField())\n sage: Sym.hall_littlewood(t=1).P().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().J().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().P().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().Q().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack().Qp().corresponding_basis_over(CyclotomicField())\n sage: Sym.jack(t=1).J().corresponding_basis_over(CyclotomicField())\n sage: Sym.zonal().corresponding_basis_over(CyclotomicField())\n Symmetric Functions over Universal Cyclotomic Field in the zonal basis\n sage: Sym.llt(3).hspin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3).hcospin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3, t=1).hspin().corresponding_basis_over(CyclotomicField())\n sage: Sym.llt(3, t=1).hcospin().corresponding_basis_over(CyclotomicField())\n\n .. TODO::\n\n This function is an ugly hack using strings. It should be\n rewritten as soon as the bases of ``SymmetricFunctions`` are\n put on a more robust and systematic footing.\n " from sage.combinat.sf.sf import SymmetricFunctions from sage.misc.misc import attrcall try: return attrcall(self._basis)(SymmetricFunctions(R)) except AttributeError: return None<|docstring|>Return the realization of symmetric functions corresponding to ``self`` but over the base ring ``R``. Only works when ``self`` is one of the classical bases, not one of the `q,t`-dependent ones. In the latter case, ``None`` is returned instead. INPUT: - ``R`` -- a commutative ring EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.monomial() sage: m.corresponding_basis_over(ZZ) Symmetric Functions over Integer Ring in the monomial basis sage: Sym = SymmetricFunctions(CyclotomicField()) sage: s = Sym.schur() sage: s.corresponding_basis_over(Integers(13)) Symmetric Functions over Ring of integers modulo 13 in the Schur basis sage: P = ZZ['q','t'] sage: Sym = SymmetricFunctions(P) sage: mj = Sym.macdonald().J() sage: mj.corresponding_basis_over(Integers(13)) TESTS: Let's check that this handles each of the bases properly:: sage: P = QQ['q','t'] sage: Sym = SymmetricFunctions(P) sage: Q = CyclotomicField()['q','t'] sage: Sym.s().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the Schur basis sage: Sym.p().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the powersum basis sage: Sym.m().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the monomial basis sage: Sym.e().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the elementary basis sage: Sym.h().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the homogeneous basis sage: Sym.f().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the forgotten basis sage: Sym.w().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the Witt basis sage: Sym.macdonald().P().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().Q().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().J().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().H().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().Ht().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald().S().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald(q=1).S().corresponding_basis_over(CyclotomicField()) sage: Sym.macdonald(q=1,t=3).P().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood().P().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood().Q().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood().Qp().corresponding_basis_over(CyclotomicField()) sage: Sym.hall_littlewood(t=1).P().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().J().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().P().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().Q().corresponding_basis_over(CyclotomicField()) sage: Sym.jack().Qp().corresponding_basis_over(CyclotomicField()) sage: Sym.jack(t=1).J().corresponding_basis_over(CyclotomicField()) sage: Sym.zonal().corresponding_basis_over(CyclotomicField()) Symmetric Functions over Universal Cyclotomic Field in the zonal basis sage: Sym.llt(3).hspin().corresponding_basis_over(CyclotomicField()) sage: Sym.llt(3).hcospin().corresponding_basis_over(CyclotomicField()) sage: Sym.llt(3, t=1).hspin().corresponding_basis_over(CyclotomicField()) sage: Sym.llt(3, t=1).hcospin().corresponding_basis_over(CyclotomicField()) .. TODO:: This function is an ugly hack using strings. It should be rewritten as soon as the bases of ``SymmetricFunctions`` are put on a more robust and systematic footing.<|endoftext|>
7ef852eda1ee410a57b39eb2e6cd71a41ba87375266bdeb8e3d34ea659937001
def Eulerian(self, n, j, k=None): '\n Return the Eulerian symmetric function `Q_{n,j}` (with `n`\n either an integer or a partition) or `Q_{n,j,k}` (if the\n optional argument ``k`` is specified) in terms of the basis\n ``self``.\n\n It is known that the Eulerian quasisymmetric functions are\n in fact symmetric functions [SW2010]_. For more information,\n see :meth:`QuasiSymmetricFunctions.Fundamental.Eulerian()`,\n which accepts the same syntax as this method.\n\n INPUT:\n\n - ``n`` -- the nonnegative integer `n` or a partition\n - ``j`` -- the number of excedances\n - ``k`` -- (optional) if specified, determines the number of fixed\n points of the permutations which are being summed over\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.m()\n sage: m.Eulerian(3, 1)\n 4*m[1, 1, 1] + 3*m[2, 1] + 2*m[3]\n sage: h = Sym.h()\n sage: h.Eulerian(4, 2)\n h[2, 2] + h[3, 1] + h[4]\n sage: s = Sym.s()\n sage: s.Eulerian(5, 2)\n s[2, 2, 1] + s[3, 1, 1] + 5*s[3, 2] + 6*s[4, 1] + 6*s[5]\n sage: s.Eulerian([2,2,1], 2)\n s[2, 2, 1] + s[3, 2] + s[4, 1] + s[5]\n sage: s.Eulerian(5, 2, 2)\n s[3, 2] + s[4, 1] + s[5]\n\n We check Equation (5.4) in [SW2010]_::\n\n sage: h.Eulerian([6], 3)\n h[3, 2, 1] - h[4, 1, 1] + 2*h[4, 2] + h[5, 1]\n sage: s.Eulerian([6], 3)\n s[3, 2, 1] + s[3, 3] + 3*s[4, 2] + 3*s[5, 1] + 3*s[6]\n ' from sage.combinat.ncsf_qsym.qsym import QuasiSymmetricFunctions F = QuasiSymmetricFunctions(self.base_ring()).F() if (n in _Partitions): n = _Partitions(n) return self(F.Eulerian(n, j, k).to_symmetric_function())
Return the Eulerian symmetric function `Q_{n,j}` (with `n` either an integer or a partition) or `Q_{n,j,k}` (if the optional argument ``k`` is specified) in terms of the basis ``self``. It is known that the Eulerian quasisymmetric functions are in fact symmetric functions [SW2010]_. For more information, see :meth:`QuasiSymmetricFunctions.Fundamental.Eulerian()`, which accepts the same syntax as this method. INPUT: - ``n`` -- the nonnegative integer `n` or a partition - ``j`` -- the number of excedances - ``k`` -- (optional) if specified, determines the number of fixed points of the permutations which are being summed over EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.m() sage: m.Eulerian(3, 1) 4*m[1, 1, 1] + 3*m[2, 1] + 2*m[3] sage: h = Sym.h() sage: h.Eulerian(4, 2) h[2, 2] + h[3, 1] + h[4] sage: s = Sym.s() sage: s.Eulerian(5, 2) s[2, 2, 1] + s[3, 1, 1] + 5*s[3, 2] + 6*s[4, 1] + 6*s[5] sage: s.Eulerian([2,2,1], 2) s[2, 2, 1] + s[3, 2] + s[4, 1] + s[5] sage: s.Eulerian(5, 2, 2) s[3, 2] + s[4, 1] + s[5] We check Equation (5.4) in [SW2010]_:: sage: h.Eulerian([6], 3) h[3, 2, 1] - h[4, 1, 1] + 2*h[4, 2] + h[5, 1] sage: s.Eulerian([6], 3) s[3, 2, 1] + s[3, 3] + 3*s[4, 2] + 3*s[5, 1] + 3*s[6]
src/sage/combinat/sf/sfa.py
Eulerian
bopopescu/sagesmc
5
python
def Eulerian(self, n, j, k=None): '\n Return the Eulerian symmetric function `Q_{n,j}` (with `n`\n either an integer or a partition) or `Q_{n,j,k}` (if the\n optional argument ``k`` is specified) in terms of the basis\n ``self``.\n\n It is known that the Eulerian quasisymmetric functions are\n in fact symmetric functions [SW2010]_. For more information,\n see :meth:`QuasiSymmetricFunctions.Fundamental.Eulerian()`,\n which accepts the same syntax as this method.\n\n INPUT:\n\n - ``n`` -- the nonnegative integer `n` or a partition\n - ``j`` -- the number of excedances\n - ``k`` -- (optional) if specified, determines the number of fixed\n points of the permutations which are being summed over\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.m()\n sage: m.Eulerian(3, 1)\n 4*m[1, 1, 1] + 3*m[2, 1] + 2*m[3]\n sage: h = Sym.h()\n sage: h.Eulerian(4, 2)\n h[2, 2] + h[3, 1] + h[4]\n sage: s = Sym.s()\n sage: s.Eulerian(5, 2)\n s[2, 2, 1] + s[3, 1, 1] + 5*s[3, 2] + 6*s[4, 1] + 6*s[5]\n sage: s.Eulerian([2,2,1], 2)\n s[2, 2, 1] + s[3, 2] + s[4, 1] + s[5]\n sage: s.Eulerian(5, 2, 2)\n s[3, 2] + s[4, 1] + s[5]\n\n We check Equation (5.4) in [SW2010]_::\n\n sage: h.Eulerian([6], 3)\n h[3, 2, 1] - h[4, 1, 1] + 2*h[4, 2] + h[5, 1]\n sage: s.Eulerian([6], 3)\n s[3, 2, 1] + s[3, 3] + 3*s[4, 2] + 3*s[5, 1] + 3*s[6]\n ' from sage.combinat.ncsf_qsym.qsym import QuasiSymmetricFunctions F = QuasiSymmetricFunctions(self.base_ring()).F() if (n in _Partitions): n = _Partitions(n) return self(F.Eulerian(n, j, k).to_symmetric_function())
def Eulerian(self, n, j, k=None): '\n Return the Eulerian symmetric function `Q_{n,j}` (with `n`\n either an integer or a partition) or `Q_{n,j,k}` (if the\n optional argument ``k`` is specified) in terms of the basis\n ``self``.\n\n It is known that the Eulerian quasisymmetric functions are\n in fact symmetric functions [SW2010]_. For more information,\n see :meth:`QuasiSymmetricFunctions.Fundamental.Eulerian()`,\n which accepts the same syntax as this method.\n\n INPUT:\n\n - ``n`` -- the nonnegative integer `n` or a partition\n - ``j`` -- the number of excedances\n - ``k`` -- (optional) if specified, determines the number of fixed\n points of the permutations which are being summed over\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.m()\n sage: m.Eulerian(3, 1)\n 4*m[1, 1, 1] + 3*m[2, 1] + 2*m[3]\n sage: h = Sym.h()\n sage: h.Eulerian(4, 2)\n h[2, 2] + h[3, 1] + h[4]\n sage: s = Sym.s()\n sage: s.Eulerian(5, 2)\n s[2, 2, 1] + s[3, 1, 1] + 5*s[3, 2] + 6*s[4, 1] + 6*s[5]\n sage: s.Eulerian([2,2,1], 2)\n s[2, 2, 1] + s[3, 2] + s[4, 1] + s[5]\n sage: s.Eulerian(5, 2, 2)\n s[3, 2] + s[4, 1] + s[5]\n\n We check Equation (5.4) in [SW2010]_::\n\n sage: h.Eulerian([6], 3)\n h[3, 2, 1] - h[4, 1, 1] + 2*h[4, 2] + h[5, 1]\n sage: s.Eulerian([6], 3)\n s[3, 2, 1] + s[3, 3] + 3*s[4, 2] + 3*s[5, 1] + 3*s[6]\n ' from sage.combinat.ncsf_qsym.qsym import QuasiSymmetricFunctions F = QuasiSymmetricFunctions(self.base_ring()).F() if (n in _Partitions): n = _Partitions(n) return self(F.Eulerian(n, j, k).to_symmetric_function())<|docstring|>Return the Eulerian symmetric function `Q_{n,j}` (with `n` either an integer or a partition) or `Q_{n,j,k}` (if the optional argument ``k`` is specified) in terms of the basis ``self``. It is known that the Eulerian quasisymmetric functions are in fact symmetric functions [SW2010]_. For more information, see :meth:`QuasiSymmetricFunctions.Fundamental.Eulerian()`, which accepts the same syntax as this method. INPUT: - ``n`` -- the nonnegative integer `n` or a partition - ``j`` -- the number of excedances - ``k`` -- (optional) if specified, determines the number of fixed points of the permutations which are being summed over EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.m() sage: m.Eulerian(3, 1) 4*m[1, 1, 1] + 3*m[2, 1] + 2*m[3] sage: h = Sym.h() sage: h.Eulerian(4, 2) h[2, 2] + h[3, 1] + h[4] sage: s = Sym.s() sage: s.Eulerian(5, 2) s[2, 2, 1] + s[3, 1, 1] + 5*s[3, 2] + 6*s[4, 1] + 6*s[5] sage: s.Eulerian([2,2,1], 2) s[2, 2, 1] + s[3, 2] + s[4, 1] + s[5] sage: s.Eulerian(5, 2, 2) s[3, 2] + s[4, 1] + s[5] We check Equation (5.4) in [SW2010]_:: sage: h.Eulerian([6], 3) h[3, 2, 1] - h[4, 1, 1] + 2*h[4, 2] + h[5, 1] sage: s.Eulerian([6], 3) s[3, 2, 1] + s[3, 3] + 3*s[4, 2] + 3*s[5, 1] + 3*s[6]<|endoftext|>
4722b9ae7a49163b6812d8c0b283905fb18eee8e1f202404d6accbfeea6255d1
def degree_zero_coefficient(self): '\n Returns the degree zero coefficient of ``self``.\n\n INPUT:\n\n - ``self`` -- an element of the symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 3*m[[]]\n sage: f.degree_zero_coefficient()\n 3\n ' return self.coefficient([])
Returns the degree zero coefficient of ``self``. INPUT: - ``self`` -- an element of the symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.monomial() sage: f = 2*m[2,1] + 3*m[[]] sage: f.degree_zero_coefficient() 3
src/sage/combinat/sf/sfa.py
degree_zero_coefficient
bopopescu/sagesmc
5
python
def degree_zero_coefficient(self): '\n Returns the degree zero coefficient of ``self``.\n\n INPUT:\n\n - ``self`` -- an element of the symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 3*m[[]]\n sage: f.degree_zero_coefficient()\n 3\n ' return self.coefficient([])
def degree_zero_coefficient(self): '\n Returns the degree zero coefficient of ``self``.\n\n INPUT:\n\n - ``self`` -- an element of the symmetric functions\n\n EXAMPLES::\n\n sage: Sym = SymmetricFunctions(QQ)\n sage: m = Sym.monomial()\n sage: f = 2*m[2,1] + 3*m[[]]\n sage: f.degree_zero_coefficient()\n 3\n ' return self.coefficient([])<|docstring|>Returns the degree zero coefficient of ``self``. INPUT: - ``self`` -- an element of the symmetric functions EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: m = Sym.monomial() sage: f = 2*m[2,1] + 3*m[[]] sage: f.degree_zero_coefficient() 3<|endoftext|>
8d3334a75b2b0eeaa9ce931efa84ea20ca57faf25937e1d702d20b276fdeab40
@classmethod def guiStart(self, parent=None): 'Graphical interface for starting this class' (kwargs, independent) = common._SimplePluginStart('Mapper').startDisplay() kwargs['parent'] = parent return (self(**kwargs), independent)
Graphical interface for starting this class
artview/components/mapper.py
guiStart
savelov/artview
40
python
@classmethod def guiStart(self, parent=None): (kwargs, independent) = common._SimplePluginStart('Mapper').startDisplay() kwargs['parent'] = parent return (self(**kwargs), independent)
@classmethod def guiStart(self, parent=None): (kwargs, independent) = common._SimplePluginStart('Mapper').startDisplay() kwargs['parent'] = parent return (self(**kwargs), independent)<|docstring|>Graphical interface for starting this class<|endoftext|>
b19d76fc12e0368f0f56d7af04928c5585cdb7e2571ce99b99ba5f44e7f15bec
def __init__(self, Vradar=None, Vgrid=None, name='Mapper', parent=None): 'Initialize the class to create the interface.\n\n Parameters\n ----------\n [Optional]\n Vradar : :py:class:`~artview.core.core.Variable` instance\n Radar signal variable.\n A value of None initializes an empty Variable.\n Vgrid : :py:class:`~artview.core.core.Variable` instance\n Grid signal variable.\n A value of None initializes an empty Variable.\n name : string\n Field Radiobutton window name.\n parent : PyQt instance\n Parent instance to associate to this class.\n If None, then Qt owns, otherwise associated w/ parent PyQt instance\n ' super(Mapper, self).__init__(name=name, parent=parent) self.central_widget = QtWidgets.QWidget() self.setCentralWidget(self.central_widget) self.layout = QtWidgets.QGridLayout(self.central_widget) self.mountUI() self.parameters = {'radars': None, 'gridshape': (1, 500, 500), 'grid_limits': ((2000, 3000), ((- 250000), 250000), ((- 250000), 250000)), 'grid_origin': (0, 0), 'grid_origin_lat': 0, 'grid_origin_lon': 0, 'grid_origin_alt': 0, 'gridding_algo': 'map_gates_to_grid', 'fields': [], 'refl_filter_flag': True, 'refl_field': get_field_name('reflectivity'), 'max_refl': 100, 'map_roi': True, 'weighting_function': 'Barnes', 'toa': 17000, 'roi_func': 'dist_beam', 'constant_roi': 500, 'z_factor': 0.05, 'xy_factor': 0.02, 'min_radius': 500, 'bsp': 1, 'copy_field_data': True, 'algorithm': 'kd_tree', 'leafsize': 10} self.general_parameters_type = [('grid_origin_lat', float), ('grid_origin_lon', float), ('grid_origin_alt', float), ('gridding_algo', ('map_to_grid', 'map_gates_to_grid')), ('refl_filter_flag', bool), ('refl_field', str), ('max_refl', float), ('map_roi', bool), ('weighting_function', ('Barnes', 'Cressman')), ('toa', float)] self.roi_parameters_type = [('roi_func', ('constant', 'dist', 'dist_beam')), ('constant_roi', float), ('z_factor', float), ('xy_factor', float), ('min_radius', float), ('bsp', float)] self.gridding_parameters_type = [('copy_field_data', bool), ('algorithm', ('kd_tree', 'ball_tree')), ('leafsize', int)] if (Vradar is None): self.Vradar = Variable(None) else: self.Vradar = Vradar if (Vgrid is None): self.Vgrid = Variable(None) else: self.Vgrid = Vgrid self.sharedVariables = {'Vradar': self.NewRadar, 'Vgrid': None} self.connectAllVariables() self.NewRadar(None, True) self.show()
Initialize the class to create the interface. Parameters ---------- [Optional] Vradar : :py:class:`~artview.core.core.Variable` instance Radar signal variable. A value of None initializes an empty Variable. Vgrid : :py:class:`~artview.core.core.Variable` instance Grid signal variable. A value of None initializes an empty Variable. name : string Field Radiobutton window name. parent : PyQt instance Parent instance to associate to this class. If None, then Qt owns, otherwise associated w/ parent PyQt instance
artview/components/mapper.py
__init__
savelov/artview
40
python
def __init__(self, Vradar=None, Vgrid=None, name='Mapper', parent=None): 'Initialize the class to create the interface.\n\n Parameters\n ----------\n [Optional]\n Vradar : :py:class:`~artview.core.core.Variable` instance\n Radar signal variable.\n A value of None initializes an empty Variable.\n Vgrid : :py:class:`~artview.core.core.Variable` instance\n Grid signal variable.\n A value of None initializes an empty Variable.\n name : string\n Field Radiobutton window name.\n parent : PyQt instance\n Parent instance to associate to this class.\n If None, then Qt owns, otherwise associated w/ parent PyQt instance\n ' super(Mapper, self).__init__(name=name, parent=parent) self.central_widget = QtWidgets.QWidget() self.setCentralWidget(self.central_widget) self.layout = QtWidgets.QGridLayout(self.central_widget) self.mountUI() self.parameters = {'radars': None, 'gridshape': (1, 500, 500), 'grid_limits': ((2000, 3000), ((- 250000), 250000), ((- 250000), 250000)), 'grid_origin': (0, 0), 'grid_origin_lat': 0, 'grid_origin_lon': 0, 'grid_origin_alt': 0, 'gridding_algo': 'map_gates_to_grid', 'fields': [], 'refl_filter_flag': True, 'refl_field': get_field_name('reflectivity'), 'max_refl': 100, 'map_roi': True, 'weighting_function': 'Barnes', 'toa': 17000, 'roi_func': 'dist_beam', 'constant_roi': 500, 'z_factor': 0.05, 'xy_factor': 0.02, 'min_radius': 500, 'bsp': 1, 'copy_field_data': True, 'algorithm': 'kd_tree', 'leafsize': 10} self.general_parameters_type = [('grid_origin_lat', float), ('grid_origin_lon', float), ('grid_origin_alt', float), ('gridding_algo', ('map_to_grid', 'map_gates_to_grid')), ('refl_filter_flag', bool), ('refl_field', str), ('max_refl', float), ('map_roi', bool), ('weighting_function', ('Barnes', 'Cressman')), ('toa', float)] self.roi_parameters_type = [('roi_func', ('constant', 'dist', 'dist_beam')), ('constant_roi', float), ('z_factor', float), ('xy_factor', float), ('min_radius', float), ('bsp', float)] self.gridding_parameters_type = [('copy_field_data', bool), ('algorithm', ('kd_tree', 'ball_tree')), ('leafsize', int)] if (Vradar is None): self.Vradar = Variable(None) else: self.Vradar = Vradar if (Vgrid is None): self.Vgrid = Variable(None) else: self.Vgrid = Vgrid self.sharedVariables = {'Vradar': self.NewRadar, 'Vgrid': None} self.connectAllVariables() self.NewRadar(None, True) self.show()
def __init__(self, Vradar=None, Vgrid=None, name='Mapper', parent=None): 'Initialize the class to create the interface.\n\n Parameters\n ----------\n [Optional]\n Vradar : :py:class:`~artview.core.core.Variable` instance\n Radar signal variable.\n A value of None initializes an empty Variable.\n Vgrid : :py:class:`~artview.core.core.Variable` instance\n Grid signal variable.\n A value of None initializes an empty Variable.\n name : string\n Field Radiobutton window name.\n parent : PyQt instance\n Parent instance to associate to this class.\n If None, then Qt owns, otherwise associated w/ parent PyQt instance\n ' super(Mapper, self).__init__(name=name, parent=parent) self.central_widget = QtWidgets.QWidget() self.setCentralWidget(self.central_widget) self.layout = QtWidgets.QGridLayout(self.central_widget) self.mountUI() self.parameters = {'radars': None, 'gridshape': (1, 500, 500), 'grid_limits': ((2000, 3000), ((- 250000), 250000), ((- 250000), 250000)), 'grid_origin': (0, 0), 'grid_origin_lat': 0, 'grid_origin_lon': 0, 'grid_origin_alt': 0, 'gridding_algo': 'map_gates_to_grid', 'fields': [], 'refl_filter_flag': True, 'refl_field': get_field_name('reflectivity'), 'max_refl': 100, 'map_roi': True, 'weighting_function': 'Barnes', 'toa': 17000, 'roi_func': 'dist_beam', 'constant_roi': 500, 'z_factor': 0.05, 'xy_factor': 0.02, 'min_radius': 500, 'bsp': 1, 'copy_field_data': True, 'algorithm': 'kd_tree', 'leafsize': 10} self.general_parameters_type = [('grid_origin_lat', float), ('grid_origin_lon', float), ('grid_origin_alt', float), ('gridding_algo', ('map_to_grid', 'map_gates_to_grid')), ('refl_filter_flag', bool), ('refl_field', str), ('max_refl', float), ('map_roi', bool), ('weighting_function', ('Barnes', 'Cressman')), ('toa', float)] self.roi_parameters_type = [('roi_func', ('constant', 'dist', 'dist_beam')), ('constant_roi', float), ('z_factor', float), ('xy_factor', float), ('min_radius', float), ('bsp', float)] self.gridding_parameters_type = [('copy_field_data', bool), ('algorithm', ('kd_tree', 'ball_tree')), ('leafsize', int)] if (Vradar is None): self.Vradar = Variable(None) else: self.Vradar = Vradar if (Vgrid is None): self.Vgrid = Variable(None) else: self.Vgrid = Vgrid self.sharedVariables = {'Vradar': self.NewRadar, 'Vgrid': None} self.connectAllVariables() self.NewRadar(None, True) self.show()<|docstring|>Initialize the class to create the interface. Parameters ---------- [Optional] Vradar : :py:class:`~artview.core.core.Variable` instance Radar signal variable. A value of None initializes an empty Variable. Vgrid : :py:class:`~artview.core.core.Variable` instance Grid signal variable. A value of None initializes an empty Variable. name : string Field Radiobutton window name. parent : PyQt instance Parent instance to associate to this class. If None, then Qt owns, otherwise associated w/ parent PyQt instance<|endoftext|>
bcd7797f13a2bf77d9f0e5d7bdb7a08c315b1d3806cf856254240a8568213020
def mountUI(self): 'Mount Options Layout.' self.despeckleButton = QtWidgets.QPushButton('Map') self.despeckleButton.clicked.connect(self.grid_from_radars) self.layout.addWidget(self.despeckleButton, 7, 0, 1, 2) parentdir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) config_icon = QtGui.QIcon(os.sep.join([parentdir, 'icons', 'categories-applications-system-icon.png'])) self.configButton = QtWidgets.QPushButton(config_icon, '') self.layout.addWidget(self.configButton, 7, 2) self.configMenu = QtWidgets.QMenu(self) self.configButton.setMenu(self.configMenu) self.configMenu.addAction(QtWidgets.QAction('Set General Parameters', self, triggered=self.setParameters)) self.configMenu.addAction(QtWidgets.QAction('Set Radius of Influence Parameters', self, triggered=self.setRoiParameters)) self.configMenu.addAction(QtWidgets.QAction('Set map_to_grid Parameters', self, triggered=self.setGriddingParameters)) self.fieldMenu = self.configMenu.addMenu('Fields') self.configMenu.addAction(QtWidgets.QAction('Help', self, triggered=self._displayHelp)) self.layout.addWidget(QtWidgets.QLabel('Z'), 1, 0, 2, 1) self.layout.addWidget(QtWidgets.QLabel('Y'), 3, 0, 2, 1) self.layout.addWidget(QtWidgets.QLabel('X'), 5, 0, 2, 1) self.gridShapeZ = QtWidgets.QSpinBox() self.gridShapeZ.setRange(0, 1000000) self.gridShapeZ.setValue(1) self.gridShapeY = QtWidgets.QSpinBox() self.gridShapeY.setRange(0, 1000000) self.gridShapeY.setValue(500) self.gridShapeX = QtWidgets.QSpinBox() self.gridShapeX.setRange(0, 1000000) self.gridShapeX.setValue(500) self.layout.addWidget(QtWidgets.QLabel('grid_shape'), 0, 1) self.layout.addWidget(self.gridShapeZ, 1, 1, 2, 1) self.layout.addWidget(self.gridShapeY, 3, 1, 2, 1) self.layout.addWidget(self.gridShapeX, 5, 1, 2, 1) self.gridLimitsZmin = QtWidgets.QDoubleSpinBox() self.gridLimitsZmin.setRange((- 41000000), 41000000) self.gridLimitsZmin.setSingleStep(1000) self.gridLimitsZmin.setValue(2000) self.gridLimitsZmax = QtWidgets.QDoubleSpinBox() self.gridLimitsZmax.setRange((- 41000000), 41000000) self.gridLimitsZmax.setSingleStep(1000) self.gridLimitsZmax.setValue(3000) self.gridLimitsYmin = QtWidgets.QDoubleSpinBox() self.gridLimitsYmin.setRange((- 41000000), 41000000) self.gridLimitsYmin.setSingleStep(1000) self.gridLimitsYmin.setValue((- 250000)) self.gridLimitsYmax = QtWidgets.QDoubleSpinBox() self.gridLimitsYmax.setRange((- 41000000), 41000000) self.gridLimitsYmax.setSingleStep(1000) self.gridLimitsYmax.setValue(250000) self.gridLimitsXmin = QtWidgets.QDoubleSpinBox() self.gridLimitsXmin.setRange((- 41000000), 41000000) self.gridLimitsXmin.setSingleStep(1000) self.gridLimitsXmin.setValue((- 250000)) self.gridLimitsXmax = QtWidgets.QDoubleSpinBox() self.gridLimitsXmax.setRange((- 41000000), 41000000) self.gridLimitsXmax.setSingleStep(1000) self.gridLimitsXmax.setValue(250000) self.layout.addWidget(QtWidgets.QLabel('grid_limits (m)'), 0, 2) self.layout.addWidget(self.gridLimitsZmin, 1, 2) self.layout.addWidget(self.gridLimitsZmax, 2, 2) self.layout.addWidget(self.gridLimitsYmin, 3, 2) self.layout.addWidget(self.gridLimitsYmax, 4, 2) self.layout.addWidget(self.gridLimitsXmin, 5, 2) self.layout.addWidget(self.gridLimitsXmax, 6, 2) self.layout.setRowStretch(8, 1) self.layout.setColumnStretch(1, 1) self.layout.setColumnStretch(2, 1)
Mount Options Layout.
artview/components/mapper.py
mountUI
savelov/artview
40
python
def mountUI(self): self.despeckleButton = QtWidgets.QPushButton('Map') self.despeckleButton.clicked.connect(self.grid_from_radars) self.layout.addWidget(self.despeckleButton, 7, 0, 1, 2) parentdir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) config_icon = QtGui.QIcon(os.sep.join([parentdir, 'icons', 'categories-applications-system-icon.png'])) self.configButton = QtWidgets.QPushButton(config_icon, ) self.layout.addWidget(self.configButton, 7, 2) self.configMenu = QtWidgets.QMenu(self) self.configButton.setMenu(self.configMenu) self.configMenu.addAction(QtWidgets.QAction('Set General Parameters', self, triggered=self.setParameters)) self.configMenu.addAction(QtWidgets.QAction('Set Radius of Influence Parameters', self, triggered=self.setRoiParameters)) self.configMenu.addAction(QtWidgets.QAction('Set map_to_grid Parameters', self, triggered=self.setGriddingParameters)) self.fieldMenu = self.configMenu.addMenu('Fields') self.configMenu.addAction(QtWidgets.QAction('Help', self, triggered=self._displayHelp)) self.layout.addWidget(QtWidgets.QLabel('Z'), 1, 0, 2, 1) self.layout.addWidget(QtWidgets.QLabel('Y'), 3, 0, 2, 1) self.layout.addWidget(QtWidgets.QLabel('X'), 5, 0, 2, 1) self.gridShapeZ = QtWidgets.QSpinBox() self.gridShapeZ.setRange(0, 1000000) self.gridShapeZ.setValue(1) self.gridShapeY = QtWidgets.QSpinBox() self.gridShapeY.setRange(0, 1000000) self.gridShapeY.setValue(500) self.gridShapeX = QtWidgets.QSpinBox() self.gridShapeX.setRange(0, 1000000) self.gridShapeX.setValue(500) self.layout.addWidget(QtWidgets.QLabel('grid_shape'), 0, 1) self.layout.addWidget(self.gridShapeZ, 1, 1, 2, 1) self.layout.addWidget(self.gridShapeY, 3, 1, 2, 1) self.layout.addWidget(self.gridShapeX, 5, 1, 2, 1) self.gridLimitsZmin = QtWidgets.QDoubleSpinBox() self.gridLimitsZmin.setRange((- 41000000), 41000000) self.gridLimitsZmin.setSingleStep(1000) self.gridLimitsZmin.setValue(2000) self.gridLimitsZmax = QtWidgets.QDoubleSpinBox() self.gridLimitsZmax.setRange((- 41000000), 41000000) self.gridLimitsZmax.setSingleStep(1000) self.gridLimitsZmax.setValue(3000) self.gridLimitsYmin = QtWidgets.QDoubleSpinBox() self.gridLimitsYmin.setRange((- 41000000), 41000000) self.gridLimitsYmin.setSingleStep(1000) self.gridLimitsYmin.setValue((- 250000)) self.gridLimitsYmax = QtWidgets.QDoubleSpinBox() self.gridLimitsYmax.setRange((- 41000000), 41000000) self.gridLimitsYmax.setSingleStep(1000) self.gridLimitsYmax.setValue(250000) self.gridLimitsXmin = QtWidgets.QDoubleSpinBox() self.gridLimitsXmin.setRange((- 41000000), 41000000) self.gridLimitsXmin.setSingleStep(1000) self.gridLimitsXmin.setValue((- 250000)) self.gridLimitsXmax = QtWidgets.QDoubleSpinBox() self.gridLimitsXmax.setRange((- 41000000), 41000000) self.gridLimitsXmax.setSingleStep(1000) self.gridLimitsXmax.setValue(250000) self.layout.addWidget(QtWidgets.QLabel('grid_limits (m)'), 0, 2) self.layout.addWidget(self.gridLimitsZmin, 1, 2) self.layout.addWidget(self.gridLimitsZmax, 2, 2) self.layout.addWidget(self.gridLimitsYmin, 3, 2) self.layout.addWidget(self.gridLimitsYmax, 4, 2) self.layout.addWidget(self.gridLimitsXmin, 5, 2) self.layout.addWidget(self.gridLimitsXmax, 6, 2) self.layout.setRowStretch(8, 1) self.layout.setColumnStretch(1, 1) self.layout.setColumnStretch(2, 1)
def mountUI(self): self.despeckleButton = QtWidgets.QPushButton('Map') self.despeckleButton.clicked.connect(self.grid_from_radars) self.layout.addWidget(self.despeckleButton, 7, 0, 1, 2) parentdir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) config_icon = QtGui.QIcon(os.sep.join([parentdir, 'icons', 'categories-applications-system-icon.png'])) self.configButton = QtWidgets.QPushButton(config_icon, ) self.layout.addWidget(self.configButton, 7, 2) self.configMenu = QtWidgets.QMenu(self) self.configButton.setMenu(self.configMenu) self.configMenu.addAction(QtWidgets.QAction('Set General Parameters', self, triggered=self.setParameters)) self.configMenu.addAction(QtWidgets.QAction('Set Radius of Influence Parameters', self, triggered=self.setRoiParameters)) self.configMenu.addAction(QtWidgets.QAction('Set map_to_grid Parameters', self, triggered=self.setGriddingParameters)) self.fieldMenu = self.configMenu.addMenu('Fields') self.configMenu.addAction(QtWidgets.QAction('Help', self, triggered=self._displayHelp)) self.layout.addWidget(QtWidgets.QLabel('Z'), 1, 0, 2, 1) self.layout.addWidget(QtWidgets.QLabel('Y'), 3, 0, 2, 1) self.layout.addWidget(QtWidgets.QLabel('X'), 5, 0, 2, 1) self.gridShapeZ = QtWidgets.QSpinBox() self.gridShapeZ.setRange(0, 1000000) self.gridShapeZ.setValue(1) self.gridShapeY = QtWidgets.QSpinBox() self.gridShapeY.setRange(0, 1000000) self.gridShapeY.setValue(500) self.gridShapeX = QtWidgets.QSpinBox() self.gridShapeX.setRange(0, 1000000) self.gridShapeX.setValue(500) self.layout.addWidget(QtWidgets.QLabel('grid_shape'), 0, 1) self.layout.addWidget(self.gridShapeZ, 1, 1, 2, 1) self.layout.addWidget(self.gridShapeY, 3, 1, 2, 1) self.layout.addWidget(self.gridShapeX, 5, 1, 2, 1) self.gridLimitsZmin = QtWidgets.QDoubleSpinBox() self.gridLimitsZmin.setRange((- 41000000), 41000000) self.gridLimitsZmin.setSingleStep(1000) self.gridLimitsZmin.setValue(2000) self.gridLimitsZmax = QtWidgets.QDoubleSpinBox() self.gridLimitsZmax.setRange((- 41000000), 41000000) self.gridLimitsZmax.setSingleStep(1000) self.gridLimitsZmax.setValue(3000) self.gridLimitsYmin = QtWidgets.QDoubleSpinBox() self.gridLimitsYmin.setRange((- 41000000), 41000000) self.gridLimitsYmin.setSingleStep(1000) self.gridLimitsYmin.setValue((- 250000)) self.gridLimitsYmax = QtWidgets.QDoubleSpinBox() self.gridLimitsYmax.setRange((- 41000000), 41000000) self.gridLimitsYmax.setSingleStep(1000) self.gridLimitsYmax.setValue(250000) self.gridLimitsXmin = QtWidgets.QDoubleSpinBox() self.gridLimitsXmin.setRange((- 41000000), 41000000) self.gridLimitsXmin.setSingleStep(1000) self.gridLimitsXmin.setValue((- 250000)) self.gridLimitsXmax = QtWidgets.QDoubleSpinBox() self.gridLimitsXmax.setRange((- 41000000), 41000000) self.gridLimitsXmax.setSingleStep(1000) self.gridLimitsXmax.setValue(250000) self.layout.addWidget(QtWidgets.QLabel('grid_limits (m)'), 0, 2) self.layout.addWidget(self.gridLimitsZmin, 1, 2) self.layout.addWidget(self.gridLimitsZmax, 2, 2) self.layout.addWidget(self.gridLimitsYmin, 3, 2) self.layout.addWidget(self.gridLimitsYmax, 4, 2) self.layout.addWidget(self.gridLimitsXmin, 5, 2) self.layout.addWidget(self.gridLimitsXmax, 6, 2) self.layout.setRowStretch(8, 1) self.layout.setColumnStretch(1, 1) self.layout.setColumnStretch(2, 1)<|docstring|>Mount Options Layout.<|endoftext|>
bc873acd130e91f2efe1461b984fa78b142b8f99583aae609293af6880e0b1d1
def grid_from_radars(self): 'Mount Options and execute :py:func:`~pyart.correct.grid_from_radars`.\n The resulting grid is update in Vgrid.\n ' if (self.Vradar.value is None): common.ShowWarning('Radar is None, can not perform correction') return self.parameters['radars'] = (self.Vradar.value,) self.parameters['fields'] = [] for field in self.field_actions.keys(): if self.field_actions[field].isChecked(): self.parameters['fields'].append(field) self.parameters['grid_shape'] = (self.gridShapeZ.value(), self.gridShapeY.value(), self.gridShapeX.value()) self.parameters['grid_limits'] = ((self.gridLimitsZmin.value(), self.gridLimitsZmax.value()), (self.gridLimitsYmin.value(), self.gridLimitsYmax.value()), (self.gridLimitsXmin.value(), self.gridLimitsXmax.value())) self.parameters['grid_origin'] = (self.parameters['grid_origin_lat'], self.parameters['grid_origin_lon']) print('mapping ..', file=log.debug) t0 = time.time() try: grid = pyart.map.grid_from_radars(**self.parameters) except: import traceback error = traceback.format_exc() common.ShowLongText(('Py-ART fails with following error\n\n' + error)) t1 = time.time() print(('Mapping took %fs' % (t1 - t0)), file=log.debug) self.Vgrid.change(grid)
Mount Options and execute :py:func:`~pyart.correct.grid_from_radars`. The resulting grid is update in Vgrid.
artview/components/mapper.py
grid_from_radars
savelov/artview
40
python
def grid_from_radars(self): 'Mount Options and execute :py:func:`~pyart.correct.grid_from_radars`.\n The resulting grid is update in Vgrid.\n ' if (self.Vradar.value is None): common.ShowWarning('Radar is None, can not perform correction') return self.parameters['radars'] = (self.Vradar.value,) self.parameters['fields'] = [] for field in self.field_actions.keys(): if self.field_actions[field].isChecked(): self.parameters['fields'].append(field) self.parameters['grid_shape'] = (self.gridShapeZ.value(), self.gridShapeY.value(), self.gridShapeX.value()) self.parameters['grid_limits'] = ((self.gridLimitsZmin.value(), self.gridLimitsZmax.value()), (self.gridLimitsYmin.value(), self.gridLimitsYmax.value()), (self.gridLimitsXmin.value(), self.gridLimitsXmax.value())) self.parameters['grid_origin'] = (self.parameters['grid_origin_lat'], self.parameters['grid_origin_lon']) print('mapping ..', file=log.debug) t0 = time.time() try: grid = pyart.map.grid_from_radars(**self.parameters) except: import traceback error = traceback.format_exc() common.ShowLongText(('Py-ART fails with following error\n\n' + error)) t1 = time.time() print(('Mapping took %fs' % (t1 - t0)), file=log.debug) self.Vgrid.change(grid)
def grid_from_radars(self): 'Mount Options and execute :py:func:`~pyart.correct.grid_from_radars`.\n The resulting grid is update in Vgrid.\n ' if (self.Vradar.value is None): common.ShowWarning('Radar is None, can not perform correction') return self.parameters['radars'] = (self.Vradar.value,) self.parameters['fields'] = [] for field in self.field_actions.keys(): if self.field_actions[field].isChecked(): self.parameters['fields'].append(field) self.parameters['grid_shape'] = (self.gridShapeZ.value(), self.gridShapeY.value(), self.gridShapeX.value()) self.parameters['grid_limits'] = ((self.gridLimitsZmin.value(), self.gridLimitsZmax.value()), (self.gridLimitsYmin.value(), self.gridLimitsYmax.value()), (self.gridLimitsXmin.value(), self.gridLimitsXmax.value())) self.parameters['grid_origin'] = (self.parameters['grid_origin_lat'], self.parameters['grid_origin_lon']) print('mapping ..', file=log.debug) t0 = time.time() try: grid = pyart.map.grid_from_radars(**self.parameters) except: import traceback error = traceback.format_exc() common.ShowLongText(('Py-ART fails with following error\n\n' + error)) t1 = time.time() print(('Mapping took %fs' % (t1 - t0)), file=log.debug) self.Vgrid.change(grid)<|docstring|>Mount Options and execute :py:func:`~pyart.correct.grid_from_radars`. The resulting grid is update in Vgrid.<|endoftext|>
3643288cf3ff60ea7cc71ca5323c800e4325190b73f9b9ab11a66093a7f1f3ae
def setParameters(self): 'Open set parameters dialog.' parm = common.get_options(self.general_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]
Open set parameters dialog.
artview/components/mapper.py
setParameters
savelov/artview
40
python
def setParameters(self): parm = common.get_options(self.general_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]
def setParameters(self): parm = common.get_options(self.general_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]<|docstring|>Open set parameters dialog.<|endoftext|>
0ec45bb566c6f5ad92aae36786facfb6715727189d4826fe739ebe82870179d4
def setGriddingParameters(self): 'Open set parameters dialog.' parm = common.get_options(self.gridding_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]
Open set parameters dialog.
artview/components/mapper.py
setGriddingParameters
savelov/artview
40
python
def setGriddingParameters(self): parm = common.get_options(self.gridding_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]
def setGriddingParameters(self): parm = common.get_options(self.gridding_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]<|docstring|>Open set parameters dialog.<|endoftext|>
dec7f5e00d6548992108c9a2fec27c6b86951dc46d34e45f8efe39e1a58fcd9b
def setRoiParameters(self): 'Open set parameters dialog.' parm = common.get_options(self.roi_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]
Open set parameters dialog.
artview/components/mapper.py
setRoiParameters
savelov/artview
40
python
def setRoiParameters(self): parm = common.get_options(self.roi_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]
def setRoiParameters(self): parm = common.get_options(self.roi_parameters_type, self.parameters) for key in parm.keys(): self.parameters[key] = parm[key]<|docstring|>Open set parameters dialog.<|endoftext|>
30c09696e89e096bfb9a7eacdde3fb9aabe6013e1e347a840a02e3be699d14ef
def _displayHelp(self): "Display Py-Art's docstring for help." common.ShowLongText(pyart.map.grid_from_radars.__doc__)
Display Py-Art's docstring for help.
artview/components/mapper.py
_displayHelp
savelov/artview
40
python
def _displayHelp(self): common.ShowLongText(pyart.map.grid_from_radars.__doc__)
def _displayHelp(self): common.ShowLongText(pyart.map.grid_from_radars.__doc__)<|docstring|>Display Py-Art's docstring for help.<|endoftext|>
b3aec951552fcb2e0d51436bf77eb25ebefd87f8f7ce75909956bc565ceb7127
def NewRadar(self, variable, strong): "Display Py-Art's docstring for help." if (self.Vradar.value is None): return fields = self.Vradar.value.fields.keys() self.field_radio_group = QtWidgets.QActionGroup(self, exclusive=False) self.field_actions = {} self.fieldMenu.clear() for field in fields: action = self.field_radio_group.addAction(field) action.setCheckable(True) action.setChecked(True) self.fieldMenu.addAction(action) self.field_actions[field] = action lat = float(self.Vradar.value.latitude['data']) lon = float(self.Vradar.value.longitude['data']) alt = float(self.Vradar.value.altitude['data']) self.parameters['grid_origin_lat'] = lat self.parameters['grid_origin_lon'] = lon self.parameters['grid_origin_alt'] = alt
Display Py-Art's docstring for help.
artview/components/mapper.py
NewRadar
savelov/artview
40
python
def NewRadar(self, variable, strong): if (self.Vradar.value is None): return fields = self.Vradar.value.fields.keys() self.field_radio_group = QtWidgets.QActionGroup(self, exclusive=False) self.field_actions = {} self.fieldMenu.clear() for field in fields: action = self.field_radio_group.addAction(field) action.setCheckable(True) action.setChecked(True) self.fieldMenu.addAction(action) self.field_actions[field] = action lat = float(self.Vradar.value.latitude['data']) lon = float(self.Vradar.value.longitude['data']) alt = float(self.Vradar.value.altitude['data']) self.parameters['grid_origin_lat'] = lat self.parameters['grid_origin_lon'] = lon self.parameters['grid_origin_alt'] = alt
def NewRadar(self, variable, strong): if (self.Vradar.value is None): return fields = self.Vradar.value.fields.keys() self.field_radio_group = QtWidgets.QActionGroup(self, exclusive=False) self.field_actions = {} self.fieldMenu.clear() for field in fields: action = self.field_radio_group.addAction(field) action.setCheckable(True) action.setChecked(True) self.fieldMenu.addAction(action) self.field_actions[field] = action lat = float(self.Vradar.value.latitude['data']) lon = float(self.Vradar.value.longitude['data']) alt = float(self.Vradar.value.altitude['data']) self.parameters['grid_origin_lat'] = lat self.parameters['grid_origin_lon'] = lon self.parameters['grid_origin_alt'] = alt<|docstring|>Display Py-Art's docstring for help.<|endoftext|>
1614d193934143c2b4e15ab4fa455bb091da2158072e852990ed0cb52130fc7c
@Profiler.profile def test_flush_no_pk(n): 'Individual INSERT statements via the ORM, calling upon last row id' session = Session(bind=engine) for chunk in range(0, n, 1000): session.add_all([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(chunk, (chunk + 1000))]) session.flush() session.commit()
Individual INSERT statements via the ORM, calling upon last row id
examples/performance/bulk_inserts.py
test_flush_no_pk
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_flush_no_pk(n): session = Session(bind=engine) for chunk in range(0, n, 1000): session.add_all([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(chunk, (chunk + 1000))]) session.flush() session.commit()
@Profiler.profile def test_flush_no_pk(n): session = Session(bind=engine) for chunk in range(0, n, 1000): session.add_all([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(chunk, (chunk + 1000))]) session.flush() session.commit()<|docstring|>Individual INSERT statements via the ORM, calling upon last row id<|endoftext|>
5036234609bdb51ed02b81f6b723fbb2f4967b043d8ad240c14839b35deb21af
@Profiler.profile def test_bulk_save_return_pks(n): 'Individual INSERT statements in "bulk", but calling upon last row id' session = Session(bind=engine) session.bulk_save_objects([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)], return_defaults=True) session.commit()
Individual INSERT statements in "bulk", but calling upon last row id
examples/performance/bulk_inserts.py
test_bulk_save_return_pks
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_bulk_save_return_pks(n): session = Session(bind=engine) session.bulk_save_objects([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)], return_defaults=True) session.commit()
@Profiler.profile def test_bulk_save_return_pks(n): session = Session(bind=engine) session.bulk_save_objects([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)], return_defaults=True) session.commit()<|docstring|>Individual INSERT statements in "bulk", but calling upon last row id<|endoftext|>
26e338d5a303f236b9c7706212a62be2fd18d3592aecf0b2b031e0602a6093eb
@Profiler.profile def test_flush_pk_given(n): 'Batched INSERT statements via the ORM, PKs already defined' session = Session(bind=engine) for chunk in range(0, n, 1000): session.add_all([Customer(id=(i + 1), name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(chunk, (chunk + 1000))]) session.flush() session.commit()
Batched INSERT statements via the ORM, PKs already defined
examples/performance/bulk_inserts.py
test_flush_pk_given
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_flush_pk_given(n): session = Session(bind=engine) for chunk in range(0, n, 1000): session.add_all([Customer(id=(i + 1), name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(chunk, (chunk + 1000))]) session.flush() session.commit()
@Profiler.profile def test_flush_pk_given(n): session = Session(bind=engine) for chunk in range(0, n, 1000): session.add_all([Customer(id=(i + 1), name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(chunk, (chunk + 1000))]) session.flush() session.commit()<|docstring|>Batched INSERT statements via the ORM, PKs already defined<|endoftext|>
5256f6f336d98ccfd118d25da6f66039045d5fd50d2ad9cca7d384f09b76528b
@Profiler.profile def test_bulk_save(n): 'Batched INSERT statements via the ORM in "bulk", discarding PKs.' session = Session(bind=engine) session.bulk_save_objects([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)]) session.commit()
Batched INSERT statements via the ORM in "bulk", discarding PKs.
examples/performance/bulk_inserts.py
test_bulk_save
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_bulk_save(n): session = Session(bind=engine) session.bulk_save_objects([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)]) session.commit()
@Profiler.profile def test_bulk_save(n): session = Session(bind=engine) session.bulk_save_objects([Customer(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)]) session.commit()<|docstring|>Batched INSERT statements via the ORM in "bulk", discarding PKs.<|endoftext|>
876e8ef2f73e053d3ddfe8d69a3354cbe6b34e1bd3f00259ba807bb3d5b8da55
@Profiler.profile def test_bulk_insert_mappings(n): 'Batched INSERT statements via the ORM "bulk", using dictionaries.' session = Session(bind=engine) session.bulk_insert_mappings(Customer, [dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)]) session.commit()
Batched INSERT statements via the ORM "bulk", using dictionaries.
examples/performance/bulk_inserts.py
test_bulk_insert_mappings
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_bulk_insert_mappings(n): session = Session(bind=engine) session.bulk_insert_mappings(Customer, [dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)]) session.commit()
@Profiler.profile def test_bulk_insert_mappings(n): session = Session(bind=engine) session.bulk_insert_mappings(Customer, [dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)]) session.commit()<|docstring|>Batched INSERT statements via the ORM "bulk", using dictionaries.<|endoftext|>
931b9508319c147ec2985046caa76cdb7ec277a51fad011d17d9a213d7b9e7b7
@Profiler.profile def test_core_insert(n): 'A single Core INSERT construct inserting mappings in bulk.' conn = engine.connect() conn.execute(Customer.__table__.insert(), [dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)])
A single Core INSERT construct inserting mappings in bulk.
examples/performance/bulk_inserts.py
test_core_insert
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_core_insert(n): conn = engine.connect() conn.execute(Customer.__table__.insert(), [dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)])
@Profiler.profile def test_core_insert(n): conn = engine.connect() conn.execute(Customer.__table__.insert(), [dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)])<|docstring|>A single Core INSERT construct inserting mappings in bulk.<|endoftext|>
ce110adea04024e911b1ff5b3734d9e61aa5dceba97ede1b435e95240c2634e2
@Profiler.profile def test_dbapi_raw(n): "The DBAPI's API inserting rows in bulk." conn = engine.pool._creator() cursor = conn.cursor() compiled = Customer.__table__.insert().values(name=bindparam('name'), description=bindparam('description')).compile(dialect=engine.dialect) if compiled.positional: args = ((('customer name %d' % i), ('customer description %d' % i)) for i in range(n)) else: args = (dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)) cursor.executemany(str(compiled), list(args)) conn.commit() conn.close()
The DBAPI's API inserting rows in bulk.
examples/performance/bulk_inserts.py
test_dbapi_raw
NickKush/sqlalchemy
5,383
python
@Profiler.profile def test_dbapi_raw(n): conn = engine.pool._creator() cursor = conn.cursor() compiled = Customer.__table__.insert().values(name=bindparam('name'), description=bindparam('description')).compile(dialect=engine.dialect) if compiled.positional: args = ((('customer name %d' % i), ('customer description %d' % i)) for i in range(n)) else: args = (dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)) cursor.executemany(str(compiled), list(args)) conn.commit() conn.close()
@Profiler.profile def test_dbapi_raw(n): conn = engine.pool._creator() cursor = conn.cursor() compiled = Customer.__table__.insert().values(name=bindparam('name'), description=bindparam('description')).compile(dialect=engine.dialect) if compiled.positional: args = ((('customer name %d' % i), ('customer description %d' % i)) for i in range(n)) else: args = (dict(name=('customer name %d' % i), description=('customer description %d' % i)) for i in range(n)) cursor.executemany(str(compiled), list(args)) conn.commit() conn.close()<|docstring|>The DBAPI's API inserting rows in bulk.<|endoftext|>
3f38675d125afd3c289f08306f3c5fa707cb76c17ae195e3fbf22c3dc6e06c87
@contextlib.contextmanager def change_directory(path): 'Changes working directory and returns to previous on exit.' previous = Path.cwd() os.chdir(path) try: (yield) finally: os.chdir(previous)
Changes working directory and returns to previous on exit.
tests/support.py
change_directory
akashdhruv/FlashKit
2
python
@contextlib.contextmanager def change_directory(path): previous = Path.cwd() os.chdir(path) try: (yield) finally: os.chdir(previous)
@contextlib.contextmanager def change_directory(path): previous = Path.cwd() os.chdir(path) try: (yield) finally: os.chdir(previous)<|docstring|>Changes working directory and returns to previous on exit.<|endoftext|>
310fc428cef5ea675261879e92a4c5ccf63268a9eee949bed45068a3e03f1e43
def exclude(path: str): 'Does the path meet any rules for exclusion?' EXCLUDES = {'__.*__', '/\\.'} NO_LINKS = {'\\.xmf', '\\.h5', 'run'} return any((re.search(exclude, str(path)) for exclude in EXCLUDES.union(NO_LINKS)))
Does the path meet any rules for exclusion?
tests/support.py
exclude
akashdhruv/FlashKit
2
python
def exclude(path: str): EXCLUDES = {'__.*__', '/\\.'} NO_LINKS = {'\\.xmf', '\\.h5', 'run'} return any((re.search(exclude, str(path)) for exclude in EXCLUDES.union(NO_LINKS)))
def exclude(path: str): EXCLUDES = {'__.*__', '/\\.'} NO_LINKS = {'\\.xmf', '\\.h5', 'run'} return any((re.search(exclude, str(path)) for exclude in EXCLUDES.union(NO_LINKS)))<|docstring|>Does the path meet any rules for exclusion?<|endoftext|>
c236343d4d3cd4b264104909bd32b9f481e612f68ee0ff182f44fa0ee845d8a6
def selectStack(self, parent_trace): '\n Called as part of setting up each integration test case. It chooses and provisions the stack that should\n be used by this test case.\n ' self._stack = ShutilStoreTestStack(parent_trace, self.a6i_config)
Called as part of setting up each integration test case. It chooses and provisions the stack that should be used by this test case.
src/apodeixi/knowledge_base/tests_integration/post_update_skeleton.py
selectStack
ChateauClaudia-Labs/apodeixi
0
python
def selectStack(self, parent_trace): '\n Called as part of setting up each integration test case. It chooses and provisions the stack that should\n be used by this test case.\n ' self._stack = ShutilStoreTestStack(parent_trace, self.a6i_config)
def selectStack(self, parent_trace): '\n Called as part of setting up each integration test case. It chooses and provisions the stack that should\n be used by this test case.\n ' self._stack = ShutilStoreTestStack(parent_trace, self.a6i_config)<|docstring|>Called as part of setting up each integration test case. It chooses and provisions the stack that should be used by this test case.<|endoftext|>
67b889af2c82ae5692acba976423562d248d1d7262c726bcb7ca0fbc05e15b37
def setup_static_data(self, parent_trace): '\n Sets up the static data that is generally needed by flow tests\n ' EXCEL_FILES = ['products.static-data.admin.a6i.xlsx', 'scoring-cycles.static-data.admin.a6i.xlsx'] my_trace = parent_trace.doing('Setting up static data') for file in EXCEL_FILES: loop_trace = my_trace.doing((("Posting file '" + str(file)) + "'")) posting_path = ((((self.getInputDataFolder(loop_trace) + '/') + self.scenario()) + '/') + file) (response, log_txt) = self.stack().kb().postByFile(parent_trace=loop_trace, path_of_file_being_posted=posting_path, excel_sheet='Posting Label')
Sets up the static data that is generally needed by flow tests
src/apodeixi/knowledge_base/tests_integration/post_update_skeleton.py
setup_static_data
ChateauClaudia-Labs/apodeixi
0
python
def setup_static_data(self, parent_trace): '\n \n ' EXCEL_FILES = ['products.static-data.admin.a6i.xlsx', 'scoring-cycles.static-data.admin.a6i.xlsx'] my_trace = parent_trace.doing('Setting up static data') for file in EXCEL_FILES: loop_trace = my_trace.doing((("Posting file '" + str(file)) + "'")) posting_path = ((((self.getInputDataFolder(loop_trace) + '/') + self.scenario()) + '/') + file) (response, log_txt) = self.stack().kb().postByFile(parent_trace=loop_trace, path_of_file_being_posted=posting_path, excel_sheet='Posting Label')
def setup_static_data(self, parent_trace): '\n \n ' EXCEL_FILES = ['products.static-data.admin.a6i.xlsx', 'scoring-cycles.static-data.admin.a6i.xlsx'] my_trace = parent_trace.doing('Setting up static data') for file in EXCEL_FILES: loop_trace = my_trace.doing((("Posting file '" + str(file)) + "'")) posting_path = ((((self.getInputDataFolder(loop_trace) + '/') + self.scenario()) + '/') + file) (response, log_txt) = self.stack().kb().postByFile(parent_trace=loop_trace, path_of_file_being_posted=posting_path, excel_sheet='Posting Label')<|docstring|>Sets up the static data that is generally needed by flow tests<|endoftext|>
ad97078d248855e0ccfad897eebeb4ae144225afb9e3b4a889bea909f91c0deb
def setup_reference_data(self, parent_trace): '\n Sets up any reference data (such as other manifests) that are assumed as pre-conditions by this test. \n ' if (self.scenario() == 'basic_posting_flows.milestones'): EXCEL_FILE = 'for_mls.big-rocks.journeys.a6i.xlsx' EXCEL_FOLDER = ((self.getInputDataFolder(parent_trace) + '/') + self.scenario()) my_trace = self.trace_environment(parent_trace, 'Creating big-rocks dependency') if True: clientURL = self.stack().store().current_environment(my_trace).clientURL(my_trace) posting_path = ((EXCEL_FOLDER + '/') + EXCEL_FILE) (response, log_txt) = self.stack().kb().postByFile(parent_trace=my_trace, path_of_file_being_posted=posting_path, excel_sheet='Posting Label') self.check_environment_contents(parent_trace=my_trace) else: return
Sets up any reference data (such as other manifests) that are assumed as pre-conditions by this test.
src/apodeixi/knowledge_base/tests_integration/post_update_skeleton.py
setup_reference_data
ChateauClaudia-Labs/apodeixi
0
python
def setup_reference_data(self, parent_trace): '\n \n ' if (self.scenario() == 'basic_posting_flows.milestones'): EXCEL_FILE = 'for_mls.big-rocks.journeys.a6i.xlsx' EXCEL_FOLDER = ((self.getInputDataFolder(parent_trace) + '/') + self.scenario()) my_trace = self.trace_environment(parent_trace, 'Creating big-rocks dependency') if True: clientURL = self.stack().store().current_environment(my_trace).clientURL(my_trace) posting_path = ((EXCEL_FOLDER + '/') + EXCEL_FILE) (response, log_txt) = self.stack().kb().postByFile(parent_trace=my_trace, path_of_file_being_posted=posting_path, excel_sheet='Posting Label') self.check_environment_contents(parent_trace=my_trace) else: return
def setup_reference_data(self, parent_trace): '\n \n ' if (self.scenario() == 'basic_posting_flows.milestones'): EXCEL_FILE = 'for_mls.big-rocks.journeys.a6i.xlsx' EXCEL_FOLDER = ((self.getInputDataFolder(parent_trace) + '/') + self.scenario()) my_trace = self.trace_environment(parent_trace, 'Creating big-rocks dependency') if True: clientURL = self.stack().store().current_environment(my_trace).clientURL(my_trace) posting_path = ((EXCEL_FOLDER + '/') + EXCEL_FILE) (response, log_txt) = self.stack().kb().postByFile(parent_trace=my_trace, path_of_file_being_posted=posting_path, excel_sheet='Posting Label') self.check_environment_contents(parent_trace=my_trace) else: return<|docstring|>Sets up any reference data (such as other manifests) that are assumed as pre-conditions by this test.<|endoftext|>
a8f4be543135430936fd5890917a0ef00d869fed952d00fd832aaf6f676124bd
def is_palindrome(text): 'A string of characters is a palindrome if it reads the same forwards and\n backwards, ignoring punctuation, whitespace, and letter casing.' assert isinstance(text, str), 'input is not a string: {}'.format(text) return is_palindrome_recursive(text, 0, (len(text) - 1))
A string of characters is a palindrome if it reads the same forwards and backwards, ignoring punctuation, whitespace, and letter casing.
Src-Code/palindromes-and-strings/palindromes.py
is_palindrome
KingGenius5/CS13-Core-Data-Structures
0
python
def is_palindrome(text): 'A string of characters is a palindrome if it reads the same forwards and\n backwards, ignoring punctuation, whitespace, and letter casing.' assert isinstance(text, str), 'input is not a string: {}'.format(text) return is_palindrome_recursive(text, 0, (len(text) - 1))
def is_palindrome(text): 'A string of characters is a palindrome if it reads the same forwards and\n backwards, ignoring punctuation, whitespace, and letter casing.' assert isinstance(text, str), 'input is not a string: {}'.format(text) return is_palindrome_recursive(text, 0, (len(text) - 1))<|docstring|>A string of characters is a palindrome if it reads the same forwards and backwards, ignoring punctuation, whitespace, and letter casing.<|endoftext|>
3feab423bf657c5fdd817568c518c266ef78608297cc93dbcd88bdfe49f14bd5
def set_soc_variables(self): 'Set variables relating to the state of charge.' z = pybamm.standard_spatial_vars.z soc = (pybamm.Integral(self.variables['X-averaged electrolyte concentration'], z) * 100) self.variables.update({'State of Charge': soc, 'Depth of Discharge': (100 - soc)}) if ('Fractional Charge Input' not in self.variables): fci = pybamm.Variable('Fractional Charge Input', domain='current collector') self.variables['Fractional Charge Input'] = fci self.rhs[fci] = ((- self.variables['Total current density']) * 100) self.initial_conditions[fci] = (self.param.q_init * 100)
Set variables relating to the state of charge.
pybamm/models/full_battery_models/lead_acid/base_lead_acid_model.py
set_soc_variables
DrSOKane/PyBaMM
1
python
def set_soc_variables(self): z = pybamm.standard_spatial_vars.z soc = (pybamm.Integral(self.variables['X-averaged electrolyte concentration'], z) * 100) self.variables.update({'State of Charge': soc, 'Depth of Discharge': (100 - soc)}) if ('Fractional Charge Input' not in self.variables): fci = pybamm.Variable('Fractional Charge Input', domain='current collector') self.variables['Fractional Charge Input'] = fci self.rhs[fci] = ((- self.variables['Total current density']) * 100) self.initial_conditions[fci] = (self.param.q_init * 100)
def set_soc_variables(self): z = pybamm.standard_spatial_vars.z soc = (pybamm.Integral(self.variables['X-averaged electrolyte concentration'], z) * 100) self.variables.update({'State of Charge': soc, 'Depth of Discharge': (100 - soc)}) if ('Fractional Charge Input' not in self.variables): fci = pybamm.Variable('Fractional Charge Input', domain='current collector') self.variables['Fractional Charge Input'] = fci self.rhs[fci] = ((- self.variables['Total current density']) * 100) self.initial_conditions[fci] = (self.param.q_init * 100)<|docstring|>Set variables relating to the state of charge.<|endoftext|>
19c01b3b8fb084a3942e2a132551dcf972e8d2f25fba8c2adc115e9768969dc4
def Update(self, level: Map, dt: int, movingAIGroup: pygame.sprite.Group): 'Update the AI. Brain and needs' self.time += dt if (self.time > 500): self.time = 0 self.needs.stepNeeds() self.movingCreatures = movingAIGroup self.brain.update(level)
Update the AI. Brain and needs
ClergyRobotClasses/ClergyRobot.py
Update
FearlessClock/RobotFactory
0
python
def Update(self, level: Map, dt: int, movingAIGroup: pygame.sprite.Group): self.time += dt if (self.time > 500): self.time = 0 self.needs.stepNeeds() self.movingCreatures = movingAIGroup self.brain.update(level)
def Update(self, level: Map, dt: int, movingAIGroup: pygame.sprite.Group): self.time += dt if (self.time > 500): self.time = 0 self.needs.stepNeeds() self.movingCreatures = movingAIGroup self.brain.update(level)<|docstring|>Update the AI. Brain and needs<|endoftext|>
d3b4188f2ab2f5585dc9ddd9e67cfd6727edcbe33cdf9c57ce22855191733ad7
@staticmethod def _distance(token_from: str, token_to: str) -> float: '\n Calculates distance between two cell centers in KMs based on Earth radius 6373 KM\n :param cell_a: first cell\n :param cell_b: second cell\n :return: distance in KMs\n ' r = 6373.0 cell_from = s2sphere.CellId.from_token(token_from) cell_to = s2sphere.CellId.from_token(token_to) return (cell_from.to_lat_lng().get_distance(cell_to.to_lat_lng()).radians * r)
Calculates distance between two cell centers in KMs based on Earth radius 6373 KM :param cell_a: first cell :param cell_b: second cell :return: distance in KMs
src/pipeline_oriented_analytics/transformer/sphere_distance.py
_distance
bbiletskyy/pipeline-oriented-analytics
8
python
@staticmethod def _distance(token_from: str, token_to: str) -> float: '\n Calculates distance between two cell centers in KMs based on Earth radius 6373 KM\n :param cell_a: first cell\n :param cell_b: second cell\n :return: distance in KMs\n ' r = 6373.0 cell_from = s2sphere.CellId.from_token(token_from) cell_to = s2sphere.CellId.from_token(token_to) return (cell_from.to_lat_lng().get_distance(cell_to.to_lat_lng()).radians * r)
@staticmethod def _distance(token_from: str, token_to: str) -> float: '\n Calculates distance between two cell centers in KMs based on Earth radius 6373 KM\n :param cell_a: first cell\n :param cell_b: second cell\n :return: distance in KMs\n ' r = 6373.0 cell_from = s2sphere.CellId.from_token(token_from) cell_to = s2sphere.CellId.from_token(token_to) return (cell_from.to_lat_lng().get_distance(cell_to.to_lat_lng()).radians * r)<|docstring|>Calculates distance between two cell centers in KMs based on Earth radius 6373 KM :param cell_a: first cell :param cell_b: second cell :return: distance in KMs<|endoftext|>
27f3124b5ff5776e6040d3491fc3dc9d6246ee0dddf6b8bc22855a6973da9bbe
@command('install') def install(config): 'install elasticsearch from zip right here, mostly used for testing' package = 'elasticsearch' version = '6.3.2' filename = '{}-{}.zip'.format(package, version) if (not exists(filename)): url = ('https://artifacts.elastic.co/downloads/elasticsearch/' + filename) logger.info('Downloading %s', url) r = requests.get(url) with open(filename, 'wb') as output: for chunk in r.iter_content(chunk_size=(512 * 1024)): output.write(chunk) logger.info('Extracting %s', filename) import zipfile zip_ref = MyZipFile(filename, 'r') zip_ref.extractall('.') zip_ref.close()
install elasticsearch from zip right here, mostly used for testing
elastico/cli_old.py
install
klorenz/python-elastico
0
python
@command('install') def install(config): package = 'elasticsearch' version = '6.3.2' filename = '{}-{}.zip'.format(package, version) if (not exists(filename)): url = ('https://artifacts.elastic.co/downloads/elasticsearch/' + filename) logger.info('Downloading %s', url) r = requests.get(url) with open(filename, 'wb') as output: for chunk in r.iter_content(chunk_size=(512 * 1024)): output.write(chunk) logger.info('Extracting %s', filename) import zipfile zip_ref = MyZipFile(filename, 'r') zip_ref.extractall('.') zip_ref.close()
@command('install') def install(config): package = 'elasticsearch' version = '6.3.2' filename = '{}-{}.zip'.format(package, version) if (not exists(filename)): url = ('https://artifacts.elastic.co/downloads/elasticsearch/' + filename) logger.info('Downloading %s', url) r = requests.get(url) with open(filename, 'wb') as output: for chunk in r.iter_content(chunk_size=(512 * 1024)): output.write(chunk) logger.info('Extracting %s', filename) import zipfile zip_ref = MyZipFile(filename, 'r') zip_ref.extractall('.') zip_ref.close()<|docstring|>install elasticsearch from zip right here, mostly used for testing<|endoftext|>
e4bd6a27174e7deb5534bd94c62a6aa4cc7b49d83d2e8d864a94b9872cb2d79e
@command('run') def install(config): 'run elastic search in current directory' package = 'elasticsearch' version = '6.3.2' executable = '{}-{}/bin/elasticsearch'.format(package, version) os.execl(executable, executable)
run elastic search in current directory
elastico/cli_old.py
install
klorenz/python-elastico
0
python
@command('run') def install(config): package = 'elasticsearch' version = '6.3.2' executable = '{}-{}/bin/elasticsearch'.format(package, version) os.execl(executable, executable)
@command('run') def install(config): package = 'elasticsearch' version = '6.3.2' executable = '{}-{}/bin/elasticsearch'.format(package, version) os.execl(executable, executable)<|docstring|>run elastic search in current directory<|endoftext|>
9933556e61ead66d089cabf3df2f1029f3335d6246aeacce9f74803d17c21b40
@command('export', arg('--format', choices=('zip', 'dir'), default='dir'), arg('index_name', help='name of index to export')) def cmd_export(config): 'Export indices into your working directory\n ' from .connection import elasticsearch es = elasticsearch(config) from elasticsearch.helpers import scan index_name = config.get('export.index_name') result = es.indices.get(index_name) for (idx_name, idx_data) in result.items(): if (config.get('export.format') == 'dir'): os.makedirs(idx_name) with open(join(idx_name, 'mappings.json'), 'w') as f: json.dump(result[idx_name]['mappings'], f) log.info('exporting %s to %s/', idx_name, idx_name) with open(join(idx_name, 'data.json'), 'w') as f: for data in scan(es, query={'query': {'match_all': {}}}, index=index_name): json.dump(data, f) f.write('\n') elif (config.get('export.format') == 'zip'): pass
Export indices into your working directory
elastico/cli_old.py
cmd_export
klorenz/python-elastico
0
python
@command('export', arg('--format', choices=('zip', 'dir'), default='dir'), arg('index_name', help='name of index to export')) def cmd_export(config): '\n ' from .connection import elasticsearch es = elasticsearch(config) from elasticsearch.helpers import scan index_name = config.get('export.index_name') result = es.indices.get(index_name) for (idx_name, idx_data) in result.items(): if (config.get('export.format') == 'dir'): os.makedirs(idx_name) with open(join(idx_name, 'mappings.json'), 'w') as f: json.dump(result[idx_name]['mappings'], f) log.info('exporting %s to %s/', idx_name, idx_name) with open(join(idx_name, 'data.json'), 'w') as f: for data in scan(es, query={'query': {'match_all': {}}}, index=index_name): json.dump(data, f) f.write('\n') elif (config.get('export.format') == 'zip'): pass
@command('export', arg('--format', choices=('zip', 'dir'), default='dir'), arg('index_name', help='name of index to export')) def cmd_export(config): '\n ' from .connection import elasticsearch es = elasticsearch(config) from elasticsearch.helpers import scan index_name = config.get('export.index_name') result = es.indices.get(index_name) for (idx_name, idx_data) in result.items(): if (config.get('export.format') == 'dir'): os.makedirs(idx_name) with open(join(idx_name, 'mappings.json'), 'w') as f: json.dump(result[idx_name]['mappings'], f) log.info('exporting %s to %s/', idx_name, idx_name) with open(join(idx_name, 'data.json'), 'w') as f: for data in scan(es, query={'query': {'match_all': {}}}, index=index_name): json.dump(data, f) f.write('\n') elif (config.get('export.format') == 'zip'): pass<|docstring|>Export indices into your working directory<|endoftext|>
24a070d4af075fecc39c3b3538087b0e76ec6af04ad74bc8a4fa5b1a9288c701
def main(): 'Main entry point for script.' parser = argparse.ArgumentParser(description='Find a RSA private key collision.') parser.add_argument('cipher_path', help='Cipher') parser.add_argument('message_path', help='Message') parser.add_argument('secretkey_path', help='Secret Key in pem format') parser.add_argument('--log_path', type=str, help='Create a log in given path') args = parser.parse_args() mfile = open(args.message_path, 'r') message = mfile.read() mfile.close() cfile = open(args.cipher_path, 'r') cipher = cfile.read() cfile.close() kfile = open(args.publickey_path, 'r') publickey = kfile.read() kfile.close() if (args.log_path is not None): path = (args.log_path + '/latency.log') basicConfig(filename=path, level=DEBUG) start = time() print(collision_finder(message, cipher, publickey)) debug('%s: collision_finder: %s [s]', asctime(localtime(time())), (time() - start))
Main entry point for script.
deniable/scripts/deniablecollision.py
main
victormn/deniable-encryption
3
python
def main(): parser = argparse.ArgumentParser(description='Find a RSA private key collision.') parser.add_argument('cipher_path', help='Cipher') parser.add_argument('message_path', help='Message') parser.add_argument('secretkey_path', help='Secret Key in pem format') parser.add_argument('--log_path', type=str, help='Create a log in given path') args = parser.parse_args() mfile = open(args.message_path, 'r') message = mfile.read() mfile.close() cfile = open(args.cipher_path, 'r') cipher = cfile.read() cfile.close() kfile = open(args.publickey_path, 'r') publickey = kfile.read() kfile.close() if (args.log_path is not None): path = (args.log_path + '/latency.log') basicConfig(filename=path, level=DEBUG) start = time() print(collision_finder(message, cipher, publickey)) debug('%s: collision_finder: %s [s]', asctime(localtime(time())), (time() - start))
def main(): parser = argparse.ArgumentParser(description='Find a RSA private key collision.') parser.add_argument('cipher_path', help='Cipher') parser.add_argument('message_path', help='Message') parser.add_argument('secretkey_path', help='Secret Key in pem format') parser.add_argument('--log_path', type=str, help='Create a log in given path') args = parser.parse_args() mfile = open(args.message_path, 'r') message = mfile.read() mfile.close() cfile = open(args.cipher_path, 'r') cipher = cfile.read() cfile.close() kfile = open(args.publickey_path, 'r') publickey = kfile.read() kfile.close() if (args.log_path is not None): path = (args.log_path + '/latency.log') basicConfig(filename=path, level=DEBUG) start = time() print(collision_finder(message, cipher, publickey)) debug('%s: collision_finder: %s [s]', asctime(localtime(time())), (time() - start))<|docstring|>Main entry point for script.<|endoftext|>
0189b881444f6d000c78aa07515d0bc7bbc8b9216c52807d32a5431fe4ac4de9
def clean_word(to_clean): 'Normalizes and cleans a non-ascii string.\n\n Args:\n to_clean (string): the string to clean and normalize.\n\n Returns:\n A cleaned and normalized string\n ' import string import unicodedata return unicodedata.normalize('NFKD', to_clean).encode('ASCII', 'ignore').lower().strip().replace(' ', '').translate(None, string.punctuation)
Normalizes and cleans a non-ascii string. Args: to_clean (string): the string to clean and normalize. Returns: A cleaned and normalized string
9. is_anagram/anagram.py
clean_word
jeury301/python-morsels
2
python
def clean_word(to_clean): 'Normalizes and cleans a non-ascii string.\n\n Args:\n to_clean (string): the string to clean and normalize.\n\n Returns:\n A cleaned and normalized string\n ' import string import unicodedata return unicodedata.normalize('NFKD', to_clean).encode('ASCII', 'ignore').lower().strip().replace(' ', ).translate(None, string.punctuation)
def clean_word(to_clean): 'Normalizes and cleans a non-ascii string.\n\n Args:\n to_clean (string): the string to clean and normalize.\n\n Returns:\n A cleaned and normalized string\n ' import string import unicodedata return unicodedata.normalize('NFKD', to_clean).encode('ASCII', 'ignore').lower().strip().replace(' ', ).translate(None, string.punctuation)<|docstring|>Normalizes and cleans a non-ascii string. Args: to_clean (string): the string to clean and normalize. Returns: A cleaned and normalized string<|endoftext|>
f25f8caf5c61968c6d1b95286aae3f3253e61911e8aa531487f21923ad91f072
def is_anagram(first_word, second_word): 'Determining if two strings are anagrams of each other.\n\n Args:\n first_word (string): a string to test for anagram property\n second_word (string): a string to test for anagram property against\n the first.\n\n Returns:\n True or False, based on whether the strings are anagram of each other\n ' clean_first_word = clean_word(first_word) clean_second_word = clean_word(second_word) if (len(clean_first_word) != len(clean_second_word)): return False clean_second_iter = iter(clean_second_word) while True: try: if (next(clean_second_iter) not in clean_first_word): return False except StopIteration: return True
Determining if two strings are anagrams of each other. Args: first_word (string): a string to test for anagram property second_word (string): a string to test for anagram property against the first. Returns: True or False, based on whether the strings are anagram of each other
9. is_anagram/anagram.py
is_anagram
jeury301/python-morsels
2
python
def is_anagram(first_word, second_word): 'Determining if two strings are anagrams of each other.\n\n Args:\n first_word (string): a string to test for anagram property\n second_word (string): a string to test for anagram property against\n the first.\n\n Returns:\n True or False, based on whether the strings are anagram of each other\n ' clean_first_word = clean_word(first_word) clean_second_word = clean_word(second_word) if (len(clean_first_word) != len(clean_second_word)): return False clean_second_iter = iter(clean_second_word) while True: try: if (next(clean_second_iter) not in clean_first_word): return False except StopIteration: return True
def is_anagram(first_word, second_word): 'Determining if two strings are anagrams of each other.\n\n Args:\n first_word (string): a string to test for anagram property\n second_word (string): a string to test for anagram property against\n the first.\n\n Returns:\n True or False, based on whether the strings are anagram of each other\n ' clean_first_word = clean_word(first_word) clean_second_word = clean_word(second_word) if (len(clean_first_word) != len(clean_second_word)): return False clean_second_iter = iter(clean_second_word) while True: try: if (next(clean_second_iter) not in clean_first_word): return False except StopIteration: return True<|docstring|>Determining if two strings are anagrams of each other. Args: first_word (string): a string to test for anagram property second_word (string): a string to test for anagram property against the first. Returns: True or False, based on whether the strings are anagram of each other<|endoftext|>
c95875569dcc5ffc8950d2c4ece5616d06ab78164eb865331804a7f284b936a2
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): '3x3 convolution with padding' return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation)
3x3 convolution with padding
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
conv3x3
minhtannguyen/RAdam
0
python
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation)
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation)<|docstring|>3x3 convolution with padding<|endoftext|>
7447c07b06cc8d16674f31fc29f40a376c8d7a0321f9f661635b233109ed88c5
def conv1x1(in_planes, out_planes, stride=1): '1x1 convolution' return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
1x1 convolution
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
conv1x1
minhtannguyen/RAdam
0
python
def conv1x1(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv1x1(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)<|docstring|>1x1 convolution<|endoftext|>
3eeb63ed21a1e3cf7377ab8616b9ff240781f8ec3174bfb7797ac0ce9208c849
def horesnet18(pretrained=False, progress=True, **kwargs): 'ResNet-18 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet18', BasicBlock, [2, 2, 2, 2], pretrained, progress, **kwargs)
ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnet18
minhtannguyen/RAdam
0
python
def horesnet18(pretrained=False, progress=True, **kwargs): 'ResNet-18 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet18', BasicBlock, [2, 2, 2, 2], pretrained, progress, **kwargs)
def horesnet18(pretrained=False, progress=True, **kwargs): 'ResNet-18 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet18', BasicBlock, [2, 2, 2, 2], pretrained, progress, **kwargs)<|docstring|>ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
15a5918ee3b9ea6522f5f002cd07e67fe91fbcbe671f3387f3836393cae10b98
def horesnet34(pretrained=False, progress=True, **kwargs): 'ResNet-34 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet34', BasicBlock, [3, 4, 6, 3], pretrained, progress, **kwargs)
ResNet-34 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnet34
minhtannguyen/RAdam
0
python
def horesnet34(pretrained=False, progress=True, **kwargs): 'ResNet-34 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet34', BasicBlock, [3, 4, 6, 3], pretrained, progress, **kwargs)
def horesnet34(pretrained=False, progress=True, **kwargs): 'ResNet-34 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet34', BasicBlock, [3, 4, 6, 3], pretrained, progress, **kwargs)<|docstring|>ResNet-34 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
1bb41955bd64d089670e97b0b04e84c8494ef7235a88681b139fc7b5fc06c45b
def horesnet50(pretrained=False, progress=True, **kwargs): 'ResNet-50 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet50', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)
ResNet-50 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnet50
minhtannguyen/RAdam
0
python
def horesnet50(pretrained=False, progress=True, **kwargs): 'ResNet-50 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet50', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)
def horesnet50(pretrained=False, progress=True, **kwargs): 'ResNet-50 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet50', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)<|docstring|>ResNet-50 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
ed267532dfb5b423112510b0fb48676ddc27deef00a596b7839442116f4a1dca
def horesnet101(pretrained=False, progress=True, **kwargs): 'ResNet-101 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet101', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)
ResNet-101 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnet101
minhtannguyen/RAdam
0
python
def horesnet101(pretrained=False, progress=True, **kwargs): 'ResNet-101 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet101', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)
def horesnet101(pretrained=False, progress=True, **kwargs): 'ResNet-101 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet101', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)<|docstring|>ResNet-101 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
fb241393713e6a2c2f9c19a9cbaaaa705fdc4b3dc2ff4463217443040901b475
def horesnet152(pretrained=False, progress=True, **kwargs): 'ResNet-152 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet152', Bottleneck, [3, 8, 36, 3], pretrained, progress, **kwargs)
ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnet152
minhtannguyen/RAdam
0
python
def horesnet152(pretrained=False, progress=True, **kwargs): 'ResNet-152 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet152', Bottleneck, [3, 8, 36, 3], pretrained, progress, **kwargs)
def horesnet152(pretrained=False, progress=True, **kwargs): 'ResNet-152 model from\n `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' return _horesnet('horesnet152', Bottleneck, [3, 8, 36, 3], pretrained, progress, **kwargs)<|docstring|>ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
4ccad11c6f0202b5fd3aa5c3b51cc5d2cfe575553769c0538346564294b73722
def horesnext50_32x4d(pretrained=False, progress=True, **kwargs): 'ResNeXt-50 32x4d model from\n `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['groups'] = 32 kwargs['width_per_group'] = 4 return _horesnet('horesnext50_32x4d', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)
ResNeXt-50 32x4d model from `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnext50_32x4d
minhtannguyen/RAdam
0
python
def horesnext50_32x4d(pretrained=False, progress=True, **kwargs): 'ResNeXt-50 32x4d model from\n `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['groups'] = 32 kwargs['width_per_group'] = 4 return _horesnet('horesnext50_32x4d', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)
def horesnext50_32x4d(pretrained=False, progress=True, **kwargs): 'ResNeXt-50 32x4d model from\n `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['groups'] = 32 kwargs['width_per_group'] = 4 return _horesnet('horesnext50_32x4d', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)<|docstring|>ResNeXt-50 32x4d model from `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
e51abf6290772a99fc1e341737ff2130651e016217c43bd66fd5a676a45ab7a4
def horesnext101_32x8d(pretrained=False, progress=True, **kwargs): 'ResNeXt-101 32x8d model from\n `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['groups'] = 32 kwargs['width_per_group'] = 8 return _horesnet('horesnext101_32x8d', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)
ResNeXt-101 32x8d model from `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
horesnext101_32x8d
minhtannguyen/RAdam
0
python
def horesnext101_32x8d(pretrained=False, progress=True, **kwargs): 'ResNeXt-101 32x8d model from\n `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['groups'] = 32 kwargs['width_per_group'] = 8 return _horesnet('horesnext101_32x8d', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)
def horesnext101_32x8d(pretrained=False, progress=True, **kwargs): 'ResNeXt-101 32x8d model from\n `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['groups'] = 32 kwargs['width_per_group'] = 8 return _horesnet('horesnext101_32x8d', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)<|docstring|>ResNeXt-101 32x8d model from `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
9b7fca18291a72e1966033572a28a509223a003f4fed9ba98babb7b6aee3c86e
def howide_resnet50_2(pretrained=False, progress=True, **kwargs): 'Wide ResNet-50-2 model from\n `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_\n The model is the same as ResNet except for the bottleneck number of channels\n which is twice larger in every block. The number of channels in outer 1x1\n convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048\n channels, and in Wide ResNet-50-2 has 2048-1024-2048.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['width_per_group'] = (64 * 2) return _horesnet('howide_resnet50_2', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)
Wide ResNet-50-2 model from `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
howide_resnet50_2
minhtannguyen/RAdam
0
python
def howide_resnet50_2(pretrained=False, progress=True, **kwargs): 'Wide ResNet-50-2 model from\n `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_\n The model is the same as ResNet except for the bottleneck number of channels\n which is twice larger in every block. The number of channels in outer 1x1\n convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048\n channels, and in Wide ResNet-50-2 has 2048-1024-2048.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['width_per_group'] = (64 * 2) return _horesnet('howide_resnet50_2', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)
def howide_resnet50_2(pretrained=False, progress=True, **kwargs): 'Wide ResNet-50-2 model from\n `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_\n The model is the same as ResNet except for the bottleneck number of channels\n which is twice larger in every block. The number of channels in outer 1x1\n convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048\n channels, and in Wide ResNet-50-2 has 2048-1024-2048.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['width_per_group'] = (64 * 2) return _horesnet('howide_resnet50_2', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs)<|docstring|>Wide ResNet-50-2 model from `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
a354af382f4d7dd3321d8ef0cf283c0a86116b9837d8ef81f9c403917389ec4d
def howide_resnet101_2(pretrained=False, progress=True, **kwargs): 'Wide ResNet-101-2 model from\n `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_\n The model is the same as ResNet except for the bottleneck number of channels\n which is twice larger in every block. The number of channels in outer 1x1\n convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048\n channels, and in Wide ResNet-50-2 has 2048-1024-2048.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['width_per_group'] = (64 * 2) return _horesnet('howide_resnet101_2', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)
Wide ResNet-101-2 model from `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
cifar_imagenet/models_backup/imagenet_v4_1/horesnet.py
howide_resnet101_2
minhtannguyen/RAdam
0
python
def howide_resnet101_2(pretrained=False, progress=True, **kwargs): 'Wide ResNet-101-2 model from\n `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_\n The model is the same as ResNet except for the bottleneck number of channels\n which is twice larger in every block. The number of channels in outer 1x1\n convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048\n channels, and in Wide ResNet-50-2 has 2048-1024-2048.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['width_per_group'] = (64 * 2) return _horesnet('howide_resnet101_2', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)
def howide_resnet101_2(pretrained=False, progress=True, **kwargs): 'Wide ResNet-101-2 model from\n `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_\n The model is the same as ResNet except for the bottleneck number of channels\n which is twice larger in every block. The number of channels in outer 1x1\n convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048\n channels, and in Wide ResNet-50-2 has 2048-1024-2048.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n progress (bool): If True, displays a progress bar of the download to stderr\n ' kwargs['width_per_group'] = (64 * 2) return _horesnet('howide_resnet101_2', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs)<|docstring|>Wide ResNet-101-2 model from `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr<|endoftext|>
67798ab9748c2afc5f5298c4ee684a16eb1239bb597019a8dff498b16c1b7991
def validateParams(sOn, sOff, herd, nAgents, echo=False): '\n Function checks whether parameter set is valid. This is done by checking\n the maximum probability, defiend as max(s) + h*N. If maximum probability\n is equal to or greater than 1, then Error is raised. If maximum probability\n is equal to or greater than 0.5, then Warning is raised.\n \n Parameters\n ----------\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n nAgents : int or float\n number of agents within the model\n \n Returns\n -------\n int\n 1 - everything is fine,\n 0 - warning\n -1 - error\n ' maxSigma = np.max(np.array([sOn, sOff])) maxProb = switchProb(maxSigma, herd, nAgents, nAgents) if (maxProb >= 1): if echo: print(sOn, sOff, herd, nAgents, sep=',') print('ERROR! Maximum probability larger than 1: {:.2f}'.format(maxProb)) return (- 1) if (maxProb >= 0.5): if echo: print(sOn, sOff, herd, nAgents, sep=',') print('WARNING! Maximum probability larger than 0.5: {:.2f}'.format(maxProb)) return 0 if echo: minSigma = np.min(np.array([sOn, sOff])) minProb = switchProb(minSigma, herd, 0, nAgents) print(sOn, sOff, herd, nAgents, sep=',') print('GOOD! Probability is within [{:.2f}; {:.2f}]'.format(minProb, maxProb)) return 1
Function checks whether parameter set is valid. This is done by checking the maximum probability, defiend as max(s) + h*N. If maximum probability is equal to or greater than 1, then Error is raised. If maximum probability is equal to or greater than 0.5, then Warning is raised. Parameters ---------- sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents nAgents : int or float number of agents within the model Returns ------- int 1 - everything is fine, 0 - warning -1 - error
modelNumba.py
validateParams
akononovicius/noisy-voter-model-for-parliamentary-presence
0
python
def validateParams(sOn, sOff, herd, nAgents, echo=False): '\n Function checks whether parameter set is valid. This is done by checking\n the maximum probability, defiend as max(s) + h*N. If maximum probability\n is equal to or greater than 1, then Error is raised. If maximum probability\n is equal to or greater than 0.5, then Warning is raised.\n \n Parameters\n ----------\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n nAgents : int or float\n number of agents within the model\n \n Returns\n -------\n int\n 1 - everything is fine,\n 0 - warning\n -1 - error\n ' maxSigma = np.max(np.array([sOn, sOff])) maxProb = switchProb(maxSigma, herd, nAgents, nAgents) if (maxProb >= 1): if echo: print(sOn, sOff, herd, nAgents, sep=',') print('ERROR! Maximum probability larger than 1: {:.2f}'.format(maxProb)) return (- 1) if (maxProb >= 0.5): if echo: print(sOn, sOff, herd, nAgents, sep=',') print('WARNING! Maximum probability larger than 0.5: {:.2f}'.format(maxProb)) return 0 if echo: minSigma = np.min(np.array([sOn, sOff])) minProb = switchProb(minSigma, herd, 0, nAgents) print(sOn, sOff, herd, nAgents, sep=',') print('GOOD! Probability is within [{:.2f}; {:.2f}]'.format(minProb, maxProb)) return 1
def validateParams(sOn, sOff, herd, nAgents, echo=False): '\n Function checks whether parameter set is valid. This is done by checking\n the maximum probability, defiend as max(s) + h*N. If maximum probability\n is equal to or greater than 1, then Error is raised. If maximum probability\n is equal to or greater than 0.5, then Warning is raised.\n \n Parameters\n ----------\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n nAgents : int or float\n number of agents within the model\n \n Returns\n -------\n int\n 1 - everything is fine,\n 0 - warning\n -1 - error\n ' maxSigma = np.max(np.array([sOn, sOff])) maxProb = switchProb(maxSigma, herd, nAgents, nAgents) if (maxProb >= 1): if echo: print(sOn, sOff, herd, nAgents, sep=',') print('ERROR! Maximum probability larger than 1: {:.2f}'.format(maxProb)) return (- 1) if (maxProb >= 0.5): if echo: print(sOn, sOff, herd, nAgents, sep=',') print('WARNING! Maximum probability larger than 0.5: {:.2f}'.format(maxProb)) return 0 if echo: minSigma = np.min(np.array([sOn, sOff])) minProb = switchProb(minSigma, herd, 0, nAgents) print(sOn, sOff, herd, nAgents, sep=',') print('GOOD! Probability is within [{:.2f}; {:.2f}]'.format(minProb, maxProb)) return 1<|docstring|>Function checks whether parameter set is valid. This is done by checking the maximum probability, defiend as max(s) + h*N. If maximum probability is equal to or greater than 1, then Error is raised. If maximum probability is equal to or greater than 0.5, then Warning is raised. Parameters ---------- sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents nAgents : int or float number of agents within the model Returns ------- int 1 - everything is fine, 0 - warning -1 - error<|endoftext|>
e55807c2448eac346fa4411c8a7aed37fbf167f94aeecc47833c88354c0ca288
@jit(nopython=True) def step(sOn, sOff, herd, state): '\n Function performs a single step according to herding model rules. Namely\n switching probability to state ``i`` is assumed to be given by:\n prob[i] = sigma[i] + h*N[i] ,\n wher N[i] is the number of agents in ``i`` state.\n \n Parameters\n ----------\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n \n Returns\n -------\n array_like\n updated state array\n ' _istate = state.copy() nTotal = len(_istate) nOn = np.sum((_istate == 1)) prob = np.zeros(nTotal) prob[(_istate == 1)] = switchProb(sOff, herd, (nTotal - nOn), nTotal) prob[(_istate == (- 1))] = switchProb(sOn, herd, nOn, nTotal) r = np.random.rand(nTotal) _istate[(r < prob)] = (- _istate[(r < prob)]) return _istate
Function performs a single step according to herding model rules. Namely switching probability to state ``i`` is assumed to be given by: prob[i] = sigma[i] + h*N[i] , wher N[i] is the number of agents in ``i`` state. Parameters ---------- sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents state : array_like array containing states of all agents ("on" state is assumed to be encoded by 1, while "off" state is assumed to be encoded by -1) Returns ------- array_like updated state array
modelNumba.py
step
akononovicius/noisy-voter-model-for-parliamentary-presence
0
python
@jit(nopython=True) def step(sOn, sOff, herd, state): '\n Function performs a single step according to herding model rules. Namely\n switching probability to state ``i`` is assumed to be given by:\n prob[i] = sigma[i] + h*N[i] ,\n wher N[i] is the number of agents in ``i`` state.\n \n Parameters\n ----------\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n \n Returns\n -------\n array_like\n updated state array\n ' _istate = state.copy() nTotal = len(_istate) nOn = np.sum((_istate == 1)) prob = np.zeros(nTotal) prob[(_istate == 1)] = switchProb(sOff, herd, (nTotal - nOn), nTotal) prob[(_istate == (- 1))] = switchProb(sOn, herd, nOn, nTotal) r = np.random.rand(nTotal) _istate[(r < prob)] = (- _istate[(r < prob)]) return _istate
@jit(nopython=True) def step(sOn, sOff, herd, state): '\n Function performs a single step according to herding model rules. Namely\n switching probability to state ``i`` is assumed to be given by:\n prob[i] = sigma[i] + h*N[i] ,\n wher N[i] is the number of agents in ``i`` state.\n \n Parameters\n ----------\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n \n Returns\n -------\n array_like\n updated state array\n ' _istate = state.copy() nTotal = len(_istate) nOn = np.sum((_istate == 1)) prob = np.zeros(nTotal) prob[(_istate == 1)] = switchProb(sOff, herd, (nTotal - nOn), nTotal) prob[(_istate == (- 1))] = switchProb(sOn, herd, nOn, nTotal) r = np.random.rand(nTotal) _istate[(r < prob)] = (- _istate[(r < prob)]) return _istate<|docstring|>Function performs a single step according to herding model rules. Namely switching probability to state ``i`` is assumed to be given by: prob[i] = sigma[i] + h*N[i] , wher N[i] is the number of agents in ``i`` state. Parameters ---------- sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents state : array_like array containing states of all agents ("on" state is assumed to be encoded by 1, while "off" state is assumed to be encoded by -1) Returns ------- array_like updated state array<|endoftext|>
8f0776e8ad9ee7eb6bb0ff13da0a0497791d70964a0777e73980176f6c398e69
@jit(nopython=True) def rawSeries(nPoints, sOn, sOff, herd, state, warmup=0): '\n Function performs multiple steps according to herding model rules (see\n the documentation of step function).\n \n Parameters\n ----------\n nPoints : int\n number of points to perform\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n warmup : int, optional\n number of warmup steps to perform (so that the model could have a\n chance to "forget" the initial state). Zero by default.\n \n Returns\n -------\n array_like\n array of state observations\n \n See also\n --------\n step\n ' _istate = state.copy() output = np.zeros((nPoints, len(state))) if (warmup > 0): for i in np.arange(0, warmup): _istate = step(sOn, sOff, herd, _istate) for i in np.arange(0, nPoints): _istate = step(sOn, sOff, herd, _istate) output[i] = _istate.copy() return output
Function performs multiple steps according to herding model rules (see the documentation of step function). Parameters ---------- nPoints : int number of points to perform sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents state : array_like array containing states of all agents ("on" state is assumed to be encoded by 1, while "off" state is assumed to be encoded by -1) warmup : int, optional number of warmup steps to perform (so that the model could have a chance to "forget" the initial state). Zero by default. Returns ------- array_like array of state observations See also -------- step
modelNumba.py
rawSeries
akononovicius/noisy-voter-model-for-parliamentary-presence
0
python
@jit(nopython=True) def rawSeries(nPoints, sOn, sOff, herd, state, warmup=0): '\n Function performs multiple steps according to herding model rules (see\n the documentation of step function).\n \n Parameters\n ----------\n nPoints : int\n number of points to perform\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n warmup : int, optional\n number of warmup steps to perform (so that the model could have a\n chance to "forget" the initial state). Zero by default.\n \n Returns\n -------\n array_like\n array of state observations\n \n See also\n --------\n step\n ' _istate = state.copy() output = np.zeros((nPoints, len(state))) if (warmup > 0): for i in np.arange(0, warmup): _istate = step(sOn, sOff, herd, _istate) for i in np.arange(0, nPoints): _istate = step(sOn, sOff, herd, _istate) output[i] = _istate.copy() return output
@jit(nopython=True) def rawSeries(nPoints, sOn, sOff, herd, state, warmup=0): '\n Function performs multiple steps according to herding model rules (see\n the documentation of step function).\n \n Parameters\n ----------\n nPoints : int\n number of points to perform\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n warmup : int, optional\n number of warmup steps to perform (so that the model could have a\n chance to "forget" the initial state). Zero by default.\n \n Returns\n -------\n array_like\n array of state observations\n \n See also\n --------\n step\n ' _istate = state.copy() output = np.zeros((nPoints, len(state))) if (warmup > 0): for i in np.arange(0, warmup): _istate = step(sOn, sOff, herd, _istate) for i in np.arange(0, nPoints): _istate = step(sOn, sOff, herd, _istate) output[i] = _istate.copy() return output<|docstring|>Function performs multiple steps according to herding model rules (see the documentation of step function). Parameters ---------- nPoints : int number of points to perform sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents state : array_like array containing states of all agents ("on" state is assumed to be encoded by 1, while "off" state is assumed to be encoded by -1) warmup : int, optional number of warmup steps to perform (so that the model could have a chance to "forget" the initial state). Zero by default. Returns ------- array_like array of state observations See also -------- step<|endoftext|>
b553de037e8ed9687b08779d6d0885828d70a8afa9bc30b6b7eaa68542791f31
def noisySeries(nPoints, pOn, pOff, sOn, sOff, herd, state, warmup=0): '\n Function performs multiple steps according to herding model rules (see\n the documentation of step function) and adds external noise. Namely, "on"\n and "off" states now would mean that the states are noisy. Agent in "on"\n state is on with probability given by pOn and agent in "off" state is on\n with probability given by pOff.\n \n Parameters\n ----------\n nPoints : int\n number of points to perform\n pOn : float\n probability that agent in the "on" state will be "on"\n pOff : float\n probability that agent in the "off" state will be "on"\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n warmup : int, optional\n number of warmup steps to perform (so that the model could have a\n chance to "forget" the initial state). Zero by default.\n \n Returns\n -------\n array_like\n array of state observations (if parameters are valid) or array of None\n (if parameters are not valid)\n \n See also\n --------\n step, rawSeries\n ' series = rawSeries(nPoints, sOn, sOff, herd, state, warmup=warmup) nseries = np.zeros(series.shape) nseries[(series < 0)] = (np.random.rand(np.sum((series < 0))) < pOff) nseries[(series > 0)] = (np.random.rand(np.sum((series > 0))) < pOn) return nseries
Function performs multiple steps according to herding model rules (see the documentation of step function) and adds external noise. Namely, "on" and "off" states now would mean that the states are noisy. Agent in "on" state is on with probability given by pOn and agent in "off" state is on with probability given by pOff. Parameters ---------- nPoints : int number of points to perform pOn : float probability that agent in the "on" state will be "on" pOff : float probability that agent in the "off" state will be "on" sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents state : array_like array containing states of all agents ("on" state is assumed to be encoded by 1, while "off" state is assumed to be encoded by -1) warmup : int, optional number of warmup steps to perform (so that the model could have a chance to "forget" the initial state). Zero by default. Returns ------- array_like array of state observations (if parameters are valid) or array of None (if parameters are not valid) See also -------- step, rawSeries
modelNumba.py
noisySeries
akononovicius/noisy-voter-model-for-parliamentary-presence
0
python
def noisySeries(nPoints, pOn, pOff, sOn, sOff, herd, state, warmup=0): '\n Function performs multiple steps according to herding model rules (see\n the documentation of step function) and adds external noise. Namely, "on"\n and "off" states now would mean that the states are noisy. Agent in "on"\n state is on with probability given by pOn and agent in "off" state is on\n with probability given by pOff.\n \n Parameters\n ----------\n nPoints : int\n number of points to perform\n pOn : float\n probability that agent in the "on" state will be "on"\n pOff : float\n probability that agent in the "off" state will be "on"\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n warmup : int, optional\n number of warmup steps to perform (so that the model could have a\n chance to "forget" the initial state). Zero by default.\n \n Returns\n -------\n array_like\n array of state observations (if parameters are valid) or array of None\n (if parameters are not valid)\n \n See also\n --------\n step, rawSeries\n ' series = rawSeries(nPoints, sOn, sOff, herd, state, warmup=warmup) nseries = np.zeros(series.shape) nseries[(series < 0)] = (np.random.rand(np.sum((series < 0))) < pOff) nseries[(series > 0)] = (np.random.rand(np.sum((series > 0))) < pOn) return nseries
def noisySeries(nPoints, pOn, pOff, sOn, sOff, herd, state, warmup=0): '\n Function performs multiple steps according to herding model rules (see\n the documentation of step function) and adds external noise. Namely, "on"\n and "off" states now would mean that the states are noisy. Agent in "on"\n state is on with probability given by pOn and agent in "off" state is on\n with probability given by pOff.\n \n Parameters\n ----------\n nPoints : int\n number of points to perform\n pOn : float\n probability that agent in the "on" state will be "on"\n pOff : float\n probability that agent in the "off" state will be "on"\n sOn : float\n sigma parameter for agents switching from "off" state to "on" state\n sOff : float\n sigma parameter for agents switching from "on" state to "off" state\n herd : float\n h parameter for interaction between agents\n state : array_like\n array containing states of all agents ("on" state is assumed to be\n encoded by 1, while "off" state is assumed to be encoded by -1)\n warmup : int, optional\n number of warmup steps to perform (so that the model could have a\n chance to "forget" the initial state). Zero by default.\n \n Returns\n -------\n array_like\n array of state observations (if parameters are valid) or array of None\n (if parameters are not valid)\n \n See also\n --------\n step, rawSeries\n ' series = rawSeries(nPoints, sOn, sOff, herd, state, warmup=warmup) nseries = np.zeros(series.shape) nseries[(series < 0)] = (np.random.rand(np.sum((series < 0))) < pOff) nseries[(series > 0)] = (np.random.rand(np.sum((series > 0))) < pOn) return nseries<|docstring|>Function performs multiple steps according to herding model rules (see the documentation of step function) and adds external noise. Namely, "on" and "off" states now would mean that the states are noisy. Agent in "on" state is on with probability given by pOn and agent in "off" state is on with probability given by pOff. Parameters ---------- nPoints : int number of points to perform pOn : float probability that agent in the "on" state will be "on" pOff : float probability that agent in the "off" state will be "on" sOn : float sigma parameter for agents switching from "off" state to "on" state sOff : float sigma parameter for agents switching from "on" state to "off" state herd : float h parameter for interaction between agents state : array_like array containing states of all agents ("on" state is assumed to be encoded by 1, while "off" state is assumed to be encoded by -1) warmup : int, optional number of warmup steps to perform (so that the model could have a chance to "forget" the initial state). Zero by default. Returns ------- array_like array of state observations (if parameters are valid) or array of None (if parameters are not valid) See also -------- step, rawSeries<|endoftext|>
abe0512f4ee28e3c3fd12d1c52b8c48a85a031399b854d09776cb48b26c144c7
def iter_variables(self): '\n Iterates over all variables in the expression.\n\n Returns:\n iterator: An iterator over all variables present in the operand.\n ' for (v, k) in self.iter_terms(): (yield v)
Iterates over all variables in the expression. Returns: iterator: An iterator over all variables present in the operand.
.environment/lib/python3.8/site-packages/docplex/mp/operand.py
iter_variables
LuisMi1245/QPath-and-Snakes
0
python
def iter_variables(self): '\n Iterates over all variables in the expression.\n\n Returns:\n iterator: An iterator over all variables present in the operand.\n ' for (v, k) in self.iter_terms(): (yield v)
def iter_variables(self): '\n Iterates over all variables in the expression.\n\n Returns:\n iterator: An iterator over all variables present in the operand.\n ' for (v, k) in self.iter_terms(): (yield v)<|docstring|>Iterates over all variables in the expression. Returns: iterator: An iterator over all variables present in the operand.<|endoftext|>
451322e9607a11b9c59e2e46ee87cf9cd4ba671e9fdb474454c69389e83a964b
def get_linear_part(self): ' Returns the linear part of the expression: for a linear expression,\n returns the expression itself.\n\n Defined for compatibility with quadratic expressions.\n\n :return: a linear expression\n ' return self
Returns the linear part of the expression: for a linear expression, returns the expression itself. Defined for compatibility with quadratic expressions. :return: a linear expression
.environment/lib/python3.8/site-packages/docplex/mp/operand.py
get_linear_part
LuisMi1245/QPath-and-Snakes
0
python
def get_linear_part(self): ' Returns the linear part of the expression: for a linear expression,\n returns the expression itself.\n\n Defined for compatibility with quadratic expressions.\n\n :return: a linear expression\n ' return self
def get_linear_part(self): ' Returns the linear part of the expression: for a linear expression,\n returns the expression itself.\n\n Defined for compatibility with quadratic expressions.\n\n :return: a linear expression\n ' return self<|docstring|>Returns the linear part of the expression: for a linear expression, returns the expression itself. Defined for compatibility with quadratic expressions. :return: a linear expression<|endoftext|>
b5863ac5ca1e8de547491276f7172c05d78c48ca3aed81e533650e9a9f7b50b1
@property def linear_part(self): ' Returns the linear part of the expression: for a linear expression,\n returns the expression itself.\n\n Defined for compatibility with quadratic expressions.\n\n :return: a linear expression (returns itself for any linear operand).\n ' return self
Returns the linear part of the expression: for a linear expression, returns the expression itself. Defined for compatibility with quadratic expressions. :return: a linear expression (returns itself for any linear operand).
.environment/lib/python3.8/site-packages/docplex/mp/operand.py
linear_part
LuisMi1245/QPath-and-Snakes
0
python
@property def linear_part(self): ' Returns the linear part of the expression: for a linear expression,\n returns the expression itself.\n\n Defined for compatibility with quadratic expressions.\n\n :return: a linear expression (returns itself for any linear operand).\n ' return self
@property def linear_part(self): ' Returns the linear part of the expression: for a linear expression,\n returns the expression itself.\n\n Defined for compatibility with quadratic expressions.\n\n :return: a linear expression (returns itself for any linear operand).\n ' return self<|docstring|>Returns the linear part of the expression: for a linear expression, returns the expression itself. Defined for compatibility with quadratic expressions. :return: a linear expression (returns itself for any linear operand).<|endoftext|>
e81092b49f8ac87c9bd3a8872bc0a4693903027e248c0dda28af0d804ad012fc
def __contains__(self, dvar): 'Overloads operator `in` for an expression and a variable.\n\n :param: dvar (:class:`docplex.mp.dvar.Var`): A decision variable.\n\n Returns:\n Boolean: True if the variable is present in the expression, else False.\n ' return self.contains_var(dvar)
Overloads operator `in` for an expression and a variable. :param: dvar (:class:`docplex.mp.dvar.Var`): A decision variable. Returns: Boolean: True if the variable is present in the expression, else False.
.environment/lib/python3.8/site-packages/docplex/mp/operand.py
__contains__
LuisMi1245/QPath-and-Snakes
0
python
def __contains__(self, dvar): 'Overloads operator `in` for an expression and a variable.\n\n :param: dvar (:class:`docplex.mp.dvar.Var`): A decision variable.\n\n Returns:\n Boolean: True if the variable is present in the expression, else False.\n ' return self.contains_var(dvar)
def __contains__(self, dvar): 'Overloads operator `in` for an expression and a variable.\n\n :param: dvar (:class:`docplex.mp.dvar.Var`): A decision variable.\n\n Returns:\n Boolean: True if the variable is present in the expression, else False.\n ' return self.contains_var(dvar)<|docstring|>Overloads operator `in` for an expression and a variable. :param: dvar (:class:`docplex.mp.dvar.Var`): A decision variable. Returns: Boolean: True if the variable is present in the expression, else False.<|endoftext|>
eb6454c467f73c625dac9f5f91b73c0a0194b3539a21ef63568539dcdd9a8242
def solve(grid): '\n\n . . .\n .1.1.\n . .3.\n\n ' s = z3.Solver() Dot = z3.Datatype('Dot') for d in grid.dots(): Dot.declare('dot_{}'.format(d)) Dot = Dot.create() dot_atom = {d: getattr(Dot, 'dot_{}'.format(d)) for d in grid.dots()} dot = {d: z3.Bool('dot-{}'.format(d)) for d in grid.dots()} line = {l: z3.Bool('line-{}'.format(l)) for l in grid.lines()} bool_to_int = z3.Function('bool_to_int', z3.BoolSort(), z3.IntSort()) s.add((bool_to_int(True) == 1)) s.add((bool_to_int(True) != 0)) s.add((bool_to_int(False) == 0)) s.add((bool_to_int(False) != 1)) for d in grid.dots(): ls = [line[l] for l in d.lines()] sm = z3.Sum(*(bool_to_int(l) for l in ls)) s.add(z3.Implies(dot[d], (sm == 2))) s.add(z3.Implies(z3.Not(dot[d]), (sm == 0))) for l in line: (d1, d2) = l.ends() s.add(z3.Implies(line[l], z3.And(dot[d1], dot[d2]))) connected = z3.Function('connected', Dot, Dot, z3.BoolSort()) for d1 in grid.dots(): for d2 in grid.dots(): a = dot_atom[d1] b = dot_atom[d2] if ((l := grid.line(d1, d2)) is None): s.add((connected(a, b) != True)) else: s.add(z3.Implies(line[l], connected(a, b))) s.add(z3.Implies(z3.Not(line[l]), z3.Not(connected(a, b)))) path_connected = z3.TransitiveClosure(connected) xy3 = [xy for (xy, c) in grid.cells() if (c == '3')][0] dot3 = grid.cell_dots(*xy3)[0] atom3 = dot_atom[dot3] for d in grid.dots(): s.add(z3.Implies(dot[d], path_connected(dot_atom[d], atom3))) s.add(z3.Implies(z3.Not(dot[d]), z3.Not(path_connected(dot_atom[d], atom3)))) def line_count_of_cell(xy): 'xy is the dot at the top-left\n Return an invocation of line_count for the lines around it.\n ' return z3.Sum(*(bool_to_int(line[l]) for l in grid.cell_lines(*xy))) for (xy, c) in grid.cells(): if (c != ' '): print('adding constraint for ', xy, c, [str(l) for l in grid.cell_lines(*xy)]) s.add((line_count_of_cell(xy) == int(c))) print('check: ', s.check()) m = s.model() print() grid.print(dot_on=(lambda d: m.eval(dot[d])), line_on=(lambda l: m.eval(line[l])))
. . . .1.1. . .3.
slither/solve.py
solve
jan-g/slitherlink
1
python
def solve(grid): '\n\n . . .\n .1.1.\n . .3.\n\n ' s = z3.Solver() Dot = z3.Datatype('Dot') for d in grid.dots(): Dot.declare('dot_{}'.format(d)) Dot = Dot.create() dot_atom = {d: getattr(Dot, 'dot_{}'.format(d)) for d in grid.dots()} dot = {d: z3.Bool('dot-{}'.format(d)) for d in grid.dots()} line = {l: z3.Bool('line-{}'.format(l)) for l in grid.lines()} bool_to_int = z3.Function('bool_to_int', z3.BoolSort(), z3.IntSort()) s.add((bool_to_int(True) == 1)) s.add((bool_to_int(True) != 0)) s.add((bool_to_int(False) == 0)) s.add((bool_to_int(False) != 1)) for d in grid.dots(): ls = [line[l] for l in d.lines()] sm = z3.Sum(*(bool_to_int(l) for l in ls)) s.add(z3.Implies(dot[d], (sm == 2))) s.add(z3.Implies(z3.Not(dot[d]), (sm == 0))) for l in line: (d1, d2) = l.ends() s.add(z3.Implies(line[l], z3.And(dot[d1], dot[d2]))) connected = z3.Function('connected', Dot, Dot, z3.BoolSort()) for d1 in grid.dots(): for d2 in grid.dots(): a = dot_atom[d1] b = dot_atom[d2] if ((l := grid.line(d1, d2)) is None): s.add((connected(a, b) != True)) else: s.add(z3.Implies(line[l], connected(a, b))) s.add(z3.Implies(z3.Not(line[l]), z3.Not(connected(a, b)))) path_connected = z3.TransitiveClosure(connected) xy3 = [xy for (xy, c) in grid.cells() if (c == '3')][0] dot3 = grid.cell_dots(*xy3)[0] atom3 = dot_atom[dot3] for d in grid.dots(): s.add(z3.Implies(dot[d], path_connected(dot_atom[d], atom3))) s.add(z3.Implies(z3.Not(dot[d]), z3.Not(path_connected(dot_atom[d], atom3)))) def line_count_of_cell(xy): 'xy is the dot at the top-left\n Return an invocation of line_count for the lines around it.\n ' return z3.Sum(*(bool_to_int(line[l]) for l in grid.cell_lines(*xy))) for (xy, c) in grid.cells(): if (c != ' '): print('adding constraint for ', xy, c, [str(l) for l in grid.cell_lines(*xy)]) s.add((line_count_of_cell(xy) == int(c))) print('check: ', s.check()) m = s.model() print() grid.print(dot_on=(lambda d: m.eval(dot[d])), line_on=(lambda l: m.eval(line[l])))
def solve(grid): '\n\n . . .\n .1.1.\n . .3.\n\n ' s = z3.Solver() Dot = z3.Datatype('Dot') for d in grid.dots(): Dot.declare('dot_{}'.format(d)) Dot = Dot.create() dot_atom = {d: getattr(Dot, 'dot_{}'.format(d)) for d in grid.dots()} dot = {d: z3.Bool('dot-{}'.format(d)) for d in grid.dots()} line = {l: z3.Bool('line-{}'.format(l)) for l in grid.lines()} bool_to_int = z3.Function('bool_to_int', z3.BoolSort(), z3.IntSort()) s.add((bool_to_int(True) == 1)) s.add((bool_to_int(True) != 0)) s.add((bool_to_int(False) == 0)) s.add((bool_to_int(False) != 1)) for d in grid.dots(): ls = [line[l] for l in d.lines()] sm = z3.Sum(*(bool_to_int(l) for l in ls)) s.add(z3.Implies(dot[d], (sm == 2))) s.add(z3.Implies(z3.Not(dot[d]), (sm == 0))) for l in line: (d1, d2) = l.ends() s.add(z3.Implies(line[l], z3.And(dot[d1], dot[d2]))) connected = z3.Function('connected', Dot, Dot, z3.BoolSort()) for d1 in grid.dots(): for d2 in grid.dots(): a = dot_atom[d1] b = dot_atom[d2] if ((l := grid.line(d1, d2)) is None): s.add((connected(a, b) != True)) else: s.add(z3.Implies(line[l], connected(a, b))) s.add(z3.Implies(z3.Not(line[l]), z3.Not(connected(a, b)))) path_connected = z3.TransitiveClosure(connected) xy3 = [xy for (xy, c) in grid.cells() if (c == '3')][0] dot3 = grid.cell_dots(*xy3)[0] atom3 = dot_atom[dot3] for d in grid.dots(): s.add(z3.Implies(dot[d], path_connected(dot_atom[d], atom3))) s.add(z3.Implies(z3.Not(dot[d]), z3.Not(path_connected(dot_atom[d], atom3)))) def line_count_of_cell(xy): 'xy is the dot at the top-left\n Return an invocation of line_count for the lines around it.\n ' return z3.Sum(*(bool_to_int(line[l]) for l in grid.cell_lines(*xy))) for (xy, c) in grid.cells(): if (c != ' '): print('adding constraint for ', xy, c, [str(l) for l in grid.cell_lines(*xy)]) s.add((line_count_of_cell(xy) == int(c))) print('check: ', s.check()) m = s.model() print() grid.print(dot_on=(lambda d: m.eval(dot[d])), line_on=(lambda l: m.eval(line[l])))<|docstring|>. . . .1.1. . .3.<|endoftext|>
6991267dbe28995dae21bb24c17599f3ecd727207ed221cf562511b51ed7c291
def line_count_of_cell(xy): 'xy is the dot at the top-left\n Return an invocation of line_count for the lines around it.\n ' return z3.Sum(*(bool_to_int(line[l]) for l in grid.cell_lines(*xy)))
xy is the dot at the top-left Return an invocation of line_count for the lines around it.
slither/solve.py
line_count_of_cell
jan-g/slitherlink
1
python
def line_count_of_cell(xy): 'xy is the dot at the top-left\n Return an invocation of line_count for the lines around it.\n ' return z3.Sum(*(bool_to_int(line[l]) for l in grid.cell_lines(*xy)))
def line_count_of_cell(xy): 'xy is the dot at the top-left\n Return an invocation of line_count for the lines around it.\n ' return z3.Sum(*(bool_to_int(line[l]) for l in grid.cell_lines(*xy)))<|docstring|>xy is the dot at the top-left Return an invocation of line_count for the lines around it.<|endoftext|>
c2095744fd8ec17a3f78fab821f3d84daf0cd8d343b9d8ae56c9bec1a2bf4baf
def create(self, validated_data): 'create and return a new user' user = models.UserProfile.objects.create_user(email=validated_data['email'], name=validated_data['name'], password=validated_data['password']) return user
create and return a new user
app/core/serializers.py
create
loop-assembly/backend-api
3
python
def create(self, validated_data): user = models.UserProfile.objects.create_user(email=validated_data['email'], name=validated_data['name'], password=validated_data['password']) return user
def create(self, validated_data): user = models.UserProfile.objects.create_user(email=validated_data['email'], name=validated_data['name'], password=validated_data['password']) return user<|docstring|>create and return a new user<|endoftext|>
a19d1cc68966ee7626bc94cc695faed4b6f313c19f15de78e99842f119441177
def _activeJobs(self): ' Return a list with all active Jobs (not DONE) ' return (self.todo + [n for n in self.inprogress.values()])
Return a list with all active Jobs (not DONE)
bots/curfew/abn/jobs.py
_activeJobs
alv67/Lux-AI-challenge
0
python
def _activeJobs(self): ' ' return (self.todo + [n for n in self.inprogress.values()])
def _activeJobs(self): ' ' return (self.todo + [n for n in self.inprogress.values()])<|docstring|>Return a list with all active Jobs (not DONE)<|endoftext|>
3c10ece68c5d3ffe27ffe7e298d53ac804d9bc7c231b3baee4587e30d3b922f1
def jobReject(self, unit_id: str): '\n The rejected job is returned from inProgress to ToDo list, \n mantains the unit_id so this job will not be assigned to the unit\n that rejected it.\n ' if (unit_id in self.inprogress): j = self.inprogress[unit_id] j.subtask = 0 if (j.task in [Task.EXPLORE, Task.BUILD]): self.todo.append(j) del self.inprogress[unit_id]
The rejected job is returned from inProgress to ToDo list, mantains the unit_id so this job will not be assigned to the unit that rejected it.
bots/curfew/abn/jobs.py
jobReject
alv67/Lux-AI-challenge
0
python
def jobReject(self, unit_id: str): '\n The rejected job is returned from inProgress to ToDo list, \n mantains the unit_id so this job will not be assigned to the unit\n that rejected it.\n ' if (unit_id in self.inprogress): j = self.inprogress[unit_id] j.subtask = 0 if (j.task in [Task.EXPLORE, Task.BUILD]): self.todo.append(j) del self.inprogress[unit_id]
def jobReject(self, unit_id: str): '\n The rejected job is returned from inProgress to ToDo list, \n mantains the unit_id so this job will not be assigned to the unit\n that rejected it.\n ' if (unit_id in self.inprogress): j = self.inprogress[unit_id] j.subtask = 0 if (j.task in [Task.EXPLORE, Task.BUILD]): self.todo.append(j) del self.inprogress[unit_id]<|docstring|>The rejected job is returned from inProgress to ToDo list, mantains the unit_id so this job will not be assigned to the unit that rejected it.<|endoftext|>
9bf89d80bda89dee554c263c94d55e8a4162de5ab0c6225c3ab66099b6d1a4c4
def count(self, task: str, pos: Position=None, city_id: str='') -> int: '\n Return total number of active (not DONE) tasks with given parameters\n ' retvalue = 0 for job in self._activeJobs(): if (job.task == task): if (pos and (pos != job.pos)): continue if (city_id and (city_id != job.city_id)): continue retvalue += 1 return retvalue
Return total number of active (not DONE) tasks with given parameters
bots/curfew/abn/jobs.py
count
alv67/Lux-AI-challenge
0
python
def count(self, task: str, pos: Position=None, city_id: str=) -> int: '\n \n ' retvalue = 0 for job in self._activeJobs(): if (job.task == task): if (pos and (pos != job.pos)): continue if (city_id and (city_id != job.city_id)): continue retvalue += 1 return retvalue
def count(self, task: str, pos: Position=None, city_id: str=) -> int: '\n \n ' retvalue = 0 for job in self._activeJobs(): if (job.task == task): if (pos and (pos != job.pos)): continue if (city_id and (city_id != job.city_id)): continue retvalue += 1 return retvalue<|docstring|>Return total number of active (not DONE) tasks with given parameters<|endoftext|>
5a580266c5508b6deabc760aaecc747947386e9eb9532c44b6546bbb0991fef3
def jobRequest(self, unit: Unit): " \n Unit can ask for a job, the function returns:\n - an 'inprogress' job for that unit_id if it's present\n - a new job from the 'todo' list\n " job = self.inprogress.get(unit.id) if job: return job job = self._nextJob(unit) if job: job.unit_id = unit.id job.subtask = 0 self.inprogress[unit.id] = job return job else: job = Job(Task.EXPLORE, unit.pos) job.unit_id = unit.id self.inprogress[unit.id] = job return job
Unit can ask for a job, the function returns: - an 'inprogress' job for that unit_id if it's present - a new job from the 'todo' list
bots/curfew/abn/jobs.py
jobRequest
alv67/Lux-AI-challenge
0
python
def jobRequest(self, unit: Unit): " \n Unit can ask for a job, the function returns:\n - an 'inprogress' job for that unit_id if it's present\n - a new job from the 'todo' list\n " job = self.inprogress.get(unit.id) if job: return job job = self._nextJob(unit) if job: job.unit_id = unit.id job.subtask = 0 self.inprogress[unit.id] = job return job else: job = Job(Task.EXPLORE, unit.pos) job.unit_id = unit.id self.inprogress[unit.id] = job return job
def jobRequest(self, unit: Unit): " \n Unit can ask for a job, the function returns:\n - an 'inprogress' job for that unit_id if it's present\n - a new job from the 'todo' list\n " job = self.inprogress.get(unit.id) if job: return job job = self._nextJob(unit) if job: job.unit_id = unit.id job.subtask = 0 self.inprogress[unit.id] = job return job else: job = Job(Task.EXPLORE, unit.pos) job.unit_id = unit.id self.inprogress[unit.id] = job return job<|docstring|>Unit can ask for a job, the function returns: - an 'inprogress' job for that unit_id if it's present - a new job from the 'todo' list<|endoftext|>
d0e946751d769245f51d9a6007b2b14b6e2c26a11b36f65eb460d67e75d2d95f
def checkActiveJobs(self, units: List): ' \n Using list of Units check if there are some InProgress Jobs assigned to \n Unit no more on the list (dead unit). If the case then:\n - return Job to ToDos\n - add dead unit.id to rip List\n ' morgue = [] for unit_id in self.inprogress: if (unit_id not in [u.id for u in units]): morgue.append(unit_id) for unit_id in morgue: self.jobReject(unit_id) self.rip.append(unit_id)
Using list of Units check if there are some InProgress Jobs assigned to Unit no more on the list (dead unit). If the case then: - return Job to ToDos - add dead unit.id to rip List
bots/curfew/abn/jobs.py
checkActiveJobs
alv67/Lux-AI-challenge
0
python
def checkActiveJobs(self, units: List): ' \n Using list of Units check if there are some InProgress Jobs assigned to \n Unit no more on the list (dead unit). If the case then:\n - return Job to ToDos\n - add dead unit.id to rip List\n ' morgue = [] for unit_id in self.inprogress: if (unit_id not in [u.id for u in units]): morgue.append(unit_id) for unit_id in morgue: self.jobReject(unit_id) self.rip.append(unit_id)
def checkActiveJobs(self, units: List): ' \n Using list of Units check if there are some InProgress Jobs assigned to \n Unit no more on the list (dead unit). If the case then:\n - return Job to ToDos\n - add dead unit.id to rip List\n ' morgue = [] for unit_id in self.inprogress: if (unit_id not in [u.id for u in units]): morgue.append(unit_id) for unit_id in morgue: self.jobReject(unit_id) self.rip.append(unit_id)<|docstring|>Using list of Units check if there are some InProgress Jobs assigned to Unit no more on the list (dead unit). If the case then: - return Job to ToDos - add dead unit.id to rip List<|endoftext|>
bb9128b93c187ef7ec0986e94e58c8fb70fa75bb58a310ec7a2519a3abe9e29e
def train(model, dataset_dir, subset): 'Train the model.' dataset_train = ChickenDataset() dataset_train.load_chickens(dataset_dir, subset) dataset_train.prepare() dataset_val = ChickenDataset() dataset_val.load_chickens(dataset_dir, 'val') dataset_val.prepare() augmentation = iaa.SomeOf((1, 3), [iaa.Fliplr(0.5), iaa.Flipud(0.5), iaa.OneOf([iaa.Affine(rotate=90), iaa.Affine(rotate=180), iaa.Affine(rotate=270)]), iaa.Multiply((0.8, 1.5)), iaa.GaussianBlur(sigma=(0.0, 5.0))]) print('Train network heads') model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=60, augmentation=augmentation, layers='heads') print('Train all layers') model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=120, augmentation=augmentation, layers='all')
Train the model.
AP.py
train
AlexHsuYu/ClumsyChickens
6
python
def train(model, dataset_dir, subset): dataset_train = ChickenDataset() dataset_train.load_chickens(dataset_dir, subset) dataset_train.prepare() dataset_val = ChickenDataset() dataset_val.load_chickens(dataset_dir, 'val') dataset_val.prepare() augmentation = iaa.SomeOf((1, 3), [iaa.Fliplr(0.5), iaa.Flipud(0.5), iaa.OneOf([iaa.Affine(rotate=90), iaa.Affine(rotate=180), iaa.Affine(rotate=270)]), iaa.Multiply((0.8, 1.5)), iaa.GaussianBlur(sigma=(0.0, 5.0))]) print('Train network heads') model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=60, augmentation=augmentation, layers='heads') print('Train all layers') model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=120, augmentation=augmentation, layers='all')
def train(model, dataset_dir, subset): dataset_train = ChickenDataset() dataset_train.load_chickens(dataset_dir, subset) dataset_train.prepare() dataset_val = ChickenDataset() dataset_val.load_chickens(dataset_dir, 'val') dataset_val.prepare() augmentation = iaa.SomeOf((1, 3), [iaa.Fliplr(0.5), iaa.Flipud(0.5), iaa.OneOf([iaa.Affine(rotate=90), iaa.Affine(rotate=180), iaa.Affine(rotate=270)]), iaa.Multiply((0.8, 1.5)), iaa.GaussianBlur(sigma=(0.0, 5.0))]) print('Train network heads') model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=60, augmentation=augmentation, layers='heads') print('Train all layers') model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=120, augmentation=augmentation, layers='all')<|docstring|>Train the model.<|endoftext|>
31495480f284420deacc67fe8ea1925e9da46e12b2db29a119427d3df3ebe045
def rle_encode(mask): 'Encodes a mask in Run Length Encoding (RLE).\n Returns a string of space-separated values.\n ' assert (mask.ndim == 2), 'Mask must be of shape [Height, Width]' m = mask.T.flatten() g = np.diff(np.concatenate([[0], m, [0]]), n=1) rle = (np.where((g != 0))[0].reshape([(- 1), 2]) + 1) rle[(:, 1)] = (rle[(:, 1)] - rle[(:, 0)]) return ' '.join(map(str, rle.flatten()))
Encodes a mask in Run Length Encoding (RLE). Returns a string of space-separated values.
AP.py
rle_encode
AlexHsuYu/ClumsyChickens
6
python
def rle_encode(mask): 'Encodes a mask in Run Length Encoding (RLE).\n Returns a string of space-separated values.\n ' assert (mask.ndim == 2), 'Mask must be of shape [Height, Width]' m = mask.T.flatten() g = np.diff(np.concatenate([[0], m, [0]]), n=1) rle = (np.where((g != 0))[0].reshape([(- 1), 2]) + 1) rle[(:, 1)] = (rle[(:, 1)] - rle[(:, 0)]) return ' '.join(map(str, rle.flatten()))
def rle_encode(mask): 'Encodes a mask in Run Length Encoding (RLE).\n Returns a string of space-separated values.\n ' assert (mask.ndim == 2), 'Mask must be of shape [Height, Width]' m = mask.T.flatten() g = np.diff(np.concatenate([[0], m, [0]]), n=1) rle = (np.where((g != 0))[0].reshape([(- 1), 2]) + 1) rle[(:, 1)] = (rle[(:, 1)] - rle[(:, 0)]) return ' '.join(map(str, rle.flatten()))<|docstring|>Encodes a mask in Run Length Encoding (RLE). Returns a string of space-separated values.<|endoftext|>
827dc1a8ba59bb67132631d8e92f7436fb4ad49c9c3cb5f618c2ef59a4ac8986
def rle_decode(rle, shape): 'Decodes an RLE encoded list of space separated\n numbers and returns a binary mask.' rle = list(map(int, rle.split())) rle = np.array(rle, dtype=np.int32).reshape([(- 1), 2]) rle[(:, 1)] += rle[(:, 0)] rle -= 1 mask = np.zeros([(shape[0] * shape[1])], np.bool) for (s, e) in rle: assert (0 <= s < mask.shape[0]) assert (1 <= e <= mask.shape[0]), 'shape: {} s {} e {}'.format(shape, s, e) mask[s:e] = 1 mask = mask.reshape([shape[1], shape[0]]).T return mask
Decodes an RLE encoded list of space separated numbers and returns a binary mask.
AP.py
rle_decode
AlexHsuYu/ClumsyChickens
6
python
def rle_decode(rle, shape): 'Decodes an RLE encoded list of space separated\n numbers and returns a binary mask.' rle = list(map(int, rle.split())) rle = np.array(rle, dtype=np.int32).reshape([(- 1), 2]) rle[(:, 1)] += rle[(:, 0)] rle -= 1 mask = np.zeros([(shape[0] * shape[1])], np.bool) for (s, e) in rle: assert (0 <= s < mask.shape[0]) assert (1 <= e <= mask.shape[0]), 'shape: {} s {} e {}'.format(shape, s, e) mask[s:e] = 1 mask = mask.reshape([shape[1], shape[0]]).T return mask
def rle_decode(rle, shape): 'Decodes an RLE encoded list of space separated\n numbers and returns a binary mask.' rle = list(map(int, rle.split())) rle = np.array(rle, dtype=np.int32).reshape([(- 1), 2]) rle[(:, 1)] += rle[(:, 0)] rle -= 1 mask = np.zeros([(shape[0] * shape[1])], np.bool) for (s, e) in rle: assert (0 <= s < mask.shape[0]) assert (1 <= e <= mask.shape[0]), 'shape: {} s {} e {}'.format(shape, s, e) mask[s:e] = 1 mask = mask.reshape([shape[1], shape[0]]).T return mask<|docstring|>Decodes an RLE encoded list of space separated numbers and returns a binary mask.<|endoftext|>
baa54fad288f9060022ae4f414b415bc65d087c484a7f5ea9e9c755405c123d6
def mask_to_rle(image_id, mask, scores): 'Encodes instance masks to submission format.' assert (mask.ndim == 3), 'Mask must be [H, W, count]' if (mask.shape[(- 1)] == 0): return '{},'.format(image_id) order = (np.argsort(scores)[::(- 1)] + 1) mask = np.max((mask * np.reshape(order, [1, 1, (- 1)])), (- 1)) lines = [] for o in order: m = np.where((mask == o), 1, 0) if (m.sum() == 0.0): continue rle = rle_encode(m) lines.append('{}, {}'.format(image_id, rle)) return '\n'.join(lines)
Encodes instance masks to submission format.
AP.py
mask_to_rle
AlexHsuYu/ClumsyChickens
6
python
def mask_to_rle(image_id, mask, scores): assert (mask.ndim == 3), 'Mask must be [H, W, count]' if (mask.shape[(- 1)] == 0): return '{},'.format(image_id) order = (np.argsort(scores)[::(- 1)] + 1) mask = np.max((mask * np.reshape(order, [1, 1, (- 1)])), (- 1)) lines = [] for o in order: m = np.where((mask == o), 1, 0) if (m.sum() == 0.0): continue rle = rle_encode(m) lines.append('{}, {}'.format(image_id, rle)) return '\n'.join(lines)
def mask_to_rle(image_id, mask, scores): assert (mask.ndim == 3), 'Mask must be [H, W, count]' if (mask.shape[(- 1)] == 0): return '{},'.format(image_id) order = (np.argsort(scores)[::(- 1)] + 1) mask = np.max((mask * np.reshape(order, [1, 1, (- 1)])), (- 1)) lines = [] for o in order: m = np.where((mask == o), 1, 0) if (m.sum() == 0.0): continue rle = rle_encode(m) lines.append('{}, {}'.format(image_id, rle)) return '\n'.join(lines)<|docstring|>Encodes instance masks to submission format.<|endoftext|>
7917d783e198794f93abb88809951dc3749b093123f69e07a223502726860294
def detect(model, dataset_dir, subset): 'Run detection on images in the given directory.' print('Running on {}'.format(dataset_dir)) if (not os.path.exists(RESULTS_DIR)): os.makedirs(RESULTS_DIR) submit_dir = 'submit_{:%Y%m%dT%H%M%S}'.format(datetime.datetime.now()) submit_dir = os.path.join(RESULTS_DIR, submit_dir) os.makedirs(submit_dir) dataset = ChickenDataset() dataset.load_chickens(dataset_dir, subset) dataset.prepare() dataset_val = ChickenDataset() dataset_val.load_chickens(dataset_dir, 'stage1_test') dataset_val.load_chickens(dataset_dir, 'val') dataset_val.prepare() submission = [] image_id = random.choice(dataset_val.image_ids) (original_image, image_meta, gt_class_id, gt_bbox, gt_mask) = modellib.load_image_gt(dataset_val, inference_config, image_id, use_mini_mask=False) log('original_image', original_image) log('image_meta', image_meta) log('gt_class_id', gt_class_id) log('gt_bbox', gt_bbox) log('gt_mask', gt_mask) image_ids = np.random.choice(dataset_val.image_ids, 10) APs = [] num = 0 count = 0 for image_id in dataset.image_ids: image = dataset.load_image(image_id) count = (count + 1) (image, image_meta, gt_class_id, gt_bbox, gt_mask) = modellib.load_image_gt(dataset_val, inference_config, image_id, use_mini_mask=False) molded_images = np.expand_dims(modellib.mold_image(image, inference_config), 0) r = model.detect([image], verbose=0)[0] (APss, precisions, recalls, overlaps) = utils.compute_ap(gt_bbox, gt_class_id, gt_mask, r['rois'], r['class_ids'], r['scores'], r['masks']) APs.append(APss) num = (num + APss) source_id = dataset.image_info[image_id]['id'] rle = mask_to_rle(source_id, r['masks'], r['scores']) submission.append(rle) visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'], dataset.class_names, r['scores'], title='Predictions') plt.savefig('{}/{}.jpg'.format(submit_dir, dataset.image_info[image_id]['id'])) print(APs) print((num / count)) submission = ('ImageId,EncodedPixels\n' + '\n'.join(submission)) file_path = os.path.join(submit_dir, 'submit.csv') with open(file_path, 'w') as f: f.write(submission) print('Saved to ', submit_dir)
Run detection on images in the given directory.
AP.py
detect
AlexHsuYu/ClumsyChickens
6
python
def detect(model, dataset_dir, subset): print('Running on {}'.format(dataset_dir)) if (not os.path.exists(RESULTS_DIR)): os.makedirs(RESULTS_DIR) submit_dir = 'submit_{:%Y%m%dT%H%M%S}'.format(datetime.datetime.now()) submit_dir = os.path.join(RESULTS_DIR, submit_dir) os.makedirs(submit_dir) dataset = ChickenDataset() dataset.load_chickens(dataset_dir, subset) dataset.prepare() dataset_val = ChickenDataset() dataset_val.load_chickens(dataset_dir, 'stage1_test') dataset_val.load_chickens(dataset_dir, 'val') dataset_val.prepare() submission = [] image_id = random.choice(dataset_val.image_ids) (original_image, image_meta, gt_class_id, gt_bbox, gt_mask) = modellib.load_image_gt(dataset_val, inference_config, image_id, use_mini_mask=False) log('original_image', original_image) log('image_meta', image_meta) log('gt_class_id', gt_class_id) log('gt_bbox', gt_bbox) log('gt_mask', gt_mask) image_ids = np.random.choice(dataset_val.image_ids, 10) APs = [] num = 0 count = 0 for image_id in dataset.image_ids: image = dataset.load_image(image_id) count = (count + 1) (image, image_meta, gt_class_id, gt_bbox, gt_mask) = modellib.load_image_gt(dataset_val, inference_config, image_id, use_mini_mask=False) molded_images = np.expand_dims(modellib.mold_image(image, inference_config), 0) r = model.detect([image], verbose=0)[0] (APss, precisions, recalls, overlaps) = utils.compute_ap(gt_bbox, gt_class_id, gt_mask, r['rois'], r['class_ids'], r['scores'], r['masks']) APs.append(APss) num = (num + APss) source_id = dataset.image_info[image_id]['id'] rle = mask_to_rle(source_id, r['masks'], r['scores']) submission.append(rle) visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'], dataset.class_names, r['scores'], title='Predictions') plt.savefig('{}/{}.jpg'.format(submit_dir, dataset.image_info[image_id]['id'])) print(APs) print((num / count)) submission = ('ImageId,EncodedPixels\n' + '\n'.join(submission)) file_path = os.path.join(submit_dir, 'submit.csv') with open(file_path, 'w') as f: f.write(submission) print('Saved to ', submit_dir)
def detect(model, dataset_dir, subset): print('Running on {}'.format(dataset_dir)) if (not os.path.exists(RESULTS_DIR)): os.makedirs(RESULTS_DIR) submit_dir = 'submit_{:%Y%m%dT%H%M%S}'.format(datetime.datetime.now()) submit_dir = os.path.join(RESULTS_DIR, submit_dir) os.makedirs(submit_dir) dataset = ChickenDataset() dataset.load_chickens(dataset_dir, subset) dataset.prepare() dataset_val = ChickenDataset() dataset_val.load_chickens(dataset_dir, 'stage1_test') dataset_val.load_chickens(dataset_dir, 'val') dataset_val.prepare() submission = [] image_id = random.choice(dataset_val.image_ids) (original_image, image_meta, gt_class_id, gt_bbox, gt_mask) = modellib.load_image_gt(dataset_val, inference_config, image_id, use_mini_mask=False) log('original_image', original_image) log('image_meta', image_meta) log('gt_class_id', gt_class_id) log('gt_bbox', gt_bbox) log('gt_mask', gt_mask) image_ids = np.random.choice(dataset_val.image_ids, 10) APs = [] num = 0 count = 0 for image_id in dataset.image_ids: image = dataset.load_image(image_id) count = (count + 1) (image, image_meta, gt_class_id, gt_bbox, gt_mask) = modellib.load_image_gt(dataset_val, inference_config, image_id, use_mini_mask=False) molded_images = np.expand_dims(modellib.mold_image(image, inference_config), 0) r = model.detect([image], verbose=0)[0] (APss, precisions, recalls, overlaps) = utils.compute_ap(gt_bbox, gt_class_id, gt_mask, r['rois'], r['class_ids'], r['scores'], r['masks']) APs.append(APss) num = (num + APss) source_id = dataset.image_info[image_id]['id'] rle = mask_to_rle(source_id, r['masks'], r['scores']) submission.append(rle) visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'], dataset.class_names, r['scores'], title='Predictions') plt.savefig('{}/{}.jpg'.format(submit_dir, dataset.image_info[image_id]['id'])) print(APs) print((num / count)) submission = ('ImageId,EncodedPixels\n' + '\n'.join(submission)) file_path = os.path.join(submit_dir, 'submit.csv') with open(file_path, 'w') as f: f.write(submission) print('Saved to ', submit_dir)<|docstring|>Run detection on images in the given directory.<|endoftext|>
1880e09d18eab246942cc9846da1691c89b50ff7ee9f16e7539172dc030d0d1d
def load_chickens(self, dataset_dir, subset): 'Load a subset of the nuclei dataset.\n\n dataset_dir: Root directory of the dataset\n subset: Subset to load. Either the name of the sub-directory,\n such as stage1_train, stage1_test, ...etc. or, one of:\n * train: stage1_train excluding validation images\n * val: validation images from VAL_IMAGE_IDS\n ' self.add_class('chicken', 1, 'head') assert (subset in ['train', 'val', 'stage1_train', 'stage1_test', 'stage2_test']) subset_dir = ('stage1_train' if (subset in ['train', 'val']) else subset) dataset_dir = os.path.join(dataset_dir, subset_dir) if (subset == 'val'): image_ids = VAL_IMAGE_IDS else: image_ids = next(os.walk(dataset_dir))[1] if (subset == 'train'): image_ids = list((set(image_ids) - set(VAL_IMAGE_IDS))) for image_id in image_ids: self.add_image('chicken', image_id=image_id, path=os.path.join(dataset_dir, image_id, 'images/{fname}.{ext}'.format(fname=image_id, ext=IMAGE_EXT)))
Load a subset of the nuclei dataset. dataset_dir: Root directory of the dataset subset: Subset to load. Either the name of the sub-directory, such as stage1_train, stage1_test, ...etc. or, one of: * train: stage1_train excluding validation images * val: validation images from VAL_IMAGE_IDS
AP.py
load_chickens
AlexHsuYu/ClumsyChickens
6
python
def load_chickens(self, dataset_dir, subset): 'Load a subset of the nuclei dataset.\n\n dataset_dir: Root directory of the dataset\n subset: Subset to load. Either the name of the sub-directory,\n such as stage1_train, stage1_test, ...etc. or, one of:\n * train: stage1_train excluding validation images\n * val: validation images from VAL_IMAGE_IDS\n ' self.add_class('chicken', 1, 'head') assert (subset in ['train', 'val', 'stage1_train', 'stage1_test', 'stage2_test']) subset_dir = ('stage1_train' if (subset in ['train', 'val']) else subset) dataset_dir = os.path.join(dataset_dir, subset_dir) if (subset == 'val'): image_ids = VAL_IMAGE_IDS else: image_ids = next(os.walk(dataset_dir))[1] if (subset == 'train'): image_ids = list((set(image_ids) - set(VAL_IMAGE_IDS))) for image_id in image_ids: self.add_image('chicken', image_id=image_id, path=os.path.join(dataset_dir, image_id, 'images/{fname}.{ext}'.format(fname=image_id, ext=IMAGE_EXT)))
def load_chickens(self, dataset_dir, subset): 'Load a subset of the nuclei dataset.\n\n dataset_dir: Root directory of the dataset\n subset: Subset to load. Either the name of the sub-directory,\n such as stage1_train, stage1_test, ...etc. or, one of:\n * train: stage1_train excluding validation images\n * val: validation images from VAL_IMAGE_IDS\n ' self.add_class('chicken', 1, 'head') assert (subset in ['train', 'val', 'stage1_train', 'stage1_test', 'stage2_test']) subset_dir = ('stage1_train' if (subset in ['train', 'val']) else subset) dataset_dir = os.path.join(dataset_dir, subset_dir) if (subset == 'val'): image_ids = VAL_IMAGE_IDS else: image_ids = next(os.walk(dataset_dir))[1] if (subset == 'train'): image_ids = list((set(image_ids) - set(VAL_IMAGE_IDS))) for image_id in image_ids: self.add_image('chicken', image_id=image_id, path=os.path.join(dataset_dir, image_id, 'images/{fname}.{ext}'.format(fname=image_id, ext=IMAGE_EXT)))<|docstring|>Load a subset of the nuclei dataset. dataset_dir: Root directory of the dataset subset: Subset to load. Either the name of the sub-directory, such as stage1_train, stage1_test, ...etc. or, one of: * train: stage1_train excluding validation images * val: validation images from VAL_IMAGE_IDS<|endoftext|>
55ca69be2096d8d8921b1274fa8db914ee63007a48bca1cfadb6cc1aa788f1d9
def load_mask(self, image_id): 'Generate instance masks for an image.\n Returns:\n masks: A bool array of shape [height, width, instance count] with\n one mask per instance.\n class_ids: a 1D array of class IDs of the instance masks.\n ' info = self.image_info[image_id] mask_dir = os.path.join(os.path.dirname(os.path.dirname(info['path'])), 'masks') mask = [] for f in next(os.walk(mask_dir))[2]: m = skimage.io.imread(os.path.join(mask_dir, f), as_grey=True).astype(np.bool) mask.append(m) mask = np.stack(mask, axis=(- 1)) return (mask, np.ones([mask.shape[(- 1)]], dtype=np.int32))
Generate instance masks for an image. Returns: masks: A bool array of shape [height, width, instance count] with one mask per instance. class_ids: a 1D array of class IDs of the instance masks.
AP.py
load_mask
AlexHsuYu/ClumsyChickens
6
python
def load_mask(self, image_id): 'Generate instance masks for an image.\n Returns:\n masks: A bool array of shape [height, width, instance count] with\n one mask per instance.\n class_ids: a 1D array of class IDs of the instance masks.\n ' info = self.image_info[image_id] mask_dir = os.path.join(os.path.dirname(os.path.dirname(info['path'])), 'masks') mask = [] for f in next(os.walk(mask_dir))[2]: m = skimage.io.imread(os.path.join(mask_dir, f), as_grey=True).astype(np.bool) mask.append(m) mask = np.stack(mask, axis=(- 1)) return (mask, np.ones([mask.shape[(- 1)]], dtype=np.int32))
def load_mask(self, image_id): 'Generate instance masks for an image.\n Returns:\n masks: A bool array of shape [height, width, instance count] with\n one mask per instance.\n class_ids: a 1D array of class IDs of the instance masks.\n ' info = self.image_info[image_id] mask_dir = os.path.join(os.path.dirname(os.path.dirname(info['path'])), 'masks') mask = [] for f in next(os.walk(mask_dir))[2]: m = skimage.io.imread(os.path.join(mask_dir, f), as_grey=True).astype(np.bool) mask.append(m) mask = np.stack(mask, axis=(- 1)) return (mask, np.ones([mask.shape[(- 1)]], dtype=np.int32))<|docstring|>Generate instance masks for an image. Returns: masks: A bool array of shape [height, width, instance count] with one mask per instance. class_ids: a 1D array of class IDs of the instance masks.<|endoftext|>
d01d4e82b14777fa825b0f76bbb999fe37de94014b0a134fed36613a3edcfde8
def image_reference(self, image_id): 'Return the path of the image.' info = self.image_info[image_id] if (info['source'] == 'chicken'): return info['id'] else: super(self.__class__, self).image_reference(image_id)
Return the path of the image.
AP.py
image_reference
AlexHsuYu/ClumsyChickens
6
python
def image_reference(self, image_id): info = self.image_info[image_id] if (info['source'] == 'chicken'): return info['id'] else: super(self.__class__, self).image_reference(image_id)
def image_reference(self, image_id): info = self.image_info[image_id] if (info['source'] == 'chicken'): return info['id'] else: super(self.__class__, self).image_reference(image_id)<|docstring|>Return the path of the image.<|endoftext|>
b266469f75c94524e8127dd1469fbedc9a35432db2a6a27a096d6af4e40f4726
def test_simple_reverse_relation_included_renderer(): '\n Test renderer when a single reverse fk relation is passed.\n ' serializer = DummyTestSerializer(instance=Entry()) renderer = JSONRenderer() rendered = renderer.render(serializer.data, renderer_context={'view': DummyTestViewSet()}) assert rendered
Test renderer when a single reverse fk relation is passed.
example/tests/unit/test_renderers.py
test_simple_reverse_relation_included_renderer
morenoh149/django-rest-framework-json-api
0
python
def test_simple_reverse_relation_included_renderer(): '\n \n ' serializer = DummyTestSerializer(instance=Entry()) renderer = JSONRenderer() rendered = renderer.render(serializer.data, renderer_context={'view': DummyTestViewSet()}) assert rendered
def test_simple_reverse_relation_included_renderer(): '\n \n ' serializer = DummyTestSerializer(instance=Entry()) renderer = JSONRenderer() rendered = renderer.render(serializer.data, renderer_context={'view': DummyTestViewSet()}) assert rendered<|docstring|>Test renderer when a single reverse fk relation is passed.<|endoftext|>
479709bc04f408691d3166c9be1c03ade0a52b0cae83416a033ecef0c0e9959c
@cached_property def additional_properties_type(): '\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n ' return (bool, date, datetime, dict, float, int, list, str, none_type)
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
clients/client/python/ory_client/model/schema_patch.py
additional_properties_type
ory/sdk
77
python
@cached_property def additional_properties_type(): '\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n ' return (bool, date, datetime, dict, float, int, list, str, none_type)
@cached_property def additional_properties_type(): '\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n ' return (bool, date, datetime, dict, float, int, list, str, none_type)<|docstring|>This must be a method because a model may have properties that are of type self, this must run after the class is loaded<|endoftext|>