* Bug #14316 fixed - Operation scalar^matrix was identical to scalar.^matrix instead... 90/17690/5
Pierre-Aimé Agnel [Wed, 13 Jan 2016 15:39:43 +0000 (16:39 +0100)]
Change-Id: Ie497c0effe3559eec686cb3b8edc9ea93fd15d1d

scilab/CHANGES_6.0.X
scilab/modules/ast/macros/%s_pow.sci
scilab/modules/ast/src/cpp/operations/types_power.cpp
scilab/modules/ast/tests/unit_tests/power.dia.ref
scilab/modules/ast/tests/unit_tests/power.tst
scilab/modules/core/help/en_US/1_keywords/power.xml
scilab/modules/core/help/fr_FR/1_keywords/power.xml

index b1aa32b..b35b05a 100644 (file)
@@ -69,6 +69,7 @@ Bug Fixes
 
 * Bug #14313 fixed - Parser did not create a column separator after spaces and '...' at the end of lines
 
+* Bug #14316 fixed - Operation scalar^matrix was identical to scalar.^matrix instead of being expm( log(scalar) * matrix )
 
 Dependencies
 =============
index 122d212..60816c1 100644 (file)
@@ -20,53 +20,54 @@ function x=%s_pow(a,p)
     // - A scalar and p square matrix
     // - A square matrix p is not an integer
     //!
