X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Futils.cpp;h=6935bcd8e1a71fc93b436efc96b4fb8aa09ea2dd;hb=b16d5b34f40c9dcd6bd4f9e1fdeeb65cb1612db3;hp=89217a93cbf1d05a444509f7f38cc572053d9147;hpb=3a7031219dabf8e5d15dc63ca4975c88e20abaec;p=ginac.git diff --git a/ginac/utils.cpp b/ginac/utils.cpp index 89217a93..6935bcd8 100644 --- a/ginac/utils.cpp +++ b/ginac/utils.cpp @@ -4,7 +4,7 @@ * but not of any interest to the user of the library. */ /* - * GiNaC Copyright (C) 1999-2017 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2019 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include "ex.h" #include "numeric.h" -#include "operators.h" #include "utils.h" #include "version.h" @@ -58,14 +57,14 @@ unsigned log2(unsigned n) * n = p1+p2+...+pk, i.e. p is a partition of n. */ const numeric -multinomial_coefficient(const std::vector & p) +multinomial_coefficient(const std::vector & p) { numeric n = 0, d = 1; for (auto & it : p) { - n += numeric(it); - d *= factorial(numeric(it)); + n = n.add(numeric(it)); + d = d.mul(factorial(numeric(it))); } - return factorial(n) / d; + return factorial(n).div(d); } //////////