This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

11institutetext: Cheriton School of Computer Science, University of Waterloo
https://cs.uwaterloo.ca/~smwatt
11email: smwatt@uwaterloo.ca

Efficient Quotients of Non-Commutative Polynomials

Stephen M. Watt
Abstract

It is shown how to compute quotients efficiently in non-commutative univariate polynomial rings. This extends earlier work where efficient generic quotients were studied with a primary focus on commutative domains. Fast algorithms are given for left and right quotients of polynomials where the variable commutes with coefficients. These algorithms are based on the concept of the “whole shifted inverse”, which is a specialized quotient where the dividend is a power of the polynomial variable. It is also shown that when the variable does not commute with coefficients, that is for skew polynomials, left and right whole shifted inverses are defined and may be used to compute right and left quotients. In this case their computation is not asymptotically fast, but once obtained, they may be used to compute multiple quotients, each with one multiplication. Examples are shown of polynomials with matrix coefficients, differential operators and difference operators. In addition, a proof-of-concept generic Maple implementations is given.

1 Introduction

In symbolic mathematical computation it is important to have efficient algorithms for the fundamental arithmetic operations of addition, multiplication and division. While linear time algorithms for additive operations are usually straightforward, considerable attention has been devoted to find efficient methods to compute products and quotients of integers, polynomials with integer or finite field coefficients and matrices with elements from a ring. For these, both practically efficient algorithms and theoretically important bounds are well known.

For integer and polynomial division, efficient algorithms based on Newton iteration allow the computation of quotients in time proportional to multiplication. Until recently, these algorithms left the original domain to perform arithmetic in related domains. For integers, this involved computing an approximation to the inverse of the divisor in extended precision approximate arithmetic or in a residue ring, and for polynomials it involved computing the inverse of the reverse of the divisor polynomial in ideal-adic arithmetic.

We have recently shown how these quotients may be computed without leaving the original domain, and we have extended this to a generic domain-preserving algorithm for rings with a suitable whole shift operation [10]. For integers the whole shift multiplies by a power of the representation base and for polynomials it multiplies by a power of the variable, in both cases discarding terms with negative powers. The previous paper developed the concept of the whole shifted inverse and used it to compute quotients efficiently. Non-commutative domains were mentioned only briefly.

The present article expands on how these methods may be used to compute quotients of non-commutative polynomials. In particular, it is shown that

  • \bullet

    the whole shifted inverse is well-defined on non-commutative polynomial rings R[x]R[x],

  • \bullet

    its computation is efficient,

  • \bullet

    they may be used to compute left or right quotients in R[x]R[x], each with one multiplication,

  • \bullet

    left and right whole shifted inverses may be defined on skew polynomials R[x;σ,δ]R[x;\sigma,\delta], and

  • \bullet

    they may be used to compute the right and left quotients in R[x;σ,δ]R[x;\sigma,\delta], each with one multiplication.

The remainder of this article is organized as follows. Section 2 presents some basic background, including notation, the definition of division in a non-commutative context, and the Newton-Schulz iteration. Section 3 considers division of non-commutative polynomials in R[x]R[x], showing O(n2)O(n^{2}) algorithms for classical division and for pseudodivision. It recalls the notion of the whole shifted inverse, proves it is well-defined on non-commutative R[x]R[x] and shows that it can be used to compute left and right quotients in this setting. Section 4 recapitulates the generic algorithms from [10] that use a modified Newton iteration to compute the whole shifted inverse. It also explains why it applies when polynomial coefficients are non-commutative. Section 5 gives an example of these algorithms applied to polynomial matrices. Section 6 extends the discussion to skew polynomials R[x;σ,δ]R[x;\sigma,\delta], defining left and right whole shifted inverse, and showing how they may be used. Section 7 gives linear ordinary differential and difference operators as examples, before concluding remarks in Section 8.

2 Background

2.1 Notation

We adopt the following notation:
precBu\operatorname{prec}_{B}u number of base-BB digits of an integer uu, logB|u|+1\lfloor\log_{B}|u|\rfloor+1 precxp\operatorname{prec}_{x}p number of coefficients of a polynomial pp, degreexp+1\operatorname{degree}_{x}p+1 uquov,uremvu\mathbin{\mathrm{quo}}v,\;u\mathbin{\mathrm{rem}}v quotient and remainder (see below) uxquov,uxremvu\,\text{{\bf\footnotesize x}quo}\,v,\;u\,\text{{\bf\footnotesize x}rem}\,v left and right (pseudo)quotient and remainder, x{l,lp,r,pr}\text{{\bf\footnotesize x}}\in\{\mathrm{l,lp,r,pr}\} shiftnv\operatorname{shift}_{n}v, shinvnv\operatorname{shinv}_{n}v whole shift and whole shifted inverse (see below) R[x;σ,δ]R[x;\sigma,\delta], R[x,δ]R[x,\delta] skew polynomials (see Section 6) ui\,{}_{i}u, uiu_{i} coefficient of skew polynomial uu with variable powers on the left, right. xshiftnv\text{{\bf\footnotesize x}shift}_{n}v, xshinvnv\text{{\bf\footnotesize x}shinv}_{n}v left and right whole shift and shifted inverse, x{l,r}\text{{\bf\footnotesize x}}\in\{\mathrm{l,r}\} (see Section 6) X(i)X_{(i)} value of XX at ithi^{th} iteration
The “prec\operatorname{prec}” notation, standing for “precision”, means the number of base-BB digits or polynomial coefficients. It is similar to that of [4], where it is used to present certain algorithms generically for integers and polynomials. In particular, if we take integers to be represented in base-BB, i.e. for any integer u0u\neq 0 there is h=precB(u)1h=\operatorname{prec}_{B}(u)-1, such that

u=i=0huiBi,ui, 0ui<B,uh0,u=\sum_{i=0}^{h}u_{i}B^{i},\quad u_{i}\in\mathbb{Z},\,0\leq u_{i}<B,\;u_{h}\neq 0, (1)

then integers base-BB behave similarly to univariate polynomials with coefficients uiu_{i}, but with carries complicating matters.

2.2 Division

The notion of integer quotients and remainders can be extended to more general rings. For a Euclidean domain DD with valuation N:D0N:D\rightarrow\mathbb{Z}_{\geq 0}, such that for any u,vD,v0u,v\in D,v\neq 0, there exist q,rDq,r\in D such that

u\displaystyle u =qv+r,\displaystyle=qv+r, r\displaystyle r =0 or N(r)<N(v).\displaystyle=0\text{ or }N(r)<N(v).

The value qq is a quotient of uu and vv and rr is a remainder of dividing uu by vv and we write

q\displaystyle q =uquov\displaystyle=u\mathbin{\mathrm{quo}}v r\displaystyle r =uremv\displaystyle=u\mathbin{\mathrm{rem}}v

when these are unique. When both the quotient and remainder are required, we write udivv=(uquov,uremv)u~{}\mathrm{div}~{}v=(u~{}\mathbin{\mathrm{quo}}~{}v,u~{}\mathbin{\mathrm{rem}}~{}v). When DD is a non-commutative ring with a valuation NN, there may exist left and right quotients such that

u\displaystyle u =vql+rl,\displaystyle=v\,q_{\text{\sc l}}+r_{\text{\sc l}}, rl\displaystyle\hskip 42.67912ptr_{\text{\sc l}} =0 or N(rl)<N(v)\displaystyle=0\text{ or }N(r_{\text{\sc l}})<N(v) (2)
u\displaystyle u =qrv+rr,\displaystyle=q_{\text{\sc r}}\,v+r_{\text{\sc r}}, rr\displaystyle\hskip 42.67912ptr_{\text{\sc r}} =0 or N(rr)<N(v).\displaystyle=0\text{ or }N(r_{\text{\sc r}})<N(v).

When these exist and are unique, we write

ql\displaystyle q_{\text{\sc l}} =ulquov\displaystyle=u\operatorname{lquo}v rl\displaystyle r_{\text{\sc l}} =ulremv\displaystyle=u\operatorname{lrem}v qr\displaystyle q_{\text{\sc r}} =urquov\displaystyle=u\operatorname{rquo}v rr\displaystyle r_{\text{\sc r}} =urremv.\displaystyle=u\operatorname{rrem}v.

For certain non-commutative rings with a distance measure \|\cdot\|, a sequence of approximations to the inverse of AA may be computed via the Newton-Schulz iteration [7]

X(i+1)=X(i)+X(i)(1AX(i))X_{(i+1)}=X_{(i)}+X_{(i)}(1-AX_{(i)}) (3)

where 11 denotes the multiplicative identity of the ring. There are several ways to arrange this expression, but the form above emphasizes that as X(i)X_{(i)} approaches A1A^{-1}, the product X(i)(1AX(i))X_{(i)}(1-AX_{(i)}) approaches 0. For n×n\mathbb{C}^{n\times n} matrices, a suitable initial value is X(0)=A/(nTr(AA))X_{(0)}=A^{\dagger}/(n\,\mathrm{Tr}(AA^{\dagger})), where AA^{\dagger} is the Hermitian transpose.

2.3 Whole Shift and Whole Shifted Inverse

In previous work [10] we studied the problem of efficient domain-preserving computation of quotients and remainders for integers and polynomials, then generalized these results to a generic setting. To this end, we defined the notions of the whole shift and whole shifted inverse with attention to commutative domains. We recapitulate these definitions and two results relevant to the present article.

Definition 1 (Whole nn-shift in R[x]R[x])

Given a polynomial u=i=0huixiR[x]u=\sum_{i=0}^{h}u_{i}x^{i}\in R[x], with RR a ring and nn\in\mathbb{Z}, the whole nn-shift of uu with respect to xx is

shiftn,xu=i+n0uixi+n.\operatorname{shift}_{n,x}u=\sum_{i+n\geq 0}u_{i}x^{i+n}. (4)

When xx is clear by context, we write shiftnu\operatorname{shift}_{n}u.

Definition 2 (Whole nn-shifted inverse in F[x]F[x])

Given n0n\in\mathbb{Z}_{\geq 0} and vF[x]v\in F[x], FF a field, the whole nn-shifted inverse of vv with respect to xx is

shinvn,xv=xnquov.\operatorname{shinv}_{n,x}v=x^{n}\mathbin{\mathrm{quo}}v. (5)

When xx is clear by context, we write shinvnv\operatorname{shinv}_{n}v,

Theorem 1

Given two polynomials u,vF[x]u,v\in F[x], FF a field, and 0degreeuh0\leq\operatorname{degree}u\leq h,

uquov=shifth(ushinvhv).u\mathbin{\mathrm{quo}}v=\operatorname{shift}_{-h}(u\cdot\operatorname{shinv}_{h}v). (6)

For classical and Karatsuba multiplication it is more efficient to compute just the top part of the product in (6), omitting the lower hh terms, instead of shifting:

shifth(ushinvhv)=MultQuo(u,shinvhv,h),\operatorname{shift}_{-h}(u\cdot\operatorname{shinv}_{h}v)=\text{\sc MultQuo}(u,\operatorname{shinv}_{h}v,h),

with MultQuo(a,b,n)=abquoxn\text{\sc MultQuo}(a,b,n)=ab\mathbin{\mathrm{quo}}x^{n} computing only degreea+degreebn+1\operatorname{degree}a+\operatorname{degree}b-n+1 terms. For multiplication methods where computing only the top part of the product gives no saving, some improvement is obtained using

shifth(ushinvhv)=shift(hk)(shiftkushinvhv).\operatorname{shift}_{-h}(u\cdot\operatorname{shinv}_{h}v)=\operatorname{shift}_{-(h-k)}(\operatorname{shift}_{-k}u\cdot\operatorname{shinv}_{h}v).
Theorem 2

