]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns.cpp
Use initializer lists to construct container<>, lst.
[ginac.git] / ginac / inifcns.cpp
index f9305282901194c1a00e158ee778e695df79bf3d..cff14f4388f9c71cfa59608041939e358a6c02ae 100644 (file)
@@ -1045,7 +1045,7 @@ ex lsolve(const ex &eqns, const ex &symbols, unsigned options)
        if (eqns.info(info_flags::relation_equal)) {
                if (!symbols.info(info_flags::symbol))
                        throw(std::invalid_argument("lsolve(): 2nd argument must be a symbol"));
-               const ex sol = lsolve(lst(eqns),lst(symbols));
+               const ex sol = lsolve(lst{eqns}, lst{symbols});
                
                GINAC_ASSERT(sol.nops()==1);
                GINAC_ASSERT(is_exactly_a<relational>(sol.op(0)));
@@ -1103,12 +1103,12 @@ ex lsolve(const ex &eqns, const ex &symbols, unsigned options)
        } catch (const std::runtime_error & e) {
                // Probably singular matrix or otherwise overdetermined system:
                // It is consistent to return an empty list
-               return lst();
+               return lst{};
        }
        GINAC_ASSERT(solution.cols()==1);
        GINAC_ASSERT(solution.rows()==symbols.nops());
        
-       // return list of equations of the form lst(var1==sol1,var2==sol2,...)
+       // return list of equations of the form lst{var1==sol1,var2==sol2,...}
        lst sollist;
        for (size_t i=0; i<symbols.nops(); i++)
                sollist.append(symbols.op(i)==solution(i,0));
@@ -1218,7 +1218,7 @@ fsolve(const ex& f_in, const symbol& x, const numeric& x1, const numeric& x2)
                        // determined by the secant between the values xx[0] and xx[1].
                        // Don't set the secant_weight to one because that could disturb
                        // the convergence in some corner cases!
-                       static const double secant_weight = 0.984375;  // == 63/64 < 1
+                       constexpr double secant_weight = 0.984375;  // == 63/64 < 1
                        numeric xxmid = (1-secant_weight)*0.5*(xx[0]+xx[1])
                            + secant_weight*(xx[0]+fx[0]*(xx[0]-xx[1])/(fx[1]-fx[0]));
                        ex fxmid_ = f.subs(x == xxmid).evalf();