UnivariatePolynomialMultiplicationPackage(R, U)¶
poly.spad line 1314 [edit on github]
R: Ring
This package implements Karatsuba's
trick for multiplying (large) univariate polynomials. It could be improved with a version doing the work on place and also with a special case for squares. We’ve done this in Basicmath, but we believe that this out of the scope of FriCAS.
- karatsuba: (U, U, NonNegativeInteger, NonNegativeInteger) -> U
karatsuba(a, b, l, k)
returnsa*b
by applying Karatsuba's
trick provided that botha
andb
have at leastl
terms andk > 0
holds and by callingnoKaratsuba
otherwise. The other multiplications are performed by recursive calls with the same third argument andk-1
as fourth argument.
- karatsubaOnce: (U, U) -> U
karatsuba(a, b)
returnsa*b
by applying Karatsuba's
trick once. The other multiplications are performed by calling*
fromU
.
- noKaratsuba: (U, U) -> U
noKaratsuba(a, b)
returnsa*b
without using Karatsuba's
trick at all.