Given vF[x]v\in F[x], with FF a field and h>degreev=kh>\operatorname{degree}v=k and suitable starting value w(0)w_{(0)}, the sequence of iterates

w(i+1)=w(i)+shifth(w(i)(shifth1vw(i)))w_{(i+1)}=w_{(i)}+\operatorname{shift}_{-h}\big{(}w_{(i)}(\operatorname{shift}_{h}1-vw_{(i)})\big{)}

converges to shinvhv\operatorname{shinv}_{h}v in log2(hk)\lceil\log_{2}(h-k)\rceil steps.

A suitable starting value for w(0)w_{(0)} is given by Shinv0 in Section 4.

Algorithm 1 Classical division for non-commutative R[x]R[x] with invertible vkv_{k}
Compute q=i=0hkqixiq=\sum_{i=0}^{h-k}q_{i}x^{i}and r=i=0k1rixir=\sum_{i=0}^{k-1}r_{i}x^{i}such that u=q×πv+r.u=q\times_{\pi}v+r.divu=i=0huixiR[x],v=i=0kvixiR[x],πS2u=\sum_{i=0}^{h}u_{i}x^{i}\in R[x],v=\sum_{i=0}^{k}v_{i}x^{i}\in R[x],\pi\in S_{2}
1:vinvvkv^{*}\leftarrow\mathrm{inv}~{}v_{k}
2:q0q\leftarrow 0
3:rur\leftarrow u \Forihki\leftarrow h-k to 0 by 1-1
4:t(ri+k×πv)xit\leftarrow(r_{i+k}\times_{\pi}v^{*})\,x^{i}
5:qq+tq\leftarrow q+t
6:rrt×πvr\leftarrow r-t\times_{\pi}v \EndFor
7:\Return(q, r) \EndFunction\LCommentLeft division:   (ql,rl)ldiv(u,v)u=v×ql+rl(q_{\text{\sc l}},r_{\text{\sc l}})\leftarrow\text{\sc ldiv}(u,v)\Rightarrow u=v\times q_{\text{\sc l}}+r_{\text{\sc l}}
8:ldiv(u,v)div(u,v,(2 1))\text{\sc ldiv}(u,v)\mapsto\text{\sc div}\big{(}u,v,(2\,1)\big{)} \LCommentRight division: (qr,rr)rdiv(u,v)u=qr×v+rr(q_{\text{\sc r}},r_{\text{\sc r}})\leftarrow\text{\sc rdiv}(u,v)\Rightarrow u=q_{\text{\sc r}}\times v+r_{\text{\sc r}}
9:rdiv(u,v)div(u,v,(1 2))\text{\sc rdiv}(u,v)\mapsto\text{\sc div}\big{(}u,v,(1\,2)\big{)}
\LComment
\Function

3 Division in Non-Commutative R[x]R[x]

We now lay out how to use shift\operatorname{shift} and shinv\operatorname{shinv} to compute quotients for polynomials with non-commutative coefficients. First we show classical algorithms to compute left and right quotients in R[x]R[x]. We then prove two theorems, one showing that xnlquov=xnrquovx^{n}\operatorname{lquo}v=x^{n}\operatorname{rquo}v in this setting, making the whole shifted inverse well defined, and another showing that it may be used to compute left and right quotients.

3.1 Definitions and Classical Algorithms

Let uu and vv be two polynomials in R[x]R[x] with Euclidean norm being the polynomial degree. The left and right quotients and remainders are defined as in (2). Left and right quotients will exist provided that vkv_{k} is invertible in RR and they may be computed by Algorithm 1. In the presentation of the algorithm, π\pi denotes a permutation on two elements so is either the identity or a transposition. The notation ×π\times_{\pi} is a shorthand for ×π\times\circ\pi so a×πb=a×ba\times_{\pi}b=a\times b when π\pi is the identity and a×πb=b×aa\times_{\pi}b=b\times a when π\pi is a transposition.

There are some circumstances where quotients or related quantities may be computed even if vkv_{k} is not invertible. When RR is an integral domain, quotients may be computed as usual in K[x]K[x] with KK being the quotient field of RR. Alternatively, when RR is non-commutative but vkv_{k} commutes with vv, it is possible to compute pseudoquotients and pseudoremainders satisfying

mu\displaystyle m\,u =vql+rl,\displaystyle=v\,q_{\text{\sc l}}+r_{\text{\sc l}}, degreerl\displaystyle\operatorname{degree}r_{\text{\sc l}} <degreev\displaystyle<\operatorname{degree}v
um\displaystyle u\,m =qrv+rr,\displaystyle=q_{\text{\sc r}}\,v+r_{\text{\sc r}}, degreerr\displaystyle\operatorname{degree}r_{\text{\sc r}} <degreev\displaystyle<\operatorname{degree}v
m\displaystyle m =vkhk+1,\displaystyle=v_{k}^{h-k+1},

as shown in Algorithm 2. In this case, we write

ql\displaystyle q_{\text{\sc l}} =ulpquov\displaystyle=u\operatorname{lpquo}v rl\displaystyle r_{\text{\sc l}} =lpremv\displaystyle=\operatorname{lprem}v
qr\displaystyle q_{\text{\sc r}} =urpquov\displaystyle=u\operatorname{rpquo}v rl\displaystyle r_{\text{\sc l}} =rpremv.\displaystyle=\operatorname{rprem}v.

Requiring vkv_{k} to commute with vv is quite restrictive, however, so we focus our attention to situations where the inverse of vkv_{k} exists.

Algorithm 2 Non-commutative polynomial pseudodivision
Compute q=i=0hkqixiq=\sum_{i=0}^{h-k}q_{i}x^{i}and r=i=0k1rixir=\sum_{i=0}^{k-1}r_{i}x^{i}such that vkhk+1u=q×πv+rv_{k}^{h-k+1}u=q\times_{\pi}v+r.
Requires v×vk=vk×vv\times v_{k}=v_{k}\times v. pdivu=i=0huixiR[x],v=i=0kvixiR[x],πS2u=\sum_{i=0}^{h}u_{i}x^{i}\in R[x],v=\sum_{i=0}^{k}v_{i}x^{i}\in R[x],\pi\in S_{2}
1:q0q\leftarrow 0
2:rur\leftarrow u \Forihki\leftarrow h-k to 0 by 1-1
3:tui+kxit\leftarrow u_{i+k}\,x^{i}
4:qq+t×πvkiq\leftarrow q+t\times_{\pi}v_{k}^{i}
5:rr×πvkt×πvr\leftarrow r\times_{\pi}v_{k}-t\times_{\pi}v \EndFor
6:\Return(q, r) \EndFunction\LCommentLeft pseudodivision:   (ql,rl)lpdiv(u,v)vkhk+1u=v×ql+rl(q_{\text{\sc l}},r_{\text{\sc l}})\leftarrow\text{\sc lpdiv}(u,v)\Rightarrow v_{k}^{h-k+1}u=v\times q_{\text{\sc l}}+r_{\text{\sc l}}
7:lpdiv(u,v)pdiv(u,v,(2 1))\text{\sc lpdiv}(u,v)\mapsto\text{\sc pdiv}\big{(}u,v,(2\,1)\big{)} \LCommentRight pseudodivision: (qr,rr)rpdiv(u,v)vkhk+1u=qr×v+rr(q_{\text{\sc r}},r_{\text{\sc r}})\leftarrow\text{\sc rpdiv}(u,v)\Rightarrow v_{k}^{h-k+1}u=q_{\text{\sc r}}\times v+r_{\text{\sc r}}
8:rpdiv(u,v)pdiv(u,v,(1 2))\text{\sc rpdiv}(u,v)\mapsto\text{\sc pdiv}\big{(}u,v,(1\,2)\big{)}
\LComment
\Function

3.2 Whole Shift and Whole Shifted Inverse in R[x]R[x]

We now examine the notions of the whole shift and whole shifted inverse for R[x]R[x] with non-commutative RR. First consider the whole shift. Since xx commutes with all values in R[x]R[x], we may without ambiguity take, for u=i=0huixiu=\sum_{i=0}^{h}u_{i}x^{i} and nn\in\mathbb{Z},

shiftnu=i+n0xn(uixi)=i+n0(uixi)xn.\operatorname{shift}_{n}u\;=\sum_{i+n\geq 0}x^{n}(u_{i}x^{i})\;=\sum_{i+n\geq 0}(u_{i}x^{i})x^{n}. (7)

That is, the fact that R[x]R[x] is non-commutative does not lead to left and right variants of the whole shift.

We state two simple theorems with obvious proofs:

Theorem 3

Let wR[x]w\in R[x]. Then, for all n0n\in\mathbb{Z}_{\geq 0}, shiftnshiftnw=w.\operatorname{shift}_{-n}\operatorname{shift}_{n}w=w.

Theorem 4

Let u,vR[x]u,v\in R[x] with degreeu=h\operatorname{degree}u=h and degreev=k\operatorname{degree}v=k. Then, for mm\in\mathbb{Z},

shiftkm(u×v)\displaystyle\operatorname{shift}_{-k-m}(u\times v) =shiftk(shiftm(u)×v)\displaystyle=\operatorname{shift}_{-k}(\operatorname{shift}_{-m}(u)\times v)
shifthm(u×v)\displaystyle\operatorname{shift}_{-h-m}(u\times v) =shifth(u×shiftm(v)).\displaystyle=\operatorname{shift}_{-h}(u\times\operatorname{shift}_{-m}(v)).

We now come to the main point of this section and show shinv\operatorname{shinv} is well-defined when RR is non-commutative.

Theorem 5 (Whole shifted inverse for non-commutative R[x]R[x])

Let v=i=0kvixiR[x]v=\sum_{i=0}^{k}v_{i}x^{i}\in R[x], with RR a non-commutative ring and vkv_{k} invertible in RR. Then, for h0h\in\mathbb{Z}_{\geq 0},

