Loading...
Searching...
No Matches
monomials.cpp
2
3namespace SymEngine
4{
5
6// This is the fastest implementation:
7void monomial_mul(const vec_int &A, const vec_int &B, vec_int &C)
8{
9 size_t n = A.size();
10 for (size_t i = 0; i < n; ++i) {
11 C[i] = A[i] + B[i];
12 }
13}
14
15/*
16// Other implementation of monomial_mul() are below. Those are slightly slower,
17// so they are commented out.
18
19// This is slightly slower than monomial_mul
20void monomial_mul2(const vec_int &A, const vec_int &B, vec_int &C)
21{
22 std::transform(A.begin(), A.end(), B.begin(), C.begin(), std::plus<int>());
23}
24
25// The same as monomial_mul2
26void monomial_mul3(const vec_int &A, const vec_int &B, vec_int &C)
27{
28 std::transform(A.begin(), A.end(), B.begin(), C.begin(),
29 [] (int a, int b) { return a + b; });
30}
31*/
32
33} // namespace SymEngine
Main namespace for SymEngine package.
Definition: add.cpp:19
void monomial_mul(const vec_int &A, const vec_int &B, vec_int &C)
Monomial multiplication.
Definition: monomials.cpp:7
T size(T... args)