[genius] Sat Jul 09 00:14:53 2016 Jiri (George) Lebl <jirka 5z com>



commit 50ba109640297f167b5cd08227af1d8ee5cfbab9
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Sat Jul 9 00:14:56 2016 +0200

    Sat Jul 09 00:14:53 2016  Jiri (George) Lebl <jirka 5z com>
    
        * help/C/genius.xml, src/funclib.c,
          lib/linear_algebra/linear_algebra.gel: string fixes from
          Anders Jonsson.
    
        * src/eval.c: fix segfault when trying to swap a protected id using
          swapwith.

 ChangeLog                             |    9 +++++++++
 help/C/genius.xml                     |    6 +++---
 lib/equation_solving/newton.gel       |    2 +-
 lib/linear_algebra/linear_algebra.gel |    6 +++---
 src/eval.c                            |    6 ++++++
 src/funclib.c                         |    2 +-
 6 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bbcfbd0..bd46d58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sat Jul 09 00:14:53 2016  Jiri (George) Lebl <jirka 5z com>
+
+       * help/C/genius.xml, src/funclib.c,
+         lib/linear_algebra/linear_algebra.gel: string fixes from
+         Anders Jonsson.
+
+       * src/eval.c: fix segfault when trying to swap a protected id using
+         swapwith.
+
 Fri Jul 08 23:52:05 2016  Jiri (George) Lebl <jirka 5z com>
 
        * help/C/genius.xml: Apply patch from Anders Jonsson to fix quite a
diff --git a/help/C/genius.xml b/help/C/genius.xml
index 48dc8e3..7469570 100644
--- a/help/C/genius.xml
+++ b/help/C/genius.xml
@@ -6039,7 +6039,7 @@ result as a vector and not added together.</para>
          <term><anchor id="gel-function-DeterminantalDivisorsInteger"/>DeterminantalDivisorsInteger</term>
          <listitem>
           <synopsis>DeterminantalDivisorsInteger (M)</synopsis>
-          <para>Get the determinantal divisors of an integer matrix (not its characteristic).</para>
+          <para>Get the determinantal divisors of an integer matrix.</para>
          </listitem>
         </varlistentry>
 
@@ -6174,7 +6174,7 @@ a sesquilinear form.  The vectors will be made orthonormal with respect to
          <term><anchor id="gel-function-InvariantFactorsInteger"/>InvariantFactorsInteger</term>
          <listitem>
           <synopsis>InvariantFactorsInteger (M)</synopsis>
-          <para>Get the invariant factors of a square integer matrix (not its characteristic).</para>
+          <para>Get the invariant factors of a square integer matrix.</para>
          </listitem>
         </varlistentry>
 
@@ -6653,7 +6653,7 @@ function of two arguments or it can be a matrix giving a sesquilinear form.
          <term><anchor id="gel-function-SmithNormalFormInteger"/>SmithNormalFormInteger</term>
          <listitem>
           <synopsis>SmithNormalFormInteger (M)</synopsis>
-          <para>Return the Smith normal form for square integer matrices over integers (not its 
characteristic).</para>
+          <para>Return the Smith normal form for square integer matrices over integers.</para>
           <para>
            See
            <ulink url="http://en.wikipedia.org/wiki/Smith_normal_form";>Wikipedia</ulink> for more 
information.
diff --git a/lib/equation_solving/newton.gel b/lib/equation_solving/newton.gel
index 630b0f3..be43c48 100644
--- a/lib/equation_solving/newton.gel
+++ b/lib/equation_solving/newton.gel
@@ -17,7 +17,7 @@ function NewtonsMethod(f,df,guess,epsilon,maxn) = (
        null
 )
 