xhlquov=xhrquov.x^{h}\operatorname{lquo}v=x^{h}\operatorname{rquo}v.
  • Proof.Let ql=xhlquovq_{\text{\sc l}}=x^{h}\operatorname{lquo}v and qr=xhrquovq_{\text{\sc r}}=x^{h}\operatorname{rquo}v. If h<kh<k, then ql=qr=0q_{\text{\sc l}}=q_{\text{\sc r}}=0. Otherwise, both qlq_{\text{\sc l}} and qrq_{\text{\sc r}} have degree hk0h-k\geq 0 so

    vkqlhk\displaystyle v_{k}\,{q_{\text{\sc l}}}_{h-k} =1\displaystyle=1 qrhkvk\displaystyle{q_{\text{\sc r}}}_{h-k}\,v_{k} =1\displaystyle=1 (8)
    j=Mkvjqli+kj\displaystyle\sum_{j=M}^{k}v_{j}\,{q_{\text{\sc l}}}_{i+k-j} =0\displaystyle=0 j=Mkqri+kjvj\displaystyle\sum_{j=M}^{k}{q_{\text{\sc r}}}_{i+k-j}\,v_{j} =0,0i<hk,\displaystyle=0,\quad 0\leq i<h-k, (9)

    where M=max(0,ih+2k)M=\max(0,i-h+2k). We show by induction on ii that qli=qri{q_{\text{\sc l}}}_{i}={q_{\text{\sc r}}}_{i} for 0ihk0\leq i\leq h-k. Since vkv_{k} is invertible, (8) and (9) give

    qlhk=qrhk=vk1{q_{\text{\sc l}}}_{h-k}={q_{\text{\sc r}}}_{h-k}=v_{k}^{-1} (10)

    and

    qli\displaystyle{q_{\text{\sc l}}}_{i} =j=Mk1vk1vjqli+kj\displaystyle=-\sum_{j=M}^{k-1}v_{k}^{-1}\,v_{j}\,{q_{\text{\sc l}}}_{i+k-j} qri\displaystyle{q_{\text{\sc r}}}_{i} =j=Mk1qri+kjvjvk1,0i<hk.\displaystyle=-\sum_{j=M}^{k-1}{q_{\text{\sc r}}}_{i+k-j}\,v_{j}\,v_{k}^{-1},\quad 0\leq i<h-k. (11)

    Equation (10) gives the base of the induction. Now suppose qli=qri{q_{\text{\sc l}}}_{i}={q_{\text{\sc r}}}_{i} for N<ihkN<i\leq h-k. Then for i=N0i=N\geq 0 equation (11) gives

    qlN\displaystyle{q_{\text{\sc l}}}_{N} =j=Mk1vk1vjqlN+kj=j=Mk1vk1vjqrN+kj\displaystyle=-\sum_{j=M}^{k-1}v_{k}^{-1}\,v_{j}\,{q_{\text{\sc l}}}_{N+k-j}=-\sum_{j=M}^{k-1}v_{k}^{-1}\,v_{j}\,{q_{\text{\sc r}}}_{N+k-j}
    =j=Mk1vk1vj(=Mk1qrN+kj+kvvk1)\displaystyle=-\sum_{j=M}^{k-1}v_{k}^{-1}\,v_{j}\left(-\sum_{\ell=M}^{k-1}\,{q_{\text{\sc r}}}_{N+k-j+k-\ell}v_{\ell}\,v_{k}^{-1}\right)
    ==Mk1(j=Mk1vk1vjqrN+kj+k)vvk1==Mk1qrN+kjvvk1=qrN.\displaystyle=-\sum_{\ell=M}^{k-1}\left(-\sum_{j=M}^{k-1}v_{k}^{-1}\,v_{j}\,{q_{\text{\sc r}}}_{N+k-j+k-\ell}\right)\,v_{\ell}\,v_{k}^{-1}=-\sum_{\ell=M}^{k-1}{q_{\text{\sc r}}}_{N+k-j}\,v_{\ell}\,v_{k}^{-1}={q_{\text{\sc r}}}_{N}.

    \square

Thus we may write shinvhv\operatorname{shinv}_{h}v without ambiguity in the non-commutative case, i.e

shinvhv=xhlquov=xhrquov.\operatorname{shinv}_{h}v=x^{h}\operatorname{lquo}v=x^{h}\operatorname{rquo}v. (12)

3.3 Quotients from the Whole Shifted Inverse in R[x]R[x]

We consider computing the left and right quotients in R[x]R[x] from the whole shifted inverse. We have the following theorem.

Theorem 6 (Left and right quotients from the whole shifted inverse in R[x]R[x])

Let u,vR[x]u,v\in R[x], RR a ring, with degreev=k\operatorname{degree}v=k and vkv_{k} invertible in RR. Then for hdegreeuh\geq\operatorname{degree}u,

ulquov\displaystyle u\,\operatorname{lquo}v =shifth(shinvh(v)×u)and\displaystyle=\operatorname{shift}_{-h}(\operatorname{shinv}_{h}(v)\times u)\quad\text{and}
urquov\displaystyle u\,\operatorname{rquo}v =shifth(u×shinvh(v)).\displaystyle=\operatorname{shift}_{-h}(u\times\operatorname{shinv}_{h}(v)).
  • Proof.Consider first the right quotient. It is sufficient to show

    u=shifth(u×shinvhv)×v+rru=\operatorname{shift}_{-h}(u\times\operatorname{shinv}_{h}v)\times v+r_{\text{\sc r}}

    for some rrr_{\text{\sc r}} with degreerr<k\operatorname{degree}r_{\text{\sc r}}<k. It is therefore sufficient to show

    shiftku=shiftk(shifth(u×shinvhv)×v).\operatorname{shift}_{-k}u=\operatorname{shift}_{-k}\big{(}\operatorname{shift}_{-h}(u\times\operatorname{shinv}_{h}v)\times v\big{)}. (13)

    We have

    (u×shinvhv)×v\displaystyle(u\times\operatorname{shinv}_{h}v)\times v =u×((xhrquov)×v)\displaystyle=u\times((x^{h}\operatorname{rquo}v)\times v) (14)
    =u×(xhρ),ρ=0 or degreeρ<k\displaystyle=u\times(x^{h}-\rho),\quad\rho=0\text{ or }\operatorname{degree}\rho<k
    =shifthuu×ρ.\displaystyle=\operatorname{shift}_{h}u-u\times\rho.
    shifthu\displaystyle\operatorname{shift}_{h}u =(u×shinvhv)×v+u×ρ.\displaystyle=(u\times\operatorname{shinv}_{h}v)\times v+u\times\rho. (15)

    Since h0h\geq 0, Theorem 3 applies and equation (15) gives

    u\displaystyle u =shifth((u×shinvhv)×v)+shifth(u×ρ)\displaystyle=\operatorname{shift}_{-h}\big{(}(u\times\operatorname{shinv}_{h}v)\times v\big{)}+\operatorname{shift}_{-h}(u\times\rho)

    with the degree of shifth(u×ρ)\operatorname{shift}_{-h}(u\times\rho) less than kk. Therefore

    shiftku\displaystyle\operatorname{shift}_{-k}u =shiftkh((u×shinvhv)×v)\displaystyle=\operatorname{shift}_{-k-h}\big{(}(u\times\operatorname{shinv}_{h}v)\times v\big{)}
    =shiftk(shifth(u×shinvhv)×v)),\displaystyle=\operatorname{shift}_{-k}\big{(}\operatorname{shift}_{-h}(u\times\operatorname{shinv}_{h}v)\times v)\big{)},

    by Theorem 4, and we have shown equation (13) as required. The proof for lquo\operatorname{lquo} replaces equation (14) with

    v×(shinvhv×u)=(v×(xhlquov))×uv\times(\operatorname{shinv}_{h}v\times u)=(v\times(x^{h}\operatorname{lquo}v))\times u

    and follows the same lines, mutatis mutandis. \square

As in the commutative case, it may be more efficient to compute only the top part of the product instead of computing the whole thing then shifting away part. Now that we have shown that shift\operatorname{shift} and shinv\operatorname{shinv} are well-defined for non-commutative R[x]R[x], we next see that shinv\operatorname{shinv} may be computed by our generic algorithm.

4 Generic Algorithm for the Whole Shifted Inverse

Earlier work has shown how to compute shinv\operatorname{shinv} efficiently for \mathbb{Z}, both for Euclidean domains F[x]F[x], and generically [10]. The generic version shown here in Algorithm 3. We justify below that it applies equally well to polynomials with non-commutative coefficients. The algorithm operates on a ring DD that is required to have a suitable shift\operatorname{shift} and certain other operations and properties must be defined. For example, on F[x]F[x], FF a field, these are

