Return the vector of coefficients of the polynomial resulting from the multiplication of a polynomial with another polynomial of arbitrary degrees.
More...
Return the vector of coefficients of the polynomial resulting from the multiplication of a polynomial with another polynomial of arbitrary degrees.
See the documentation of pm_polynomial for details of the implementation.
- Parameters
-
[out] | mul | : The output contiguous vector of the same type and kind as the input lhs , of size size(lhs) + size(rhs) - 1 , containing the coefficients (in the order of increasing power) of the resulting polynomial from the multiplication of the polynomial lhs of arbitrary degree with another polynomial rhs of arbitrary degree.
By definition, the degree of the mul polynomial is size(mul) - 1 .
|
[in] | lhs | : The input contiguous vector of non-zero size of,
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128), or
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the coefficients of the left-hand-side polynomial in the multiplication, in the order of increasing power.
By definition, the degree of the lhs polynomial is size(lhs) - 1 .
This means that the condition lhs(size(lhs)) /= 0. must hold.
|
[in] | rhs | : The input contiguous vector of non-zero size of the same type and kind as lhs , containing the coefficients of the right-hand-side polynomial in the multiplication, in the order of increasing power.
By definition, the degree of the rhs polynomial is size(rhs) - 1 .
This means that the condition rhs(size(rhs)) /= 0. must hold.
|
Possible calling interfaces ⛓
call setPolyMul(mul(
1 :
size(lhs)
+ size(rhs)
- 1), lhs(:), rhs(:))
Return the vector of coefficients of the polynomial resulting from the multiplication of a polynomial...
This module contains procedures and generic interfaces for performing various mathematical operations...
- Warning
- The condition
0 < size(rhs)
must hold for the corresponding input arguments.
The condition 0 < size(lhs)
must hold for the corresponding input arguments.
The condition size(mul) == size(lhs) + size(rhs) - 1
must hold for the corresponding input arguments.
The condition lhs(size(lhs)) /= 0.
must hold for the corresponding input arguments.
The condition rhs(size(rhs)) /= 0.
must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- See also
- getPolySub
setPolySub
getPolySub
setPolySub
setPolyDiv
getPolyMul
setPolyMul
Example usage ⛓
4 TYPE(RKG),
allocatable :: Lhs(:), Rhs(:), Prod(:); \
8 call disp
%show(
"getPolyStr(Lhs)"); \
10 call disp
%show(
"getPolyStr(Rhs)"); \
12 call disp
%show(
"allocate(Prod(1 : min(size(Lhs) * size(Rhs), size(Lhs) + size(Rhs) - 1)))"); \
13 allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1))); \
14 call disp
%show(
"call setPolyMul(Prod, Lhs, Rhs)"); \
16 call disp
%show(
"getPolyStr(Prod)"); \
32 type(display_type) :: disp
35#define LHS [real(RKG) :: +1., +1.]
36#define RHS [real(RKG) :: -1., +1.]
40#define LHS [real(RKG) :: 2., 3., 1.]
41#define RHS [real(RKG) :: 1., 1.]
45#define LHS [real(RKG) :: -42., 0., -12., 1.]
46#define RHS [real(RKG) :: 1., -2., 1.]
50#define LHS [real(RKG) :: -42., 0., -12., 1.]
51#define RHS [real(RKG) :: -2., 1.]
56#define LHS cmplx([real(RKG) :: -4., 0., -2., 1.], -[real(RKG) :: -4., 0., -2., 1.], RKG)
57#define RHS cmplx([real(RKG) :: -3., 1.], -[real(RKG) :: -3., 1.], RKG)
61#define LHS cmplx([real(RKG) :: 2., 3., 1.], -[real(RKG) :: 2., 3., 1.], RKG)
62#define RHS cmplx([real(RKG) :: 1., 1.], -[real(RKG) :: 1., 1.], RKG)
66#define LHS cmplx([real(RKG) :: -42., 0., -12., 1.], -[real(RKG) :: -42., 0., -12., 1.], RKG)
67#define RHS cmplx([real(RKG) :: 1., -2., 1.], -[real(RKG) :: 1., -2., 1.], RKG)
71#define LHS cmplx([real(RKG) :: -42., 0., -12., 1.], -[real(RKG) :: -42., 0., -12., 1.], RKG)
72#define RHS cmplx([real(RKG) :: -2., 1.], -[real(RKG) :: -2., 1.])
Generate and return a string containing the polynomial expression corresponding to the input polynomi...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
6allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
16allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
192.x^
0 + 5.x^
1 + 4.x^
2 + 1.x^
3
23-42.x^
0 + 0.x^
1 - 12.x^
2 + 1.x^
3
26allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
29-42.x^
0 + 84.x^
1 - 54.x^
2 + 25.x^
3 - 14.x^
4 + 1.x^
5
33-42.x^
0 + 0.x^
1 - 12.x^
2 + 1.x^
3
36allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
3984.x^
0 - 42.x^
1 + 24.x^
2 - 14.x^
3 + 1.x^
4
43(
-4.,
4.)x^
0 + (
0.,
-0.)x^
1 + (
-2.,
2.)x^
2 + (
1.,
-1.)x^
3
45(
-3.,
3.)x^
0 + (
1.,
-1.)x^
1
46allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
49(
0.,
-24.)x^
0 + (
0.,
8.)x^
1 + (
0.,
-12.)x^
2 + (
0.,
10.)x^
3 + (
0.,
-2.)x^
4
53(
2.,
-2.)x^
0 + (
3.,
-3.)x^
1 + (
1.,
-1.)x^
2
55(
1.,
-1.)x^
0 + (
1.,
-1.)x^
1
56allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
59(
0.,
-4.)x^
0 + (
0.,
-10.)x^
1 + (
0.,
-8.)x^
2 + (
0.,
-2.)x^
3
63(
-42.,
42.)x^
0 + (
0.,
-0.)x^
1 + (
-12.,
12.)x^
2 + (
1.,
-1.)x^
3
65(
1.,
-1.)x^
0 + (
-2.,
2.)x^
1 + (
1.,
-1.)x^
2
66allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
69(
0.,
84.)x^
0 + (
0.,
-168.)x^
1 + (
0.,
108.)x^
2 + (
0.,
-50.)x^
3 + (
0.,
28.)x^
4 + (
0.,
-2.)x^
5
73(
-42.,
42.)x^
0 + (
0.,
-0.)x^
1 + (
-12.,
12.)x^
2 + (
1.,
-1.)x^
3
75(
-2.,
2.)x^
0 + (
1.,
-1.)x^
1
76allocate(Prod(
1 :
min(
size(Lhs)
* size(Rhs),
size(Lhs)
+ size(Rhs)
- 1)))
79(
0.,
-168.)x^
0 + (
0.,
84.)x^
1 + (
0.,
-48.)x^
2 + (
0.,
28.)x^
3 + (
0.,
-2.)x^
4
- Test:
- test_pm_polynomial
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
-
If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
-
If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
- Copyright
- Computational Data Science Lab
- Author:
- Fatemeh Bagheri, Tuesday 11:34 PM, August 10, 2021, Dallas, TX
Definition at line 1996 of file pm_polynomial.F90.