-SetHelp("HalleysMethod","equation_solving","Attempt to find a zero of a functionf with derivative df and 
second derivative ddf using Halley's method, returning after two successive values are within epsilon or 
after maxn tries (then returns null)")
+SetHelp("HalleysMethod","equation_solving","Attempt to find a zero of a function f with derivative df and 
second derivative ddf using Halley's method, returning after two successive values are within epsilon or 
after maxn tries (then returns null)")
 function HalleysMethod(f,df,ddf,guess,epsilon,maxn) = (
        guess := float(guess);
        for n=1 to maxn do (
diff --git a/lib/linear_algebra/linear_algebra.gel b/lib/linear_algebra/linear_algebra.gel
index 6ad3d4a..bdeb4b0 100644
--- a/lib/linear_algebra/linear_algebra.gel
+++ b/lib/linear_algebra/linear_algebra.gel
@@ -189,7 +189,7 @@ function SmithNormalFormField(A) =
   ref (ref (A).').'
 )
 
-SetHelp("SmithNormalFormInteger", "linear_algebra", "Smith Normal Form for square integer matrices (not its 
characteristic)")
+SetHelp("SmithNormalFormInteger", "linear_algebra", "Smith Normal Form for square integer matrices")
 function SmithNormalFormInteger(M) =
 (
        if not IsMatrix (M) or not IsMatrixInteger(M) or not IsMatrixSquare(M) then
@@ -300,7 +300,7 @@ CharPoly = CharacteristicPolynomial
 SetHelp ("CharacteristicPolynomialFunction", "linear_algebra", "Get the characteristic polynomial as a 
function")
 function CharacteristicPolynomialFunction(M) = PolyToFunction (CharacteristicPolynomial (M))
 
-SetHelp ("DeterminantalDivisorsInteger", "linear_algebra", "Get the determinantal divisors of an integer 
matrix (not its characteristic)")
+SetHelp ("DeterminantalDivisorsInteger", "linear_algebra", "Get the determinantal divisors of an integer 
matrix")
 function DeterminantalDivisorsInteger(M) = (
        if not IsMatrix (M) or not IsMatrixInteger(M) or not IsMatrixSquare(M) then
                (error ("DeterminantalDivisorsInteger: M must be a square integer matrix");bailout);
@@ -317,7 +317,7 @@ function DeterminantalDivisorsInteger(M) = (
        v
 )
 
-SetHelp("InvariantFactorsInteger", "linear_algebra", "Get the invariant factors of a square integer matrix 
(not its characteristic)")
+SetHelp("InvariantFactorsInteger", "linear_algebra", "Get the invariant factors of a square integer matrix")
 function InvariantFactorsInteger(M) =
 (
        if not IsMatrix (M) or not IsMatrixInteger(M) or not IsMatrixSquare(M) then
diff --git a/src/eval.c b/src/eval.c
index ce8522c..90de592 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6148,10 +6148,16 @@ do_swapwithop (GelETree *l, GelETree *r)
                        gel_errorout (_("Can only swap user variables"));
                        return;
                }
+               if G_UNLIKELY (lf->type != GEL_VARIABLE_FUNC) {
+                       gel_errorout (_("Can only swap user variables"));
+                       return;
+               }
                if (r->type == GEL_IDENTIFIER_NODE ||
                    r->op.oper == GEL_E_DEREFERENCE) {
                        GelEFunc *rf = get_functoset (r);
                        GelETree *tmp;
+                       if G_UNLIKELY (rf == NULL)
+                               return;
 
                        if G_UNLIKELY (rf->type != GEL_VARIABLE_FUNC) {
                                gel_errorout (_("Can only swap user variables"));
diff --git a/src/funclib.c b/src/funclib.c
index 9f855ee..d73a8f1 100644
--- a/src/funclib.c
+++ b/src/funclib.c
@@ -7179,7 +7179,7 @@ gel_funclib_addall(void)
        FUNC (IsPrime, 1, "n", "number_theory", N_("Tests primality of integers, for numbers greater than 
25*10^9 false positive is with low probability depending on IsPrimeMillerRabinReps"));
        FUNC (StrongPseudoprimeTest, 2, "n,b", "number_theory", N_("Run the strong pseudoprime test base b on 
n"));
        FUNC (MillerRabinTest, 2, "n,reps", "number_theory", N_("Use the Miller-Rabin primality test on n, 
reps number of times.  The probability of false positive is (1/4)^reps"));
-       FUNC (MillerRabinTestSure, 1, "n", "number_theory", N_("Use the Miller-Rabin primality test on n with 
enough bases that assuming the Generalized Reimann Hypothesis the result is deterministic"));
+       FUNC (MillerRabinTestSure, 1, "n", "number_theory", N_("Use the Miller-Rabin primality test on n with 
enough bases that assuming the Generalized Riemann Hypothesis the result is deterministic"));
        FUNC (Factorize, 1, "n", "number_theory", N_("Return factorization of a number as a matrix"));
 
        VFUNC (max, 2, "a,args", "numeric", N_("Returns the maximum of arguments or matrix"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]