shiftnu\displaystyle\operatorname{shift}_{n}u ={uxnif n0uquoxnif n<0\displaystyle=\begin{cases}u\cdot x^{n}&\text{if~{}}n\geq 0\\ u\mathbin{\mathrm{quo}}x^{-n}&\text{if~{}}n<0\end{cases}
coeff(u,i)\displaystyle\text{coeff}(u,i) =ui\displaystyle=u_{i}
Shinv0(v)\displaystyle\text{\sc Shinv0}(v) =(1/vkx1/vkvk11/vk, 2)\displaystyle=(1/v_{k}\,x-1/v_{k}\cdot v_{k-1}\cdot 1/v_{k},\;2)
hasCarries =false\displaystyle=\text{false}
Mult(a,b)\displaystyle\text{\sc Mult}(a,b) =ab\displaystyle=ab
MultMod(a,b,n)\displaystyle\text{\sc MultMod}(a,b,n) =abremxn.\displaystyle=ab\mathbin{\mathrm{rem}}x^{n}.

The iterative step of Algorithm 3 is given on line 22. Since D.PowDiff computes shifth1vw\operatorname{shift}_{h}1-v\cdot w, this line computes

shiftmw+shift2mh(w(shifth1vw)).\operatorname{shift}_{m}w+\operatorname{shift}_{2m-h}\big{(}w\cdot(\operatorname{shift}_{h}1-v\cdot w)\big{)}. (16)

The shift operations are multiplications by powers of xx, with shifthp=pxh\operatorname{shift}_{h}p=px^{h}. The the expressions involving k,h,k,h,\ell and mm for shift amounts arise from multiplication by various powers of xx at different points in order to compute shorter polynomials when possible. Since xx commutes with all values, it is possible to accumulate these into single pre- and post- shifts. With this in mind, the R[x]R[x] operations ++ and \cdot ultimately compute the polynomial coefficients using the operations of RR and the order of the multiplicands in (16) is exactly that of the Newton-Schulz iteration (3). The form of Shinv0 above is chosen so that it gives a suitable initial value for non-commutative polynomials.

The computational complexity of the Refine methods of Algorithm 3 may be summarized as follows: The function D.Refine1 computes full-length values at each iteration so has time complexity O(log(hk)M(h))O(\log(h-k)M(h)) where M(N)M(N) is the time complexity of multiplication. The function D.Refine2 reduces the size of the values, computing only the necessary prefixes. The function D.Refine3 reduces the size of some values further and achieves time complexity O(i=1log(hk)M(2i))O\big{(}\sum_{i=1}^{\log(h-k)}M(2^{i})\big{)}, which gives time complexity O(M(N)),N=hkO(M(N)),N=h-k for the purely theoretical M(N)O(NlogN)M(N)\in O(N\log N), for Schönhage-Strassen M(N)O(NlogNloglogN)M(N)\in O(N\log N\log\log N) and for M(N)O(Np),p>0.M(N)\in O(N^{p}),p>0.

Algorithm 3 Generic Shinv(v,h)\text{\sc Shinv}(v,h)
vD,h>0v\in D,h\in\mathbb{Z}_{>0}\;where 0<k=precv1<h0<k=\operatorname{prec}v-1<hshinvhvD\operatorname{shinv}_{h}v\in DD.Shinv v,hv,hDomain-specific initialization
1:(w,)D.Shinv0(v)(w,\ell)\leftarrow\text{\sc D.Shinv0}(v) \triangleright Initialize ww to \ell correct places.
2:\ReturnD.Refine(v,h,k,w,)\text{\sc D.Refine}(v,h,k,w,\ell) \triangleright One of D.Refine1,D.Refine2,D.Refine3\text{\sc D.Refine1},\text{\sc D.Refine2},\text{\sc D.Refine3}. \EndFunction\LCommentBelow, gg is the number of guard places and dd is the precision doubling shortfall. \FunctionD.Refine1 v,h,k,w,v,h,k,w,\ell
3:\algorithmicif D.HasCarries \algorithmicthen g1;d1g\leftarrow 1;\;d\leftarrow 1 \algorithmicelse  g0;d0g\leftarrow 0;\;d\leftarrow 0
4:hh+gh\leftarrow h+g
5:wD.shifthk(w)w\leftarrow\mathrm{D}.\operatorname{shift}_{h-k-\ell}(w) \triangleright Scale initial value to full length \Whilehk+1d>h-k+1-d>\ell
6:wD.Step(h,v,w,0,)w\leftarrow\text{\sc D.Step}(h,v,w,0,\ell)
7:min(2d,hk+1d)\ell\leftarrow\min(2\ell-d,h-k+1-d) \triangleright Number of accurate digits \EndWhile
8:\Returnww \EndFunction\FunctionD.Refine2 v,h,k,w,v,h,k,w,\ell
9:\algorithmicif D.HasCarries \algorithmicthen g2;d1g\leftarrow 2;\;d\leftarrow 1 \algorithmicelse  g0;d0g\leftarrow 0;\;d\leftarrow 0
10:wD.shiftgww\leftarrow\mathrm{D}.\operatorname{shift}_{g}w \Whilehk+1d>h-k+1-d>\ell
11:mmin(hk+1,)m\leftarrow\min(h-k+1-\ell,\ell) \triangleright How much to grow
12:wD.shiftdD.Step(k++m+d1+g,v,w,m,g)w\leftarrow\mathrm{D}.\operatorname{shift}_{-d}\;\text{\sc D.Step}\big{(}k+\ell+m+d-1+g,\;v,\;w\;,m,\;\ell-g\big{)}
13:+md\ell\leftarrow\ell+m-d \EndWhile
14:\Returnww \EndFunction\FunctionD.Refine3v,h,k,w,v,h,k,w,\ell
15:\algorithmicif D.HasCarries \algorithmicthen g2;d1g\leftarrow 2;\;d\leftarrow 1 \algorithmicelse  g0;d0g\leftarrow 0;\;d\leftarrow 0
16:wD.shiftgww\leftarrow\text{\sc D}.\operatorname{shift}_{g}w \Whilehk+1d>h-k+1-d>\ell
17:mmin(hk+1,)m\leftarrow\min(h-k+1-\ell,\,\ell)
18:smax(0,k2+1g)s\leftarrow\max(0,\;k-2\ell+1-g)
19:wD.shiftd(D.Step(k++ms1+d+g,D.shiftsv,w,m,g))w\leftarrow\text{\sc D}.\operatorname{shift}_{-d}\big{(}\text{\sc D.Step}\big{(}k+\ell+m-s-1+d+g,\,\text{\sc D}.\operatorname{shift}_{-s}v,\,w,\,m,\,\ell-g\big{)}\big{)}
20:+md\ell\leftarrow\ell+m-d \EndWhile
21:\ReturnD.shiftg(w)\text{\sc D}.\operatorname{shift}_{-g}(w) \EndFunction\FunctionD.Steph,v,w,m,h,v,w,m,\ell
22:D.shiftmw+D.shift2mhMult(w,D.PowDiff(v,w,hm,))\text{\sc D}.\operatorname{shift}_{m}w\;\;+\text{\sc D}.\operatorname{shift}_{2m-h}\text{\sc Mult}\big{(}w,\text{\sc D.PowDiff}(v,w,h-m,\ell)\big{)} \EndFunction\LCommentCompute D.shifth1vw\mathrm{D}.\operatorname{shift}_{h}1-vw efficiently. \FunctionD.PowDiffv,w,h,v,w,h,\ell
23:c\algorithmicifD.HasCarriesc\leftarrow\algorithmicif\ \text{\sc D.HasCarries} \algorithmicthen 1 \algorithmicelse 0
24:LD.precv+D.precw+cL\leftarrow\text{\sc D}.\operatorname{prec}v+\text{\sc D}.\operatorname{prec}w\;-\ell+c \triangleright cc for coeff to peek \Ifv=0w=0Lhv=0\vee w=0\vee L\geq h
25:\ReturnD.shifth1D.Mult(v,w)\text{\sc D}.\operatorname{shift}_{h}1-\text{\sc D.Mult}(v,w) \Else
26:PD.MultMod(v,w,L)P\leftarrow\text{\sc D.MultMod}(v,w,L) \IfD.HasCarriesD.coeff(P,L1)0\text{\sc D.HasCarries}\wedge\text{\sc D}.\text{coeff}(P,L-1)\neq 0 \ReturnD.shiftL1P\text{\sc D}.\operatorname{shift}_{L}1-P \Else \ReturnP-P \EndIf\EndIf\EndFunction
\Require
\Ensure
\Function
\LComment

5 Non-Commutative Polynomial Example

We give an example of computing left and right quotients via the whole shifted inverse with R[x]=F72×2[x]R[x]={F_{7}}^{2\times 2}[x] using the algorithms of Sections 3 and 4. Note that R[x]R[x] is not a domain—there may be zero divisors, but it is easy enough to check for them. This example, and the one in Section 7, were produced using the Domains package in Maple [5]. The setup to use the Domains package for this example is

      with(Domains);
      F     := GaloisField(7);
      F2x2  := SquareMatrix(2, F);
      PF2x2 := DenseUnivariatePolynomial(F2x2, x);

We start with

u\displaystyle u =[4661]x5+[2201]x4+[2113]x3+[2041]x2+[3354]x+[4512],\displaystyle=\left[\begin{array}[]{cc}4&6\\ 6&1\end{array}\right]x^{5}+\left[\begin{array}[]{cc}2&2\\ 0&1\end{array}\right]x^{4}+\left[\begin{array}[]{cc}2&1\\ 1&3\end{array}\right]x^{3}+\left[\begin{array}[]{cc}2&0\\ 4&1\end{array}\right]x^{2}+\left[\begin{array}[]{cc}3&3\\ 5&4\end{array}\right]x+\left[\begin{array}[]{cc}4&5\\ 1&2\end{array}\right],
v\displaystyle v =[4345]x2+[5304]x+[1261].\displaystyle=\left[\begin{array}[]{cc}4&3\\ 4&5\end{array}\right]x^{2}+\left[\begin{array}[]{cc}5&3\\ 0&4\end{array}\right]x+\left[\begin{array}[]{cc}1&2\\ 6&1\end{array}\right].

The whole 5-shifted inverse of vv is then

shinv5v=[5434]x3+[6041]x2+[1022]x+[5163].\operatorname{shinv}_{5}v=\left[\begin{array}[]{cc}5&4\\ 3&4\end{array}\right]x^{3}+\left[\begin{array}[]{cc}6&0\\ 4&1\end{array}\right]x^{2}+\left[\begin{array}[]{cc}1&0\\ 2&2\end{array}\right]x+\left[\begin{array}[]{cc}5&1\\ 6&3\end{array}\right].

From this, the left and right quotients and remainders are computed to be

ql\displaystyle q_{\text{\sc l}} =[2611]x3+[6100]x2+[2033]x+[3100],\displaystyle=\left[\begin{array}[]{cc}2&6\\ 1&1\end{array}\right]x^{3}+\left[\begin{array}[]{cc}6&1\\ 0&0\end{array}\right]x^{2}+\left[\begin{array}[]{cc}2&0\\ 3&3\end{array}\right]x+\left[\begin{array}[]{cc}3&1\\ 0&0\end{array}\right], rl\displaystyle r_{\text{\sc l}} =[1641]x+[1443],\displaystyle=\left[\begin{array}[]{cc}1&6\\ 4&1\end{array}\right]x+\left[\begin{array}[]{cc}1&4\\ 4&3\end{array}\right],
qr\displaystyle q_{\text{\sc r}} =[3550]x3+[1115]x2+[0555]x+[4026],\displaystyle=\left[\begin{array}[]{cc}3&5\\ 5&0\end{array}\right]x^{3}+\left[\begin{array}[]{cc}1&1\\ 1&5\end{array}\right]x^{2}+\left[\begin{array}[]{cc}0&5\\ 5&5\end{array}\right]x+\left[\begin{array}[]{cc}4&0\\ 2&6\end{array}\right], rr\displaystyle r_{\text{\sc r}} =[2021]x+[0456].\displaystyle=\left[\begin{array}[]{cc}2&0\\ 2&1\end{array}\right]x+\left[\begin{array}[]{cc}0&4\\ 5&6\end{array}\right].

Taking a larger example where uu has degree 100 and vv degree 10, D.Refine1 computes shinv100v\operatorname{shinv}_{100}v with one guard digit in 6 steps with intermediate values of ww all of prec\operatorname{prec} 92. Methods D.Refine2 and D.Refine3 compute the same result also in 6 steps but with values of ww have prec\operatorname{prec} 4, 8, 16, 32, 64, 92 successively. Method D.Refine3 uses a shorter prefix of vv on the first iteration (s=3s=3). The Maple code used for this example is given in Figure 1.

6 Division in R[x;σ,δ]R[x;\sigma,\delta]

We now examine the more general case where the polynomial variable does not commute with coefficients. For quotients and remainders to be defined, a notion of degree is required and we note that this leads immediately to Ore extensions, or skew polynomials. After touching upon classical algorithms, we introduce the notions of left and right whole shifted inverse. We note that the modified Newton-Schulz iteration may be used to compute whole shifted inverses, though in this case there is no benefit over classical division. Finally, we show how left and right whole shifted inverses may be used to compute right and left quotients, each with only one multiplication.

6.1 Definitions and Classical Algorithms

Consider a ring of objects with elements from a ring RR extended by xx, with xx not necessarily commuting with elements of RR. By distributivity, any finite expression in this extended ring is equal to a sum of monomials, the monomials composed of products of elements of RR and xx. To have a well-defined degree compatible with that of usual polynomials, it is required that

rRa,b,c,dR s.t. xrrx=ax+b=xc+d.\forall\,r\in R\;\exists\,a,b,c,d\in R\;\text{ s.t. }\;xr-rx=ax+b=xc+d. (17)

We call the elements of such a ring skew polynomials. Condition (17) implies that for all rRr\in R there exist σ(r),δ(r)R\sigma(r),\delta(r)\in R such that

xr=σ(r)x+δ(r).x\,r=\sigma(r)\,x+\delta(r). (18)

Therefore, to have well-defined notion of degree, the ring must be an Ore extension, R[x;δ,σ]R[x;\delta,\sigma]. Ore studied these non-commutative polynomials almost a century ago [6] and overviews of Ore extensions in computer algebra are given in [1, 2]. The subject is viewed from a linear algebra perspective in [3] and the complexity of skew arithmetic is studied in [9]. The ring axioms of R[x;σ,δ]R[x;\sigma,\delta] imply that σ\sigma be an endomorphism on RR and δ\delta be a σ\sigma-derivation, i.e. for all r,sRr,s\in R

δ(r+s)\displaystyle\delta(r+s) =δ(r)+δ(s)\displaystyle=\delta(r)+\delta(s) δ(rs)\displaystyle\delta(r\cdot s) =σ(r)δ(s)+δ(r)s.\displaystyle=\sigma(r)\cdot\delta(s)+\delta(r)\cdot s.

Different choices of σ\sigma and δ\delta allow skew polynomials to represent linear differential operators, linear difference operators, qq-generalizations of these and other algebraic systems.

Condition (18) implies that it is possible to write any skew polynomial as a sum of monomials with all the powers of xx on the right or all on the left. We will use the notation uiu_{i} for coefficients of skew polynomials with all powers of the variable on the right and ui\,{}_{i}u for coefficients with all powers of the variable on the left, e.g.

u=i=0huixi=i=0hxiui.u=\sum_{i=0}^{h}u_{i}x^{i}=\sum_{i=0}^{h}x^{i}\,{}_{i}u.

Algorithm 4 gives left and right classical division in R[x;σ,δ]R[x;\sigma,\delta]. As in Section 3, ×π\times_{\pi} is multiplication with arguments permuted by π\pi. When σ(r)=r\sigma(r)=r, R[x;σ,δ]R[x;\sigma,\delta] is a differential ring, usually denoted R[x,δ]R[x,\delta], and Algorithm 4 specializes to Algorithm 1. The left division algorithm applies only when σ\sigma is bijective. If left division is of primary interest, start from rx=xσ(r)+δ(r)rx=x\sigma^{*}(r)+\delta^{*}(r) instead of (18) and work in the adjoint ring R[x;σ,δ]R[x;\sigma^{*},\delta^{*}].

Algorithm 4 Classical division for R[x;σ,δ]R[x;\sigma,\delta] with invertible vkv_{k}
Compute qqand rrfrom uuof degree hhand vvof degree kksuch that u=q×πv+r.u=q\times_{\pi}v+r.
The left division algorithm applies when σ\sigmais bijective. skewdivu,vR[x;σ,δ],πS2,qcoeffu,v\in R[x;\sigma,\delta],\pi\in S_{2},\text{\sc qcoeff}
1:vinvvkv^{*}\leftarrow\mathrm{inv}~{}v_{k}
2:q0q\leftarrow 0; rur\leftarrow u \Forihki\leftarrow h-k to 0 by 1-1
3:tqcoeff(ri+k,v,i,k)×xit\leftarrow\text{\sc qcoeff}(r_{i+k},v^{*},i,k)\times x^{i}
4:qq+tq\leftarrow q+t ; rrt×πvr\leftarrow r-t\times_{\pi}v \EndFor
5:\Return(q, r) \EndFunction\LCommentLeft division:   (ql,rl)lskewdiv(u,v)u=v×ql+rl(q_{\text{\sc l}},r_{\text{\sc l}})\leftarrow\text{\sc lskewdiv}(u,v)\Rightarrow u=v\times q_{\text{\sc l}}+r_{\text{\sc l}}
6:lskewdiv(u,v)skewdiv(u,v,(2 1),(a,b,n,k)σk(b×a))\text{\sc lskewdiv}(u,v)\mapsto\text{\sc skewdiv}\big{(}u,\,v,\,(2\,1),\;(a,b,n,k)\mapsto\sigma^{-k}(b\times a)\big{)} \LCommentRight division: (qr,rr)rskewdiv(u,v)u=qr×v+rr(q_{\text{\sc r}},r_{\text{\sc r}})\leftarrow\text{\sc rskewdiv}(u,v)\Rightarrow u=q_{\text{\sc r}}\times v+r_{\text{\sc r}}
7:rskewdiv(u,v)skewdiv(u,v,(1 2),(a,b,n,k)a×σn(b))\text{\sc rskewdiv}(u,v)\mapsto\text{\sc skewdiv}\big{(}u,\,v,\,(1\,2),\;(a,b,n,k)\mapsto a\times\sigma^{n}(b)\big{)}
\LComment
\Function

Some care is needed in Algorithm 4 to avoid duplicating computation. Notice that for rskewdiv the application of qcoeff on line 3 requires nn-fold application of σ\sigma to invvk\operatorname{inv}v_{k} and that the computation of t×πvt\times_{\pi}v on line 4 is coeff(t)xi+k×v\text{coeff}(t)\,x^{i+k}\times v. The latter requires commuting hkh-k powers of xx across vv over the course of the division. Depending on the cost to compute σ\sigma, it may be useful to create an array of the values σi(invvk)\sigma^{i}(\operatorname{inv}v_{k}) for ii from 0 to hkh-k. It is also possible to pre-compute and store the products xi×vx^{i}\times v, with xi+1×vx^{i+1}\times v obtained from xi×vx^{i}\times v by one application of (18). Then the xi×vx^{i}\times v may be used in descending order in the for loop without re-computation. Both of these pre-computations are performed in the Maple program for P[RDiv] shown in Figure 4.

6.2 Whole Shift and Inverse in R[x;σ,δ]R[x;\sigma,\delta]

It is possible to define left and right analogs of the whole shift and whole shifted inverse for skew polynomials. In general, the left and right operations give different values.

Definition 3 (Left and right whole nn-shift in R[x;σ,δ]R[x;\sigma,\delta])

 
Given u=R[x;σ,δ]u=\in R[x;\sigma,\delta] and nn\in\mathbb{Z}, the left whole nn-shift of uu is

lshiftn,xu=i+n0xi+nui,\operatorname{lshift}_{n,x}u=\sum_{i+n\geq 0}x^{i+n}\,{}_{i}u,

the right whole nn-shift of uu is

rshiftn,xu=i+n0uixi+n\operatorname{rshift}_{n,x}u=\sum_{i+n\geq 0}u_{i}x^{i+n}

When xx is clear by context, we write lshiftnu\operatorname{lshift}_{n}u and rshiftnu\operatorname{rshift}_{n}u.

Definition 4 (Left and right whole nn-shifted inverse in R[x;σ,δ]R[x;\sigma,\delta])

 
Given n0n\in\mathbb{Z}_{\geq 0} and vR[x;σ,δ]v\in R[x;\sigma,\delta], the left whole nn-shifted inverse of vv with respect to xx is

lshinvn,xv=xnlquov\operatorname{lshinv}_{n,x}v=x^{n}\operatorname{lquo}v

the right whole nn-shifted inverse of vv with respect to xx is

rshinvn,xv=xnrquov\operatorname{rshinv}_{n,x}v=x^{n}\operatorname{rquo}v

When xx is clear by context, we write lshinvnv\operatorname{lshinv}_{n}v and rshinvnv\operatorname{rshinv}_{n}v.

Modified Newton-Schulz Iteration

For monic vR[x;σ,δ]v\in R[x;\sigma,\delta], the whole shifted inverses may be computed using modified Newton-Schulz iterations with g=1g=1 guard places as follows:

wl(0)\displaystyle{w_{\text{\sc l}}}_{(0)} =wr(0)=xhk+gvk1xhk1+g\displaystyle={w_{\text{\sc r}}}_{(0)}=x^{h-k+g}-v_{k-1}x^{h-k-1+g} (19)
wl(i+1)\displaystyle{w_{\text{\sc l}}}_{(i+1)} =wl(i)+rshifth(wl(i)×(rshifth1v×wl(i))),\displaystyle={w_{\text{\sc l}}}_{(i)}+\operatorname{rshift}_{-h}\big{(}{w_{\text{\sc l}}}_{(i)}\times(\operatorname{rshift}_{h}1-v\times{w_{\text{\sc l}}}_{(i)})\big{)},
wr(i+1)\displaystyle{w_{\text{\sc r}}}_{(i+1)} =wr(i)+lshifth((lshifth1wr(i)×v)×wr(i)),\displaystyle={w_{\text{\sc r}}}_{(i)}+\,\operatorname{lshift}_{-h}\big{(}(\operatorname{lshift}_{h}1-{w_{\text{\sc r}}}_{(i)}\times v)\times{w_{\text{\sc r}}}_{(i)}\big{)},
rshiftgwl(i)lshinvhv\displaystyle\operatorname{rshift}_{-g}{w_{\text{\sc l}}}_{(i)}\rightarrow\operatorname{lshinv}_{h}v
lshiftgwr(i)rshinvhv.\displaystyle\operatorname{lshift}_{-g}{w_{\text{\sc r}}}_{(i)}\rightarrow\operatorname{rshinv}_{h}v.

These generalize D.Refine1 in Algorithm 3. For D.Refine2 and D.Refine3, the shifts that reduce the size of intermediate expressions are combined into one pre- and one post-shift in R[x]R[x]. But on R[x;σ,δ]R[x;\sigma,\delta] we do not expect these simplifications of shift expressions to be legitimate.

Even though (19) can be used to compute whole shifted inverses, it does not give any benefit over classical division. In the special case of R[x,δ]R[x,\delta], the multiplication by vv and then by ww make it so each iteration creates only one correct term, so hkh-k iterations are required rather than log2(hk)\log_{2}(h-k). In other skew polynomial rings, e.g. linear difference operators, the iteration (19) can still converge, but with multiple iterations required for each degree of the quotient. It is therefore simpler to compute lshinv\operatorname{lshinv} and rshinv\operatorname{rshinv} by classical division.

6.3 Quotients from Whole Shifted Inverses in R[x;σ,δ]R[x;\sigma,\delta]

It is possible to compute left and right quotients from the right and left whole shifted inverses in R[x;σ,δ]R[x;\sigma,\delta]. Although computing whole shifted inverses is not asymptotically fast as it is in R[x]R[x], once a whole shifted inverse is obtained it can be used to compute multiple quotients and hence remainders, each requiring only one multiplication. This is useful, e.g., when working with differential ideals. In some cases this multiplication of skew polynomials is asymptotically fast [8].

Theorem 7 (Quotients from whole shifted inverses in R[x;σ,δ]R[x;\sigma,\delta])

Let u,vR[x;σ,δ]u,v\in R[x;\sigma,\delta], with RR a ring, k=degreevk=\operatorname{degree}v, h=degreeuh=\operatorname{degree}u, and vkv_{k} invertible in RR. Then

urquov\displaystyle u\operatorname{rquo}v =rshifth(u×lshinvhv)\displaystyle=\operatorname{rshift}_{-h}(u\times\operatorname{lshinv}_{h}v) (20)
ulquov\displaystyle u\operatorname{lquo}v =lshifth(rshinvhv×u).\displaystyle=\operatorname{lshift}_{-h}(\operatorname{rshinv}_{h}v\times u). (21)
  • Proof. We first prove (20). For hkh\geq k, we proceed by induction on hkh-k. Suppose hk=0h-k=0. Since u(uh×1/vk)×vu-(u_{h}\times 1/v_{k})\times v has no term of degree hh, we have

    urquov=uh×1/vk.u\operatorname{rquo}v=u_{h}\times 1/v_{k}.

    On the other hand, when h=kh=k, lshinvhv=1/vk\operatorname{lshinv}_{h}v=1/v_{k} so

    rshifth(u×lshinvhv)=uh×1/vk\operatorname{rshift}_{-h}(u\times\operatorname{lshinv}_{h}v)=u_{h}\times 1/v_{k}

    and (20) holds. For the inductive step, we assume that (20) holds for hk<Nh-k<N. For hk=Nh-k=N, let u=q×v+o(xk)u=q\times v+o(x^{k}) and let QQ, q^\hat{q} and u^\hat{u} be given by

    u\displaystyle u =(Qxhk+q^)×v+r,QR,q^o(xhk),ro(xk),\displaystyle=(Qx^{h-k}+\hat{q})\times v+r,\quad\quad Q\in R,\;\;\hat{q}\in o(x^{h-k}),\;\;r\in o(x^{k}),
    u^\displaystyle\hat{u} =uQxhk×v.\displaystyle=u-Qx^{h-k}\times v.

    With this, u^\hat{u} has degree at most h1h-1. The inductive hypothesis gives u^rquov=rshifth(u^×lshinvhv).\hat{u}\operatorname{rquo}v=\operatorname{rshift}_{-h}(\hat{u}\times\operatorname{lshinv}_{h}v). Therefore,

    u^=uQxhk×v\displaystyle\hat{u}=u-Qx^{h-k}\times v =(u^rquov)×v+r^,r^o(xk)\displaystyle=(\hat{u}\operatorname{rquo}v)\times v+\hat{r},\quad\hat{r}\in o(x^{k})
    =rshifth(u^×lshinvhv)×v+r^\displaystyle=\operatorname{rshift}_{-h}(\hat{u}\times\operatorname{lshinv}_{h}v)\times v+\hat{r}
    u\displaystyle\Rightarrow\quad u =(rshifth(u^×lshinvhv)+Qxhk)×v+r^\displaystyle=\big{(}\operatorname{rshift}_{-h}(\hat{u}\times\operatorname{lshinv}_{h}v)+Qx^{h-k}\big{)}\times v+\hat{r}
    =rshifth(u^×lshinvhv+Qx2hk)×v+r^.\displaystyle=\operatorname{rshift}_{-h}(\hat{u}\times\operatorname{lshinv}_{h}v+Qx^{2h-k})\times v+\hat{r}.

    From this, we have

    urquov\displaystyle u\operatorname{rquo}v =rshifth(u^×lshinvhv+Qx2hk)\displaystyle=\operatorname{rshift}_{-h}(\hat{u}\times\operatorname{lshinv}_{h}v+Qx^{2h-k})
    =rshifth((uQxhk×v)×lshinvhv+Qx2hk)\displaystyle=\operatorname{rshift}_{-h}\big{(}(u-Qx^{h-k}\times v)\times\operatorname{lshinv}_{h}v+Qx^{2h-k}\big{)}
    =rshifth(u×lshinvhvQxhk×v×lshinvhv+Qx2hk)\displaystyle=\operatorname{rshift}_{-h}\big{(}u\times\operatorname{lshinv}_{h}v-Qx^{h-k}\times v\times\operatorname{lshinv}_{h}v+Qx^{2h-k}\big{)}
    =rshifth(u×lshinvhvQxhk×v×(xhlquov)+Qx2hk)\displaystyle=\operatorname{rshift}_{-h}\big{(}u\times\operatorname{lshinv}_{h}v-Qx^{h-k}\times v\times(x^{h}\operatorname{lquo}v)+Qx^{2h-k}\big{)}
    =rshifth(u×lshinvhvQxhk×(xh+o(xk))+Qx2hk)\displaystyle=\operatorname{rshift}_{-h}\big{(}u\times\operatorname{lshinv}_{h}v-Qx^{h-k}\times(x^{h}+o(x^{k}))+Qx^{2h-k}\big{)}
    =rshifth(u×lshinvhv+Q×o(xh))=rshifth(u×lshinvhv).\displaystyle=\operatorname{rshift}_{-h}\big{(}u\times\operatorname{lshinv}_{h}v+Q\times o(x^{h})\big{)}=\operatorname{rshift}_{-h}(u\times\operatorname{lshinv}_{h}v).

    This completes the inductive step and the proof of (20). Equation (21) is proven as above, mutatis mutandis. \square

As in the commutative case, it may be more efficient to compute only the required top part of the product in (20) and (21) rather than to compute the whole product and then shift by h-h.

7 Skew Polynomial Examples

7.1 Differential Operators

We take F7[y,y]F_{7}[y,\partial_{y}] as a first example of using whole shifted inverses to compute quotients of skew polynomials. We use Algorithm 4 to compute the left and right whole shifted inverses, and then Theorem 7 to obtain the quotients. We start with uu and vv

u\displaystyle u =(3y+6)y5+(3y+1)y4+6yy3+4yy2+(2y+1)y+(2y+5)\displaystyle=(3y+6)\partial_{y}^{5}+(3y+1)\partial_{y}^{4}+6y\partial_{y}^{3}+4y\partial_{y}^{2}+(2y+1)\partial_{y}+(2y+5)
v\displaystyle v =4y2+(2y+5)y+(4y+6).\displaystyle=4\partial_{y}^{2}+(2y+5)\partial_{y}+(4y+6).

The whole shifted inverses lshinv5v=y5lquov\operatorname{lshinv}_{5}v=\partial_{y}^{5}\operatorname{lquo}v and rshinv5=y5rquov\operatorname{rshinv}_{5}=\partial_{y}^{5}\operatorname{rquo}v are computed by Algorithm 4.

lshinv5\displaystyle\operatorname{lshinv}_{5} =2y3+(6y+1)y2+(4y2+4y+3)y+(5y3+y2+3y+2)\displaystyle=2\partial_{y}^{3}+(6y+1)\partial_{y}^{2}+(4y^{2}+4y+3)\partial_{y}+(5y^{3}+y^{2}+3y+2)
rshinv5\displaystyle\operatorname{rshinv}_{5} =2y3+(6y+1)y2+(4y2+4y+5)y+(5y3+y2+y+1).\displaystyle=2\partial_{y}^{3}+(6y+1)\partial_{y}^{2}+(4y^{2}+4y+5)\partial_{y}+(5y^{3}+y^{2}+y+1).

Then ql=lshift5(rshinv5v×u)q_{\text{\sc l}}=\operatorname{lshift}_{-5}(\operatorname{rshinv}_{5}v\times u) and qr=rshift5(u×lshinv5v)q_{\text{\sc r}}=\operatorname{rshift}_{-5}(u\times\operatorname{lshinv}_{5}v) so

ql\displaystyle q_{\text{\sc l}} =(6y+5)y3+(4y2+3y+3)y2+(5y3+5y2+5)y\displaystyle=(6y+5)\partial_{y}^{3}+(4y^{2}+3y+3)\partial_{y}^{2}+(5y^{3}+5y^{2}+5)\partial_{y}
+(y4+3y3+5y2+5y+2)\displaystyle+(y^{4}+3y^{3}+5y^{2}+5y+2)
rl\displaystyle r_{\text{\sc l}} =(5y5+4y4+3y3+6y2+4y)y+(3y5+2y4+y3+5y2+5)\displaystyle=(5y^{5}+4y^{4}+3y^{3}+6y^{2}+4y)\partial_{y}+(3y^{5}+2y^{4}+y^{3}+5y^{2}+5)
qr\displaystyle q_{\text{\sc r}} =(6y+5)y3+(4y2+3y+1)y2+(5y3+5y2+4y+3)y\displaystyle=(6y+5)\partial_{y}^{3}+(4y^{2}+3y+1)\partial_{y}^{2}+(5y^{3}+5y^{2}+4y+3)\partial_{y}
+(y4+3y3+5y2+3y+5)\displaystyle+(y^{4}+3y^{3}+5y^{2}+3y+5)
rr\displaystyle r_{\text{\sc r}} =(5y5+4y4+6y3)y+(3y5+3y4+5y3+y2+4y+5).\displaystyle=(5y^{5}+4y^{4}+6y^{3})\partial_{y}+(3y^{5}+3y^{4}+5y^{3}+y^{2}+4y+5).

A proof-of-concept Maple implementation for generic skew polynomials is given in Figure 4. The program is to clarify any ambiguities without any serious attention to efficiency. The setup for the above example is

    with(Domains):
    LinearOrdinaryDifferentialOperator :=
        (R, x) -> SkewPolynomial(R, x, r->r, R[Diff], r->r):

    F    := GaloisField(7):
    R    := DenseUnivariatePolynomial(F, ’y’):
    Lodo := LinearOrdinaryDifferentialOperator(R, ’D[y]’):

7.2 Difference Operators

We use linear ordinary difference operators as a second example, this time with σ\sigma not being the identity. We construct F7[y,Δy]F_{7}[y,\Delta_{y}] as F7[y][Δy;E,E1]F_{7}[y][\Delta_{y};E,E-1]. As before, we use Algorithm 4 to compute the left and right whole shifted inverses, and then Theorem 7 to obtain the quotients. We take uu and vv to be

u\displaystyle u =yΔy5+(3y+6)Δy4+(6y+5)Δy3+3yΔy2+(2y+1)Δy+5y\displaystyle=y\Delta_{y}^{5}+(3y+6)\Delta_{y}^{4}+(6y+5)\Delta_{y}^{3}+3y\Delta_{y}^{2}+(2y+1)\Delta_{y}+5y
v\displaystyle v =4Δy2+(6y+1)Δy+(6y+6).\displaystyle=4\Delta_{y}^{2}+(6y+1)\Delta_{y}+(6y+6).

The whole shifted inverses lshinv5v=Δy5lquov\operatorname{lshinv}_{5}v=\Delta_{y}^{5}\operatorname{lquo}v and rshinv5=Δy5rquov\operatorname{rshinv}_{5}=\Delta_{y}^{5}\operatorname{rquo}v are computed by Algorithm 4.

lshinv5\displaystyle\operatorname{lshinv}_{5} =2Δy3+(4y+2)Δy2+(y2+4y)Δy+(2y3+6y2+y)\displaystyle=2\Delta_{y}^{3}+(4y+2)\Delta_{y}^{2}+(y^{2}+4y)\Delta_{y}+(2y^{3}+6y^{2}+y)
rshinv5\displaystyle\operatorname{rshinv}_{5} =2Δy3+(4y+1)Δy2+(y2+2)Δy+(2y3+y2+4y+1).\displaystyle=2\Delta_{y}^{3}+(4y+1)\Delta_{y}^{2}+(y^{2}+2)\Delta_{y}+(2y^{3}+y^{2}+4y+1).

Then ql=lshift5(rshinv5v×u)q_{\text{\sc l}}=\operatorname{lshift}_{-5}(\operatorname{rshinv}_{5}v\times u) and qr=rshift5(u×lshinv5v)q_{\text{\sc r}}=\operatorname{rshift}_{-5}(u\times\operatorname{lshinv}_{5}v) so

ql\displaystyle q_{\text{\sc l}} =(2y+3)Δy3+(4y2+3y+4)Δy2+(y3+5y2+6y+4)Δy\displaystyle=(2y+3)\Delta_{y}^{3}+(4y^{2}+3y+4)\Delta_{y}^{2}+(y^{3}+5y^{2}+6y+4)\Delta_{y}
+(2y4+6y3+4y2+4y+4)\displaystyle+(2y^{4}+6y^{3}+4y^{2}+4y+4)
rl\displaystyle r_{\text{\sc l}} =(2y5+6y4+6y2+5y+3)Δy+(2y5+2y4+4y3+2y+1)\displaystyle=(2y^{5}+6y^{4}+6y^{2}+5y+3)\Delta_{y}+(2y^{5}+2y^{4}+4y^{3}+2y+1)
qr\displaystyle q_{\text{\sc r}} =2yΔy3+(4y2+5)Δy2+(y3+5y2+y+6)Δy+(2y4+4y3+5y+1)\displaystyle=2y\Delta_{y}^{3}+(4y^{2}+5)\Delta_{y}^{2}+(y^{3}+5y^{2}+y+6)\Delta_{y}+(2y^{4}+4y^{3}+5y+1)
rr\displaystyle r_{\text{\sc r}} =(2y5+3y4+4y3+y2)Δy+(2y5+6y4+5y3+3y2+5y).\displaystyle=(2y^{5}+3y^{4}+4y^{3}+y^{2})\Delta_{y}+(2y^{5}+6y^{4}+5y^{3}+3y^{2}+5y).

The Maple setup for this example is

    # Delta(f) acts as  subs(y=y+1, f) - f  for f in R
    LinearOrdinaryDifferenceOperator := proc(R, x, C)
        local E := R[ShiftOperator];
        SkewPolynomial(R, x, r->E(r,C[1]), r->R[‘-‘](E(r,C[1]),r),
                             r->E(r,C[‘-‘](C[1])));
    end:

    F    := GaloisField(7);
    R    := DenseUnivariatePolynomial(F, ’y’);
    Lodo := LinearOrdinaryDifferenceOperator(R, ’Delta[y]’, F)

7.3 Difference Operators with Matrix Coefficients

As a final example, we take quotients in F72×2[y,Δy]F_{7}^{2\times 2}[y,\Delta_{y}] to underscore the genericity of this method.

u\displaystyle u =([6011]y+[3020])Δy5+([4465]y+[3244])Δy4+([4303]y+[1141])Δy3\displaystyle=\left(\left[\begin{array}[]{cc}6&0\\ 1&1\end{array}\right]y+\left[\begin{array}[]{cc}3&0\\ 2&0\end{array}\right]\right)\Delta_{y}^{5}+\left(\left[\begin{array}[]{cc}4&4\\ 6&5\end{array}\right]y+\left[\begin{array}[]{cc}3&2\\ 4&4\end{array}\right]\right)\Delta_{y}^{4}+\left(\left[\begin{array}[]{cc}4&3\\ 0&3\end{array}\right]y+\left[\begin{array}[]{cc}1&1\\ 4&1\end{array}\right]\right)\Delta_{y}^{3}
+([0145]y+[3254])Δy2+([0643]y+[0006])Δy+([5362]y+[5212])\displaystyle+\left(\left[\begin{array}[]{cc}0&1\\ 4&5\end{array}\right]y+\left[\begin{array}[]{cc}3&2\\ 5&4\end{array}\right]\right)\Delta_{y}^{2}+\left(\left[\begin{array}[]{cc}0&6\\ 4&3\end{array}\right]y+\left[\begin{array}[]{cc}0&0\\ 0&6\end{array}\right]\right)\Delta_{y}+\left(\left[\begin{array}[]{cc}5&3\\ 6&2\end{array}\right]y+\left[\begin{array}[]{cc}5&2\\ 1&2\end{array}\right]\right)
v\displaystyle v =[1526]Δy2+([1500]y+[4634])Δy+([2604]y+[0312])\displaystyle=\rule{0.0pt}{21.52771pt}\left[\begin{array}[]{cc}1&5\\ 2&6\end{array}\right]\Delta_{y}^{2}+\left(\left[\begin{array}[]{cc}1&5\\ 0&0\end{array}\right]y+\left[\begin{array}[]{cc}4&6\\ 3&4\end{array}\right]\right)\Delta_{y}+\left(\left[\begin{array}[]{cc}2&6\\ 0&4\end{array}\right]y+\left[\begin{array}[]{cc}0&3\\ 1&2\end{array}\right]\right)
lshinv5\displaystyle\operatorname{lshinv}_{5} =[2345]Δy3+([5030]y+[0412])Δy2+([2040]y2+[3101]y+[0244])Δy\displaystyle=\left[\begin{array}[]{cc}2&3\\ 4&5\end{array}\right]\Delta_{y}^{3}+\left(\left[\begin{array}[]{cc}5&0\\ 3&0\end{array}\right]y+\!\left[\begin{array}[]{cc}0&4\\ 1&2\end{array}\right]\right)\Delta_{y}^{2}+\left(\left[\begin{array}[]{cc}2&0\\ 4&0\end{array}\right]y^{2}+\!\left[\begin{array}[]{cc}3&1\\ 0&1\end{array}\right]y+\!\left[\begin{array}[]{cc}0&2\\ 4&4\end{array}\right]\right)\Delta_{y}
+([5030]y3+[4204]y2+[2666]y+[1266])\displaystyle+\left(\left[\begin{array}[]{cc}5&0\\ 3&0\end{array}\right]y^{3}+\left[\begin{array}[]{cc}4&2\\ 0&4\end{array}\right]y^{2}+\left[\begin{array}[]{cc}2&6\\ 6&6\end{array}\right]y+\left[\begin{array}[]{cc}1&2\\ 6&6\end{array}\right]\right)
rshinv5\displaystyle\operatorname{rshinv}_{5} =[2345]Δy3+([5030]y+[4422])Δy2+([2040]y2+[2151]y+[6002])Δy\displaystyle=\left[\begin{array}[]{cc}2&3\\ 4&5\end{array}\right]\Delta_{y}^{3}+\left(\left[\begin{array}[]{cc}5&0\\ 3&0\end{array}\right]y+\!\left[\begin{array}[]{cc}4&4\\ 2&2\end{array}\right]\right)\Delta_{y}^{2}+\left(\left[\begin{array}[]{cc}2&0\\ 4&0\end{array}\right]y^{2}+\!\left[\begin{array}[]{cc}2&1\\ 5&1\end{array}\right]y+\!\left[\begin{array}[]{cc}6&0\\ 0&2\end{array}\right]\right)\Delta_{y}
+([5030]y3+[2234]y2+[3554]y+[1331])\displaystyle+\left(\left[\begin{array}[]{cc}5&0\\ 3&0\end{array}\right]y^{3}+\left[\begin{array}[]{cc}2&2\\ 3&4\end{array}\right]y^{2}+\left[\begin{array}[]{cc}3&5\\ 5&4\end{array}\right]y+\left[\begin{array}[]{cc}1&3\\ 3&1\end{array}\right]\right)
ql\displaystyle q_{\text{\sc l}} =([1315]y+[3164])Δy3+([2040]y2++[4621]y+[2150])Δy2\displaystyle=\left(\left[\begin{array}[]{cc}1&3\\ 1&5\end{array}\right]y+\left[\begin{array}[]{cc}3&1\\ 6&4\end{array}\right]\right)\Delta_{y}^{3}+\left(\left[\begin{array}[]{cc}2&0\\ 4&0\end{array}\right]y^{2}++\left[\begin{array}[]{cc}4&6\\ 2&1\end{array}\right]y+\left[\begin{array}[]{cc}2&1\\ 5&0\end{array}\right]\right)\Delta_{y}^{2}
+([5030]y3+[4066]y2+[2454]y+[0561])Δy\displaystyle+\left(\left[\begin{array}[]{cc}5&0\\ 3&0\end{array}\right]y^{3}+\left[\begin{array}[]{cc}4&0\\ 6&6\end{array}\right]y^{2}+\left[\begin{array}[]{cc}2&4\\ 5&4\end{array}\right]y+\left[\begin{array}[]{cc}0&5\\ 6&1\end{array}\right]\right)\Delta_{y}
+([2040]y4+[4326]y3+[1050]y2+[4315]y+[5616])\displaystyle+\left(\left[\begin{array}[]{cc}2&0\\ 4&0\end{array}\right]y^{4}+\left[\begin{array}[]{cc}4&3\\ 2&6\end{array}\right]y^{3}+\left[\begin{array}[]{cc}1&0\\ 5&0\end{array}\right]y^{2}+\left[\begin{array}[]{cc}4&3\\ 1&5\end{array}\right]y+\left[\begin{array}[]{cc}5&6\\ 1&6\end{array}\right]\right)
rl\displaystyle r_{\text{\sc l}} =([6000]y5+[6210]y4+[6646]y3+[2236]y2+[2460]y+[6520])Δy\displaystyle=\left(\left[\begin{array}[]{cc}6&0\\ 0&0\end{array}\right]y^{5}+\left[\begin{array}[]{cc}6&2\\ 1&0\end{array}\right]y^{4}+\left[\begin{array}[]{cc}6&6\\ 4&6\end{array}\right]y^{3}+\left[\begin{array}[]{cc}2&2\\ 3&6\end{array}\right]y^{2}+\left[\begin{array}[]{cc}2&4\\ 6&0\end{array}\right]y+\left[\begin{array}[]{cc}6&5\\ 2&0\end{array}\right]\right)\Delta_{y}
+([0050]y5+[6034]y4+[3236]y3+[5130]y2+[3646]y+[2426])\displaystyle+\left(\left[\begin{array}[]{cc}0&0\\ 5&0\end{array}\right]y^{5}+\left[\begin{array}[]{cc}6&0\\ 3&4\end{array}\right]y^{4}+\left[\begin{array}[]{cc}3&2\\ 3&6\end{array}\right]y^{3}+\left[\begin{array}[]{cc}5&1\\ 3&0\end{array}\right]y^{2}+\left[\begin{array}[]{cc}3&6\\ 4&6\end{array}\right]y+\left[\begin{array}[]{cc}2&4\\ 2&6\end{array}\right]\right)
qr\displaystyle q_{\text{\sc r}} =([5461]y+[6246])Δy3+([2010]y2+[0060]y+[5345])Δy2\displaystyle=\left(\left[\begin{array}[]{cc}5&4\\ 6&1\end{array}\right]y+\left[\begin{array}[]{cc}6&2\\ 4&6\end{array}\right]\right)\Delta_{y}^{3}+\left(\left[\begin{array}[]{cc}2&0\\ 1&0\end{array}\right]y^{2}+\left[\begin{array}[]{cc}0&0\\ 6&0\end{array}\right]y+\left[\begin{array}[]{cc}5&3\\ 4&5\end{array}\right]\right)\Delta_{y}^{2}
+([5060]y3+[1602]y2+[5514]y+[5326])Δy\displaystyle+\left(\left[\begin{array}[]{cc}5&0\\ 6&0\end{array}\right]y^{3}+\left[\begin{array}[]{cc}1&6\\ 0&2\end{array}\right]y^{2}+\left[\begin{array}[]{cc}5&5\\ 1&4\end{array}\right]y+\left[\begin{array}[]{cc}5&3\\ 2&6\end{array}\right]\right)\Delta_{y}
+([2010]y4+[2556]y3+[5243]y2+[2211]y+[2523])\displaystyle+\left(\left[\begin{array}[]{cc}2&0\\ 1&0\end{array}\right]y^{4}+\left[\begin{array}[]{cc}2&5\\ 5&6\end{array}\right]y^{3}+\left[\begin{array}[]{cc}5&2\\ 4&3\end{array}\right]y^{2}+\left[\begin{array}[]{cc}2&2\\ 1&1\end{array}\right]y+\left[\begin{array}[]{cc}2&5\\ 2&3\end{array}\right]\right)
rr\displaystyle r_{\text{\sc r}} =([5462]y5+[1403]y4+[4432]y3+[1314]y2+[3225]y+[2645])Δy\displaystyle=\left(\left[\begin{array}[]{cc}5&4\\ 6&2\end{array}\right]y^{5}+\left[\begin{array}[]{cc}1&4\\ 0&3\end{array}\right]y^{4}+\left[\begin{array}[]{cc}4&4\\ 3&2\end{array}\right]y^{3}+\left[\begin{array}[]{cc}1&3\\ 1&4\end{array}\right]y^{2}+\left[\begin{array}[]{cc}3&2\\ 2&5\end{array}\right]y+\left[\begin{array}[]{cc}2&6\\ 4&5\end{array}\right]\right)\Delta_{y}
+([3251]y5+[3446]y4+[3026]y3+[6126]y2+[3260]y+[4013])\displaystyle+\left(\left[\begin{array}[]{cc}3&2\\ 5&1\end{array}\right]y^{5}+\left[\begin{array}[]{cc}3&4\\ 4&6\end{array}\right]y^{4}+\left[\begin{array}[]{cc}3&0\\ 2&6\end{array}\right]y^{3}+\left[\begin{array}[]{cc}6&1\\ 2&6\end{array}\right]y^{2}+\left[\begin{array}[]{cc}3&2\\ 6&0\end{array}\right]y+\left[\begin{array}[]{cc}4&0\\ 1&3\end{array}\right]\right)

The Maple setup for this example is the same as for the previous example but with F := SquareMatrix(2, GaloisField(7)).

8 Conclusions

We have extended earlier work on efficient computation of quotients in a generic setting to the case of non-commutative univariate polynomial rings. We have shown that when the polynomial variable commutes with the coefficients, the whole shift and whole shifted inverse are well-defined and they may be used to compute left and right quotients. The whole shifted inverse may be computed by a modified Newton method in exactly the same way as when the coefficients are commutative and the number of iterations is logarithmic in the degree of the result. When the polynomial variable does not commute with the coefficients, left and right whole shifted inverses exist and may be computed by classical division. Once a left or right whole shifted inverse is obtained, several right or left quotients with that divisor may be computed, each with a single multiplication.

References

  • [1] Abramov, S.A., Le, H.Q., Li, Z.: Univariate Ore polynomial rings in computer algebra. Journal of Mathematical Sciences 131(5), 5885–5903 (2005)
  • [2] Bronstein, M., Petkovšek, M.: An introduction to pseudo-linear algebra. Theoretical Computer Science 157(1), 3–33 (1996)
  • [3] Jacobson, N.: Pseudo-linear transformations. Annals of Mathematics, Second Series 38(2), 484–507 (1937)
  • [4] Moenck, R.T., Borodin, A.B.: Fast modular transforms via division. In: Proc. 13th Annual Symposium on Switching and Automata Theory (SWAT 1972). pp. 90–96. IEEE, New York (1972)
  • [5] Monagan, M.B.: Gauss: a parameterized domain of computation system with support for signature functions. In: Miola, A. (ed.) Design and Implementation of Symbolic Computation Systems. pp. 81–94. Springer Berlin Heidelberg, Berlin, Heidelberg (1993)
  • [6] Ore, Ø.: Theory of non-commutative polynomials. Annals of Mathematics, Second Series 34(3), 480–508 (1933)
  • [7] Schulz, G.: Iterative Berechnung der reziproken Matrix. Zeitschrift für Angewandte Mathematik und Mechanik 13(1), 57–59 (1933)
  • [8] van der Hoeven, J.: FFT-like multiplication of linear differential operators. Journal of Symbolic Computation 33(1), 123–127 (2002)
  • [9] van der Hoeven, J.: On the complexity of skew arithmetic. Applicable Algebra in Engineering, Communication and Computing 27, 105–122 (2016)
  • [10] Watt, S.M.: Efficient generic quotients using exact arithmetic. In: Proc. International Symposium on Symbolic and Algebraic Computation (ISSAC 2023). ACM, New York (2023)
fshinv := proc (PR, method, h, v, perm)
    local R, x, k, vk, ivk, vkm1, w, ell, m, s, g, rmul, pmul, pshift, monom,
          step, refine, refine1, refine2, refine3;

    R      := PR[CoefficientRing];
    pmul   := (a, b)    -> PR[‘*‘](perm(a, b));
    rmul   := (a, b)    -> R [‘*‘](perm(a, b));
    monom  := (c, x, n) -> PR[‘*‘](PR[Polynom]([c]), PR[‘^‘](x, n));
    pshift := (n,v)     -> shift(PR, n, v);

    step   := proc(h, v, w, m, ell)
        PR[‘+‘]( pshift(m,w), pshift(2*m-h,pmul(w,PR[‘-‘]( PR[‘^‘](x,h-m), pmul(v,w) ))) )
    end;

    refine1 := proc (v, h, k, w0, ell0) local m, s, w, ell;
        w := pshift(h-k-ell0+1, w0); ell := ell0;
        while ell < h-k+1 do
            w := step(h, v, w, 0, ell); ell := min(2*ell, h-k+1)
        od;
        w
    end;
    refine2 := proc (v, h, k, w0, ell0) local m, w, ell;
        w := w0; ell := ell0;
        while ell < h-k+1 do
            m := min(h-k+1-ell, ell);
            w := step(k+ell+m-1, v, w, m, ell); ell := ell+m
        od;
        w
    end;
    refine3 := proc (v, h, k, w0, ell0) local m, s, w, ell;
        w := w0; ell := ell0;
        while ell < h-k+1 do
            m := min(h-k+1-ell, ell); s := max(0, k-2*ell+1);
            w := step(k+ell+m-1-s, pshift(-s, v), w, m, ell); ell := ell+m
        od;
        w
    end;

    if   method = 1 then refine := refine1
    elif method = 2 then refine := refine2
    elif method = 3 then refine := refine3
    else error "Unknown method", method
    fi;

    x   := PR[Polynom]([R[0],R[1]]); k   := PR[Degree](v);
    vk  := PR[Lcoeff](v);            ivk := R[‘^‘](vk, -1);
    if   h < k then return 0
    elif k = 0 or h = k or v = monom(vk,x,k) then return monom(ivk,x,h-k)
    fi;
    vkm1 := PR[Coeff](v, k-1);
    w    := PR[Polynom]([rmul(ivk, rmul(R[‘-‘](vkm1), ivk)), ivk]);  ell := 2;
    g    := 1; # Assume all coeff rings need a guard digit
    pshift(-g, refine(v, h + g, k, w, ell))
end:

fdiv := proc (PR, method, u, v, perm) local mul, h, iv, q, r;
    mul := (a, b) -> PR[‘*‘](perm(a, b));
    h   := PR[Degree](u);
    iv  := fshinv(PR, method, h, v, perm);
    q   := shift(PR,-(h-k),mul(shift(PR,-k,u),iv)); # Need only top h-k terms
    r   := PR[‘-‘](u, mul(q, v));
    (q, r)
end:
lfdiv := (PR, method, u, v) -> fdiv(PR, method, u, v, (a,b)->(b,a)):
rfdiv := (PR, method, u, v) -> fdiv(PR, method, u, v, (a,b)->(a,b)):
Figure 1: Maple code for fast generic polynomial shinv\operatorname{shinv} and left and right division
SkewPolynomial := proc (R, x, sigma, delta, sigmaInv)
    local P, deltaStar, mult2, MultVarOnLeft, MultVarOnRight;

    # Table to contain the operations.
    P := DenseUnivariatePolynomial(R, x);

    # If x*r = sigma(r)*x + delta(r), then
    #    r*x = x*sigmaInv(r) - delta(sigmaInv(r)) = x*sigmaInv(r) + deltaStar(r)
    deltaStar := r -> R[‘-‘](delta(sigmaInv(r)));

    P[DomainName]:= ’SkewPolynomial’;
    P[Categories]:= P[Categories] minus {CommutativeRing,IntegralDomain};
    P[Properties]:= P[Properties] minus {Commutative(‘*‘)};

    P[ThetaOp]  := P[Polynom]([R[0], R[1]]);   # The variable as skew polynomial.

    P[Apply] := proc(ell, p) local i, pi, result;   # Apply a skew polynomial as an operator.
        pi     := p;   # delta^i (p)
        result := R[‘*‘](P[Coeff](ell, 0), pi);
        for i to P[Degree](ell) do  # For Maple, for loop default from is 1.
            pi     := delta(pi);
            result := R[‘+‘](result, R[‘*‘](P[Coeff](ell, i), pi))
        od;
        result
    end:

    P[‘^‘] := proc(a0, n0) local a, n, p;   # Binary powering
        a := a0; n := n0; p := P[1];
        while n > 0 do
          if irem(n,2) = 1 then p := P[‘*‘](p, a) fi; a := P[‘*‘](a, a); n := iquo(n,2);
        od;
        p
    end:

    P[‘*‘] := proc() local i, p;   # N-ary product
        p := P[1]; for i to nargs do p := mult2(p, args[i]) od; p
    end:
    mult2 := proc(a, b) local s, i, ai, xib;   # Binary product
        xib := b;  ai := P[Coeff](a,0);
        s   := P[Map](c->R[‘*‘](ai, c), xib);
        for i to P[Degree](a) do
            xib := MultVarOnLeft(xib); ai := P[Coeff](a, i);
            s   := P[‘+‘](s, P[Map](c->R[‘*‘](ai,c), xib));
        od;
        s
    end:

    # Compute x*b as polynomial with powers on right.
    # x*sum(b[i]*x^i, i=0..degb) = sum(sigma(b[i])*x^(i+1) + delta(b[i])*x^i, i=0..degb)
    MultVarOnLeft := proc(b) local cl, slist, dlist;
        cl    := P[ListCoeffs](b);
        slist := [ R[0], op(map(sigma, cl)) ]; dlist := [ op(map(delta, cl)), R[0] ];
        P[Polynom](zip(R[‘+‘], slist, dlist));
    end:
    # Compute b*x as polynomial with powers on left.
    # sum(x^i*b[i], i=0..degb)*x = sum(x^(i+1)*sigmaInv(b[i]) + deltaStar(b[i])*x^i, i=0..degb)
    MultVarOnRight := proc(b) local cl, slist, dlist;
        cl    := P[ListCoeffs](b);
        slist := [ R[0], op(map(sigmaInv, cl)) ]; dlist := [ op(map(deltaStar, cl)), R[0] ];
        P[Polynom](zip(R[‘+‘], slist, dlist));
    end:

    # Continued in Part 2...
Figure 2: Maple code for generic skew polynomials (Part 1)
    # ... continued from Part 1.

    # For v = sum(vr_i x^i, i = 0..k) = sum(x^i vl_i, i = 0..k)
    # return polynomial with vl_i, interpreting powers as on left,
    # abusing the representation of output.
    P[ConvertToAdjointForm] := proc(v) local v_adj, i, rci, rcip;
        v_adj := P[0];
        for i from P[Degree](v) to 0 by -1 do
            rci   := P[Polynom]([P[Coeff](v,i)]);
            v_adj := P[‘+‘](v_adj, (MultVarOnRight@@i)(rci));
        od;
        v_adj
    end:

    # For v = sum(x^i vl_i, i = 0..k) = sum(x^i vr_i, i = 0..k)
    # return polynomial with vr_i, interpreting powers as on right,
    # abusing the representation of input.
    P[ConvertFromAdjointForm] := proc(v_adj) local v, i, rci;
        v := P[0];
        for i from 0 to P[Degree](v_adj) do
            rci := P[Polynom]([P[Coeff](v_adj,i)]);
            v   := P[‘+‘](v, (MultVarOnLeft@@i)(rci))
        od;
        v
    end:

    # Shift by power on left.
    P[LShift] := proc(n, v0) local v, shv, i, k;
        v := P[ConvertToAdjointForm](v0); k := P[Degree](v);
        if k + n < 0 then shv := P[0]
        elif n < 0 then shv := P[Polynom]([seq(P[Coeff](v,i), i = -n..k)])
        else shv := P[Polynom]([seq(R[0], i=1..n), seq(P[Coeff](v,i), i=0..k)])
        fi;
        P[ConvertFromAdjointForm](shv)
    end:

    # Shift by power on right.
    P[RShift] := proc(n, v) local i, k;
        k  := P[Degree](v);
        if k + n < 0 then P[0]
        elif n < 0 then P[Polynom]([seq(P[Coeff](v,i), i = -n..k)])
        else P[Polynom]([seq(R[0], i=1..n), seq(P[Coeff](v,i), i=0..k)])
        fi
    end:

    # Quotient and remainder
    P[GDiv] := proc(perm, qfun) proc (u, v) local h, k, x, ivk, t, q, r, i, qi;
        x   := P[Polynom]([R[0], R[1]]); ivk := R[Inv](P[Lcoeff](v));
        h   := P[Degree](u); k := P[Degree](v);
        q   := P[0];         r := u;
        for i from h - k by -1 to 0 do
            qi := qfun(P[Coeff](r,i+k), ivk, i, k);
            t  := P[‘*‘](P[Constant](qi), P[‘^‘](x,i));
            q  := P[‘+‘](q, t);
            r  := P[‘-‘](r, P[‘*‘](perm(t, v)));
        od;
        (q, r)
    end end:
    P[RDiv0] := P[GDiv](rperm, (u,iv,n,k)->R[‘*‘](u,(sigma@@n)(iv)));
    P[LDiv]  := P[GDiv](lperm, (u,iv,n,k)->(sigmaInv@@k)(R[‘*‘](iv,u)));

    # Continued in Part 3...
Figure 3: Maple code for generic skew polynomials (Part 2)
    # ... continued from Part 2.

    # A slightly less repetitive RDiv.
    P[RDiv] := proc (u, v) local h, k, x, ivk, sigma_ivk_i, x_i_v, q, r, i, qi;
        x   := P[Polynom]([R[0], R[1]]); ivk := R[Inv](P[Lcoeff](v));
        h   := P[Degree](u); k := P[Degree](v);

        # Precompute sigma^i(ivk) and x^i*v for required i.
        sigma_ivk_i[0] := ivk;
        for i from 1 to h-k do sigma_ivk_i[i] := sigma(sigma_ivk_i[i-1]); od;
        x_i_v[0] := v;
        for i from 1 to h-k do x_i_v[i]       := P[‘*‘](x, x_i_v[i-1]) od;

        q   := P[0];   r := u;
        for i from h - k by -1 to 0 do
            qi := P[Constant](R[‘*‘](P[Coeff](r, i+k), sigma_ivk_i[i]));
            q  := P[‘+‘](q, P[‘*‘](qi, P[‘^‘](x,i)));
            r  := P[‘-‘](r, P[‘*‘](qi, x_i_v[i]));
        od;
        (q, r)
    end:

    # Needed for some versions of Maple.
    P[0] := P[Polynom]([R[0]]);
    P[1] := P[Polynom]([R[1]]);
    P[‘-‘] := proc()
        local nb := P[Polynom](map(c-> R[‘-‘](c), P[ListCoeffs](args[nargs])));
        if nargs = 1 then nb else P[‘+‘](args[1], nb) fi
    end:

    # Return the table
    P
end:
Figure 4: Maple code for generic skew polynomials (Part 3)