-    [m,n]=size(a)
-    [mp,np]=size(p)
-    if m*n==1&mp==np then  //a^P
-        flag=or(p<>p')
-        r=and(imag(p)==0)&imag(a)==0
+    [m,n] = size(a)
+    [mp,np] = size(p)
+    if (m*n == 1) && (mp <> np) then
+        error(msprintf(_("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "%s_pow", 2));
+    end
+    if (mp*np == 1) && (m <> n) then
+        error(msprintf(_("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "%s_pow", 1));
+    end
+    if (m*n == 1) && (mp==np) then  //a^P
+        flag = or(p <> p')
+        r = and(imag(p) == 0) && (imag(a) == 0) && ( a>= 0)
         if ~flag then
             //Hermitian matrix
-            [u,s]=schur(p);
-            w=a.^diag(s);
-            x=u*diag(a.^diag(s))*u';
+            [u, s] = schur(p);
+            w=a .^ diag(s);
+            x=u * diag(a .^ diag(s)) * u';
             if r then
-                x=real(x)
+                x = real(x)
             end
         else
-            [s,u,bs]=bdiag(p+0*%i);
-            if max(bs)>1 then
-                error(msprintf(_("%s: Unable to diagonalize.\n"),"%s_pow"));
-            end
-            w=diag(s);
-            x=u*diag(a.^diag(s))*inv(u);
+            x = expm(log(a) * p);
         end
-        if r then x=real(x), end
-    elseif m==n&mp*np==1 then  //A^p  p non integer
-        flag=or(a<>a')
+        if r then x = real(x), end
+    elseif (m == n) && (mp*np == 1) then  //A^p  p non integer
+        flag = or(a <> a')
         if ~flag then
             //Hermitian matrix
-            r=and(imag(a)==0)
-            [u,s]=schur(a);
-            x=u*diag(diag(s).^p)*u';
+            r = and(imag(a) == 0)
+            [u, s] = schur(a);
+            x = u * diag(diag(s) .^ p) * u';
             if r then
-                if s>=0&imag(p)==0 then
-                    x=real(x)
+                if (s >= 0) && (imag(p) == 0) then
+                    x = real(x)
                 end
             end
         else
             //General matrix
-            r=and(imag(a)==0)
-            [s,u,bs]=bdiag(a+0*%i);
-            if max(bs)>1 then
+            r = and(imag(a) == 0)
+            [s, u, bs] = bdiag(a + 0*%i);
+            if (max(bs) > 1) then
                 error(msprintf(_("%s: Unable to diagonalize.\n"),"%s_pow"));
             end
-            x=u*diag(diag(s).^p)*inv(u);
+            x = u * diag(diag(s) .^ p) * inv(u);
         end
-        if int(p)==p & real(p)==p & r then
-            x=real(x);
+        if (int(p) == p) && (real(p) == p) && r then
+            x = real(x);
         end
     else
-        error(43)
+        error(msprintf(_("Not implemented in scilab...\n")));
     end
 endfunction
index c30f872..89c2e99 100644 (file)
@@ -155,168 +155,180 @@ int PowerDoubleByDouble(Double* _pDouble1, Double* _pDouble2, Double** _pDoubleO
 
     int iComplex = 1;
 
-    if (bScalar1 && bScalar2)
+    if (bScalar1)
     {
-        //s ^ s
-        *_pDoubleOut = new Double(1, 1, true);
-
-        if (bComplex1 == false && bComplex2 == false)
-        {
-            iPowerRealScalarByRealScalar(_pDouble1->get(0), _pDouble2->get(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), &iComplex);
-        }
-        else if (bComplex1 == false && bComplex2 == true)
-        {
-            iPowerRealScalarByComplexScalar(_pDouble1->get(0), _pDouble2->get(0), _pDouble2->getImg(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
-        }
-        else if (bComplex1 == true && bComplex2 == false)
-        {
-            iPowerComplexScalarByRealScalar(_pDouble1->get(0), _pDouble1->getImg(0), _pDouble2->get(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
-        }
-        else if (bComplex1 == true && bComplex2 == true)
+        if (bScalar2)
         {
-            iPowerComplexScalarByComplexScalar(_pDouble1->get(0), _pDouble1->getImg(0), _pDouble2->get(0), _pDouble2->getImg(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
-        }
+            //s ^ s
+            *_pDoubleOut = new Double(1, 1, true);
 
-        if (iComplex == 0)
-        {
-            (*_pDoubleOut)->setComplex(false);
-        }
+            if (bComplex1 == false && bComplex2 == false)
+            {
+                iPowerRealScalarByRealScalar(_pDouble1->get(0), _pDouble2->get(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), &iComplex);
+            }
+            else if (bComplex1 == false && bComplex2 == true)
+            {
+                iPowerRealScalarByComplexScalar(_pDouble1->get(0), _pDouble2->get(0), _pDouble2->getImg(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
+            else if (bComplex1 == true && bComplex2 == false)
+            {
+                iPowerComplexScalarByRealScalar(_pDouble1->get(0), _pDouble1->getImg(0), _pDouble2->get(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
+            else if (bComplex1 == true && bComplex2 == true)
+            {
+                iPowerComplexScalarByComplexScalar(_pDouble1->get(0), _pDouble1->getImg(0), _pDouble2->get(0), _pDouble2->getImg(0), (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
 
-        return 0;
-    }
-    else if (bScalar1 && _pDouble2->getDims() == 2)
-    {
-        //s ^ []
-        *_pDoubleOut = new Double(_pDouble2->getRows(), _pDouble2->getCols(), true);
+            if (iComplex == 0)
+            {
+                (*_pDoubleOut)->setComplex(false);
+            }
 
-        if (bComplex1 == false && bComplex2 == false)
-        {
-            iPowerRealScalarByRealMatrix(
-                _pDouble1->get(0),
-                _pDouble2->get(), _pDouble2->getRows(), _pDouble2->getCols(),
-                (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), &iComplex);
-        }
-        else if (bComplex1 == false && bComplex2 == true)
-        {
-            iPowerRealScalarByComplexMatrix(
-                _pDouble1->get(0),
-                _pDouble2->get(), _pDouble2->getImg(), _pDouble2->getRows(), _pDouble2->getCols(),
-                (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
-        }
-        else if (bComplex1 == true && bComplex2 == false)
-        {
-            iPowerComplexScalarByRealMatrix(
-                _pDouble1->get(0), _pDouble1->getImg(0),
-                _pDouble2->get(), _pDouble2->getRows(), _pDouble2->getCols(),
-                (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            return 0;
         }
-        else if (bComplex1 == true && bComplex2 == true)
+        else if (_pDouble2->isVector())
         {
-            iPowerComplexScalarByComplexMatrix(
-                _pDouble1->get(0), _pDouble1->getImg(0),
-                _pDouble2->get(), _pDouble2->getImg(), _pDouble2->getRows(), _pDouble2->getCols(),
-                (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
-        }
+            //s ^ Vector == s .^ Vector
+            *_pDoubleOut = new Double(_pDouble2->getDims(), _pDouble2->getDimsArray(), true);
+
+            if (bComplex1 == false && bComplex2 == false)
+            {
+                iPowerRealScalarByRealMatrix(
+                    _pDouble1->get(0),
+                    _pDouble2->get(), 1, _pDouble2->getSize(),
+                    (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), &iComplex);
+            }
+            else if (bComplex1 == false && bComplex2 == true)
+            {
+                iPowerRealScalarByComplexMatrix(
+                    _pDouble1->get(0),
+                    _pDouble2->get(), _pDouble2->getImg(), 1, _pDouble2->getSize(),
+                    (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
+            else if (bComplex1 == true && bComplex2 == false)
+            {
+                iPowerComplexScalarByRealMatrix(
+                    _pDouble1->get(0), _pDouble1->getImg(0),
+                    _pDouble2->get(), 1, _pDouble2->getSize(),
+                    (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
+            else if (bComplex1 == true && bComplex2 == true)
+            {
+                iPowerComplexScalarByComplexMatrix(
+                    _pDouble1->get(0), _pDouble1->getImg(0),
+                    _pDouble2->get(), _pDouble2->getImg(), 1, _pDouble2->getSize(),
+                    (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
 
-        if (iComplex == 0)
+            if (iComplex == 0)
+            {
+                (*_pDoubleOut)->setComplex(false);
+            }
+
+            return 0;
+        }
+        else
         {
-            (*_pDoubleOut)->setComplex(false);
+            // s ^ Matrix
+            // call overload %s_pow
+            return 0;
         }
-
-        return 0;
     }
 
-    if (bScalar2 && _pDouble1->getDims() == 2 && _pDouble1->isVector() )
+    if (bScalar2)
     {
-        //_pDouble1 is a vector and _pDouble is a scalar
-        *_pDoubleOut = new Double(_pDouble1->getRows(), _pDouble1->getCols() , true);
-
-        if (bComplex1 == false && bComplex2 == false)
+        if (_pDouble1->isVector())
         {
-            for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+            //_pDouble1 is a vector and _pDouble is a scalar
+            *_pDoubleOut = new Double(_pDouble1->getDims(), _pDouble1->getDimsArray() , true);
+
+            if (bComplex1 == false && bComplex2 == false)
             {
-                iPowerRealScalarByRealScalar(
-                    _pDouble1->get(i),
-                    _pDouble2->get(0),
-                    &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i], &iComplex);
+                for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+                {
+                    iPowerRealScalarByRealScalar(
+                        _pDouble1->get(i),
+                        _pDouble2->get(0),
+                        &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i], &iComplex);
+                }
             }
-        }
-        else if (bComplex1 == false && bComplex2 == true)
-        {
-            for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+            else if (bComplex1 == false && bComplex2 == true)
             {
-                iPowerRealScalarByComplexScalar(
-                    _pDouble1->get(i),
-                    _pDouble2->get(0), _pDouble2->getImg(0),
-                    &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i]);
+                for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+                {
+                    iPowerRealScalarByComplexScalar(
+                        _pDouble1->get(i),
+                        _pDouble2->get(0), _pDouble2->getImg(0),
+                        &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i]);
+                }
             }
-        }
-        else if (bComplex1 == true && bComplex2 == false)
-        {
-            for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+            else if (bComplex1 == true && bComplex2 == false)
             {
-                iPowerComplexScalarByRealScalar(
-                    _pDouble1->get(i), _pDouble1->getImg(i),
-                    _pDouble2->get(0),
-                    &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i]);
+                for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+                {
+                    iPowerComplexScalarByRealScalar(
+                        _pDouble1->get(i), _pDouble1->getImg(i),
+                        _pDouble2->get(0),
+                        &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i]);
+                }
             }
-        }
-        else if (bComplex1 == true && bComplex2 == true)
-        {
-            for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+            else if (bComplex1 == true && bComplex2 == true)
             {
-                iPowerComplexScalarByComplexScalar(
-                    _pDouble1->get(i), _pDouble1->getImg(i),
-                    _pDouble2->get(0), _pDouble2->getImg(0),
-                    &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i]);
+                for (int i = 0 ; i < (*_pDoubleOut)->getSize() ; i++)
+                {
+                    iPowerComplexScalarByComplexScalar(
+                        _pDouble1->get(i), _pDouble1->getImg(i),
+                        _pDouble2->get(0), _pDouble2->getImg(0),
+                        &(*_pDoubleOut)->get()[i], &(*_pDoubleOut)->getImg()[i]);
+                }
             }
-        }
-
-        if (iComplex == 0)
-        {
-            (*_pDoubleOut)->setComplex(false);
-        }
 
-        return 0;
-    }
+            if (iComplex == 0)
+            {
+                (*_pDoubleOut)->setComplex(false);
+            }
 
-    if (bScalar2 && ( _pDouble1->getRows() == _pDouble1->getCols()))
-    {
-        //power of a square matrix by a scalar exponent.
-        int iRet = 0;
-        if (bComplex2)
-        {
-            //mange by overloading
             return 0;
         }
-
-        *_pDoubleOut = new Double(_pDouble1->getRows(), _pDouble1->getCols() , true);
-        if (bComplex1 == false)
-        {
-            iRet = iPowerRealSquareMatrixByRealScalar(
-                       _pDouble1->get(), _pDouble1->getRows(), _pDouble1->getCols(),
-                       _pDouble2->get(0),
-                       (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), &iComplex);
-        }
-        else if (bComplex1 == true)
+        else if (_pDouble1->getRows() == _pDouble1->getCols())
         {
-            iRet = iPowerComplexSquareMatrixByRealScalar(
-                       _pDouble1->get(), _pDouble1->getImg(), _pDouble1->getRows(), _pDouble1->getCols(),
-                       _pDouble2->get(0),
-                       (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
-        }
+            //power of a square matrix by a scalar exponent.
+            int iRet = 0;
+            if (bComplex2)
+            {
+                // mange by overloading
+                // Call %s_pow
+                return 0;
+            }
 
-        // call overload
-        if (iRet == -1)
-        {
-            delete *_pDoubleOut;
-            *_pDoubleOut = NULL;
-            return 0;
-        }
+            *_pDoubleOut = new Double(_pDouble1->getRows(), _pDouble1->getCols() , true);
+            if (bComplex1 == false)
+            {
+                iRet = iPowerRealSquareMatrixByRealScalar(
+                           _pDouble1->get(), _pDouble1->getRows(), _pDouble1->getCols(),
+                           _pDouble2->get(0),
+                           (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), &iComplex);
+            }
+            else if (bComplex1 == true)
+            {
+                iRet = iPowerComplexSquareMatrixByRealScalar(
+                           _pDouble1->get(), _pDouble1->getImg(), _pDouble1->getRows(), _pDouble1->getCols(),
+                           _pDouble2->get(0),
+                           (*_pDoubleOut)->get(), (*_pDoubleOut)->getImg());
+            }
 
-        if (iComplex == 0)
-        {
-            (*_pDoubleOut)->setComplex(false);
+            // call overload
+            if (iRet == -1)
+            {
+                delete *_pDoubleOut;
+                *_pDoubleOut = NULL;
+                return 0;
+            }
+
+            if (iComplex == 0)
+            {
+                (*_pDoubleOut)->setComplex(false);
+            }
         }
     }
     return 0;
index 05eeb5c..f5a8dce 100644 (file)
@@ -34,13 +34,13 @@ assert_checkequal(C ^ r, [-21+%i*28,-30+%i*40;-45+%i*60,-66+%i*88]);
 assert_checkalmostequal(C ^ c, [-27.051150278703-%i*25.062777693306, 12.961689280285+%i*11.342742208568; 19.442533920428+%i*17.014113312852,-7.6086163582745-%i*8.048664380454]);
 // double ^ DOUBLE
 //r ^ R
-assert_checkequal(r ^ R, [2,4;8,16]);
+assert_checkalmostequal(r ^ R, expm(log(r) * R));
 //r ^ C
-assert_checkalmostequal(r ^ C, [ 0.3669139494866+%i*1.9660554808225,-3.7307483073443+%i*1.4427463627567;-4.2053829899227-%i*6.8054943911569, 11.836965865504-%i*10.765047101564]);
+assert_checkalmostequal(r ^ C, expm(log(r) * C));
 //c ^ R
-assert_checkequal(c ^ R, [ 1+%i*2,-3+%i*4;-11-%i*2,-7-%i*24]);
+assert_checkalmostequal(c ^ R, expm(log(c) * R));
 //c ^ C
-assert_checkalmostequal(c ^ C, [-0.2225171568018+%i*0.1007091311361, 0.0393715559770-%i*0.0448190190488;-0.0042471622281+%i*0.0139380758833,-0.0004586250484-%i*0.0035291890346]);
+assert_checkalmostequal(c ^ C, expm(log(c) * C));
 //POLY
 //poly ^ double
 //pR ^ r
@@ -57,3 +57,9 @@ assert_checkequal(pC ^ R, [1+%i+(2+%i*2)*%s^2+(3+%i*3)*%s^3,%i*2+(%i*8)*%s^2+(%i
 assert_checkequal(PR ^ r, [2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6,2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6;2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6,2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6]);
 //PC ^ r
 assert_checkequal(PC ^ r, [%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6,%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6;%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6,%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6]);
+// Error handling for non-square matrices
+msg1 = msprintf(_("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "%s_pow", 2);
+msg2= msprintf(_("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "%s_pow", 1);
+NonSquare = [1 2; 3 4; 5 6];
+assert_checkerror("2^NonSquare", msg1);
+assert_checkerror("NonSquare^2", msg2);
index 703859a..413f069 100644 (file)
@@ -42,13 +42,13 @@ assert_checkalmostequal(C ^ c, [-27.051150278703-%i*25.062777693306, 12.96168928
 
 // double ^ DOUBLE
 //r ^ R
-assert_checkequal(r ^ R, [2,4;8,16]);
+assert_checkalmostequal(r ^ R, expm(log(r) * R));
 //r ^ C
-assert_checkalmostequal(r ^ C, [ 0.3669139494866+%i*1.9660554808225,-3.7307483073443+%i*1.4427463627567;-4.2053829899227-%i*6.8054943911569, 11.836965865504-%i*10.765047101564]);
+assert_checkalmostequal(r ^ C, expm(log(r) * C));
 //c ^ R
-assert_checkequal(c ^ R, [ 1+%i*2,-3+%i*4;-11-%i*2,-7-%i*24]);
+assert_checkalmostequal(c ^ R, expm(log(c) * R));
 //c ^ C
-assert_checkalmostequal(c ^ C, [-0.2225171568018+%i*0.1007091311361, 0.0393715559770-%i*0.0448190190488;-0.0042471622281+%i*0.0139380758833,-0.0004586250484-%i*0.0035291890346]);
+assert_checkalmostequal(c ^ C, expm(log(c) * C));
 
 
 //POLY
@@ -72,3 +72,11 @@ assert_checkequal(pC ^ R, [1+%i+(2+%i*2)*%s^2+(3+%i*3)*%s^3,%i*2+(%i*8)*%s^2+(%i
 assert_checkequal(PR ^ r, [2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6,2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6;2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6,2+8*%s^2+12*%s^3+8*%s^4+24*%s^5+18*%s^6]);
 //PC ^ r
 assert_checkequal(PC ^ r, [%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6,%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6;%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6,%i*4+(%i*16)*%s^2+(%i*24)*%s^3+(%i*16)*%s^4+(%i*48)*%s^5+(%i*36)*%s^6]);
+
+// Error handling for non-square matrices
+msg1 = msprintf(_("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "%s_pow", 2);
+msg2= msprintf(_("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "%s_pow", 1);
+
+NonSquare = [1 2; 3 4; 5 6];
+assert_checkerror("2^NonSquare", msg1);
+assert_checkerror("NonSquare^2", msg2);
index b2442bc..96d1d4d 100644 (file)
             </listitem>
             <listitem>
                 <para>
-                    If <literal>A</literal> is a scalar  and <literal>b</literal> is a matrix (or vector) <literal>A^b</literal> and <literal>A.^b</literal> are the matrices (or vectors) formed by  <literal> a^(b(i,j))</literal>.
+                    If <literal>A</literal> is a scalar and <literal>b</literal> is a square matrix <literal>A^b</literal> is the matrix <literal> expm(log(A) * b)</literal>.
+                </para>
+                <para>
+                    If <literal>A</literal> is a scalar and <literal>b</literal> is a vector <literal>A^b</literal> and <literal>A.^b</literal> are the vector formed by  <literal> a^(b(i,j))</literal>.
+                </para>
+                <para>
+                    If <literal>A</literal> is a scalar and <literal>b</literal> is a matrix <literal>A.^b</literal> is the matrix formed by  <literal> a^(b(i,j))</literal>.
                 </para>
             </listitem>
             <listitem>
                 <para>
-                    If <literal>A</literal> and <literal>b</literal>  are vectors (matrices) of the same size <literal>A.^b</literal> is the  <literal>A(i)^b(i)</literal> vector (<literal>A(i,j)^b(i,j)</literal> matrix).
+                    If <literal>A</literal> and <literal>b</literal> are vectors (matrices) of the same size <literal>A.^b</literal> is the  <literal>A(i)^b(i)</literal> vector (<literal>A(i,j)^b(i,j)</literal> matrix).
                 </para>
             </listitem>
         </itemizedlist>
index ed961fd..2b53593 100644 (file)
             </listitem>
             <listitem>
                 <para>
-                    Si <literal>A</literal> est un scalaire et <literal>b</literal> est une matrice <literal>A^b</literal> et <literal>A.^b</literal> sont deux matrices de même taille que b dont les termes sont égaux à <literal> a^(b(i,j))</literal>.
+                    Si <literal>A</literal> est un scalaire et <literal>b</literal> est une matrice carrée <literal>A^b</literal> est la matrice <literal>expm(log(A)*b)</literal>.
+                </para>
+                <para>
+                    Si <literal>A</literal> est un scalaire et <literal>b</literal> est une matrice <literal>A.^b</literal> est une matrice de même taille que b dont les termes sont égaux à <literal> a^(b(i,j))</literal>.
                 </para>
             </listitem>
             <listitem>