Functions.cpp

Go to the documentation of this file.
00001 //Copyright (c) 2004-2005, Baris Sumengen
00002 //All rights reserved.
00003 //
00004 // CIMPL Matrix Performance Library
00005 //
00006 //Redistribution and use in source and binary
00007 //forms, with or without modification, are
00008 //permitted provided that the following
00009 //conditions are met:
00010 //
00011 //    * No commercial use is allowed. 
00012 //    This software can only be used
00013 //    for non-commercial purposes. This 
00014 //    distribution is mainly intended for
00015 //    academic research and teaching.
00016 //    * Redistributions of source code must
00017 //    retain the above copyright notice, this
00018 //    list of conditions and the following
00019 //    disclaimer.
00020 //    * Redistributions of binary form must
00021 //    mention the above copyright notice, this
00022 //    list of conditions and the following
00023 //    disclaimer in a clearly visible part 
00024 //    in associated product manual, 
00025 //    readme, and web site of the redistributed 
00026 //    software.
00027 //    * Redistributions in binary form must
00028 //    reproduce the above copyright notice,
00029 //    this list of conditions and the
00030 //    following disclaimer in the
00031 //    documentation and/or other materials
00032 //    provided with the distribution.
00033 //    * The name of Baris Sumengen may not be
00034 //    used to endorse or promote products
00035 //    derived from this software without
00036 //    specific prior written permission.
00037 //
00038 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
00039 //HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00040 //EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
00041 //NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00042 //MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00043 //PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00044 //CONTRIBUTORS BE LIABLE FOR ANY
00045 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00046 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00047 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00048 //OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00049 //DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00050 //HOWEVER CAUSED AND ON ANY THEORY OF
00051 //LIABILITY, WHETHER IN CONTRACT, STRICT
00052 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00053 //OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00054 //OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00055 //POSSIBILITY OF SUCH DAMAGE.
00056 
00057 
00058 
00059 #include "./Functions.h"
00060 #include "mkl_vml.h"
00061 
00062 
00063 namespace MathCore
00064 {
00065 
00066         // Inverts elements
00067         Vector<float> Inv(Vector<float>& m)
00068         {
00069                 Vector<float> temp(m.Length());
00070                 vsInv(m.Length(), m.Data(), temp.Data());
00071                 return temp;
00072         }
00073 
00074 
00075         Vector<double> Inv(Vector<double>& m)
00076         {
00077                 Vector<double> temp(m.Length());
00078                 vdInv(m.Length(), m.Data(), temp.Data());
00079                 return temp;
00080         }
00081         
00082         Matrix<float> Inv(Matrix<float>& m)
00083         {
00084                 Matrix<float> temp(m.Rows(), m.Columns());
00085                 vsInv(m.Length(), m.Data(), temp.Data());
00086                 return temp;
00087         }
00088 
00089         Matrix<double> Inv(Matrix<double>& m)
00090         {
00091                 Matrix<double> temp(m.Rows(), m.Columns());
00092                 vdInv(m.Length(), m.Data(), temp.Data());
00093                 return temp;
00094         }
00095 
00096 
00097         Vector<float>& InvI(Vector<float>& m)
00098         {
00099                 vsInv(m.Length(), m.Data(), m.Data());
00100                 return m;
00101         }
00102 
00103         Vector<double>& InvI(Vector<double>& m)
00104         {
00105                 vdInv(m.Length(), m.Data(), m.Data());
00106                 return m;
00107         }
00108 
00109         Matrix<float>& InvI(Matrix<float>& m)
00110         {
00111                 vsInv(m.Length(), m.Data(), m.Data());
00112                 return m;
00113         }
00114 
00115         Matrix<double>& InvI(Matrix<double>& m)
00116         {
00117                 vdInv(m.Length(), m.Data(), m.Data());
00118                 return m;
00119         }
00120 
00121 
00122         // Division of elements
00123         Vector<float> Div(Vector<float>& m1, Vector<float>& m2)
00124         {
00125                 if(m1.Length() != m2.Length())
00126                 {
00127                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00128                         Utility::RunTimeError("Vector lengths are not the same!");
00129                 }
00130                 
00131                 Vector<float> temp(m1.Length());
00132                 vsDiv(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00133                 return temp;
00134         }
00135 
00136         Vector<double> Div(Vector<double>& m1, Vector<double>& m2)
00137         {
00138                 if(m1.Length() != m2.Length())
00139                 {
00140                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00141                         Utility::RunTimeError("Vector lengths are not the same!");
00142                 }
00143                 
00144                 Vector<double> temp(m1.Length());
00145                 vdDiv(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00146                 return temp;
00147         }
00148 
00149         Matrix<float> Div(Matrix<float>& m1, Matrix<float>& m2)
00150         {
00151                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00152                 {
00153                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00154                         Utility::RunTimeError("Matrix dimensions does not match!");
00155                 }
00156                 
00157                 Matrix<float> temp(m1.Rows(), m1.Columns());
00158                 vsDiv(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00159                 return temp;
00160         }
00161 
00162         Matrix<double> Div(Matrix<double>& m1, Matrix<double>& m2)
00163         {
00164                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00165                 {
00166                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00167                         Utility::RunTimeError("Matrix dimensions does not match!");
00168                 }
00169                 
00170                 Matrix<double> temp(m1.Rows(), m1.Columns());
00171                 vdDiv(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00172                 return temp;
00173         }
00174 
00175 
00176         Vector<float>& DivI(Vector<float>& m1, Vector<float>& m2)
00177         {
00178                 if(m1.Length() != m2.Length())
00179                 {
00180                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00181                         Utility::RunTimeError("Vector lengths are not the same!");
00182                 }
00183                 
00184                 vsDiv(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00185                 return m1;
00186         }
00187 
00188         Vector<double>& DivI(Vector<double>& m1, Vector<double>& m2)
00189         {
00190                 if(m1.Length() != m2.Length())
00191                 {
00192                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00193                         Utility::RunTimeError("Vector lengths are not the same!");
00194                 }
00195                 
00196                 vdDiv(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00197                 return m1;
00198         }
00199 
00200         Matrix<float>& DivI(Matrix<float>& m1, Matrix<float>& m2)
00201         {
00202                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00203                 {
00204                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00205                         Utility::RunTimeError("Matrix dimensions does not match!");
00206                 }
00207                 
00208                 vsDiv(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00209                 return m1;
00210         }
00211 
00212         Matrix<double>& DivI(Matrix<double>& m1, Matrix<double>& m2)
00213         {
00214                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00215                 {
00216                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00217                         Utility::RunTimeError("Matrix dimensions does not match!");
00218                 }
00219                 
00220                 vdDiv(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00221                 return m1;
00222         }
00223 
00224 
00225         // Square root of elements
00226         Vector<float> Sqrt(Vector<float>& m)
00227         {
00228                 Vector<float> temp(m.Length());
00229                 vsSqrt(m.Length(), m.Data(), temp.Data());
00230                 return temp;
00231         }
00232 
00233         Vector<double> Sqrt(Vector<double>& m)
00234         {
00235                 Vector<double> temp(m.Length());
00236                 vdSqrt(m.Length(), m.Data(), temp.Data());
00237                 return temp;
00238         }
00239 
00240         Matrix<float> Sqrt(Matrix<float>& m)
00241         {
00242                 Matrix<float> temp(m.Rows(), m.Columns());
00243                 vsSqrt(m.Length(), m.Data(), temp.Data());
00244                 return temp;
00245         }
00246 
00247         Matrix<double> Sqrt(Matrix<double>& m)
00248         {
00249                 Matrix<double> temp(m.Rows(), m.Columns());
00250                 vdSqrt(m.Length(), m.Data(), temp.Data());
00251                 return temp;
00252         }
00253 
00254 
00255         Vector<float>& SqrtI(Vector<float>& m)
00256         {
00257                 vsSqrt(m.Length(), m.Data(), m.Data());
00258                 return m;
00259         }
00260 
00261         Vector<double>& SqrtI(Vector<double>& m)
00262         {
00263                 vdSqrt(m.Length(), m.Data(), m.Data());
00264                 return m;
00265         }
00266 
00267         Matrix<float>& SqrtI(Matrix<float>& m)
00268         {
00269                 vsSqrt(m.Length(), m.Data(), m.Data());
00270                 return m;
00271         }
00272 
00273         Matrix<double>& SqrtI(Matrix<double>& m)
00274         {
00275                 vdSqrt(m.Length(), m.Data(), m.Data());
00276                 return m;
00277         }
00278 
00279 
00280         // Inverse Square root of elements
00281         Vector<float> InvSqrt(Vector<float>& m)
00282         {
00283                 Vector<float> temp(m.Length());
00284                 vsInvSqrt(m.Length(), m.Data(), temp.Data());
00285                 return temp;
00286         }
00287 
00288         Vector<double> InvSqrt(Vector<double>& m)
00289         {
00290                 Vector<double> temp(m.Length());
00291                 vdInvSqrt(m.Length(), m.Data(), temp.Data());
00292                 return temp;
00293         }
00294 
00295         Matrix<float> InvSqrt(Matrix<float>& m)
00296         {
00297                 Matrix<float> temp(m.Rows(), m.Columns());
00298                 vsInvSqrt(m.Length(), m.Data(), temp.Data());
00299                 return temp;
00300         }
00301 
00302         Matrix<double> InvSqrt(Matrix<double>& m)
00303         {
00304                 Matrix<double> temp(m.Rows(), m.Columns());
00305                 vdInvSqrt(m.Length(), m.Data(), temp.Data());
00306                 return temp;
00307         }
00308 
00309 
00310         Vector<float>& InvSqrtI(Vector<float>& m)
00311         {
00312                 vsInvSqrt(m.Length(), m.Data(), m.Data());
00313                 return m;
00314         }
00315 
00316         Vector<double>& InvSqrtI(Vector<double>& m)
00317         {
00318                 vdInvSqrt(m.Length(), m.Data(), m.Data());
00319                 return m;
00320         }
00321 
00322         Matrix<float>& InvSqrtI(Matrix<float>& m)
00323         {
00324                 vsInvSqrt(m.Length(), m.Data(), m.Data());
00325                 return m;
00326         }
00327 
00328         Matrix<double>& InvSqrtI(Matrix<double>& m)
00329         {
00330                 vdInvSqrt(m.Length(), m.Data(), m.Data());
00331                 return m;
00332         }
00333 
00334 
00335         // Cube root of elements
00336         Vector<float> Cbrt(Vector<float>& m)
00337         {
00338                 Vector<float> temp(m.Length());
00339                 vsCbrt(m.Length(), m.Data(), temp.Data());
00340                 return temp;
00341         }
00342         
00343         Vector<double> Cbrt(Vector<double>& m)
00344         {
00345                 Vector<double> temp(m.Length());
00346                 vdCbrt(m.Length(), m.Data(), temp.Data());
00347                 return temp;
00348         }
00349         
00350         Matrix<float> Cbrt(Matrix<float>& m)
00351         {
00352                 Matrix<float> temp(m.Rows(), m.Columns());
00353                 vsCbrt(m.Length(), m.Data(), temp.Data());
00354                 return temp;
00355         }
00356         
00357         Matrix<double> Cbrt(Matrix<double>& m)
00358         {
00359                 Matrix<double> temp(m.Rows(), m.Columns());
00360                 vdCbrt(m.Length(), m.Data(), temp.Data());
00361                 return temp;
00362         }
00363         
00364         
00365         Vector<float>& CbrtI(Vector<float>& m)
00366         {
00367                 vsCbrt(m.Length(), m.Data(), m.Data());
00368                 return m;
00369         }
00370         
00371         Vector<double>& CbrtI(Vector<double>& m)
00372         {
00373                 vdCbrt(m.Length(), m.Data(), m.Data());
00374                 return m;
00375         }
00376         
00377         Matrix<float>& CbrtI(Matrix<float>& m)
00378         {
00379                 vsCbrt(m.Length(), m.Data(), m.Data());
00380                 return m;
00381         }
00382         
00383         Matrix<double>& CbrtI(Matrix<double>& m)
00384         {
00385                 vdCbrt(m.Length(), m.Data(), m.Data());
00386                 return m;
00387         }
00388         
00389 
00390         // Cube root of elements
00391         Vector<float> InvCbrt(Vector<float>& m)
00392         {
00393                 Vector<float> temp(m.Length());
00394                 vsInvCbrt(m.Length(), m.Data(), temp.Data());
00395                 return temp;
00396         }
00397         
00398         Vector<double> InvCbrt(Vector<double>& m)
00399         {
00400                 Vector<double> temp(m.Length());
00401                 vdInvCbrt(m.Length(), m.Data(), temp.Data());
00402                 return temp;
00403         }
00404         
00405         Matrix<float> InvCbrt(Matrix<float>& m)
00406         {
00407                 Matrix<float> temp(m.Rows(), m.Columns());
00408                 vsInvCbrt(m.Length(), m.Data(), temp.Data());
00409                 return temp;
00410         }
00411         
00412         Matrix<double> InvCbrt(Matrix<double>& m)
00413         {
00414                 Matrix<double> temp(m.Rows(), m.Columns());
00415                 vdInvCbrt(m.Length(), m.Data(), temp.Data());
00416                 return temp;
00417         }
00418         
00419         
00420         Vector<float>& InvCbrtI(Vector<float>& m)
00421         {
00422                 vsInvCbrt(m.Length(), m.Data(), m.Data());
00423                 return m;
00424         }
00425         
00426         Vector<double>& InvCbrtI(Vector<double>& m)
00427         {
00428                 vdInvCbrt(m.Length(), m.Data(), m.Data());
00429                 return m;
00430         }
00431         
00432         Matrix<float>& InvCbrtI(Matrix<float>& m)
00433         {
00434                 vsInvCbrt(m.Length(), m.Data(), m.Data());
00435                 return m;
00436         }
00437         
00438         Matrix<double>& InvCbrtI(Matrix<double>& m)
00439         {
00440                 vdInvCbrt(m.Length(), m.Data(), m.Data());
00441                 return m;
00442         }
00443         
00444         
00445         // Pow of elements
00446         Vector<float> Pow(Vector<float>& m1, Vector<float>& m2)
00447         {
00448                 if(m1.Length() != m2.Length())
00449                 {
00450                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00451                         Utility::RunTimeError("Vector lengths are not the same!");
00452                 }
00453                 
00454                 Vector<float> temp(m1.Length());
00455                 vsPow(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00456                 return temp;
00457         }
00458         
00459         Vector<double> Pow(Vector<double>& m1, Vector<double>& m2)
00460         {
00461                 if(m1.Length() != m2.Length())
00462                 {
00463                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00464                         Utility::RunTimeError("Vector lengths are not the same!");
00465                 }
00466                 
00467                 Vector<double> temp(m1.Length());
00468                 vdPow(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00469                 return temp;
00470         }
00471         
00472         Matrix<float> Pow(Matrix<float>& m1, Matrix<float>& m2)
00473         {
00474                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00475                 {
00476                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00477                         Utility::RunTimeError("Matrix dimensions does not match!");
00478                 }
00479                 
00480                 Matrix<float> temp(m1.Rows(), m1.Columns());
00481                 vsPow(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00482                 return temp;
00483         }
00484         
00485         Matrix<double> Pow(Matrix<double>& m1, Matrix<double>& m2)
00486         {
00487                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00488                 {
00489                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00490                         Utility::RunTimeError("Matrix dimensions does not match!");
00491                 }
00492                 
00493                 Matrix<double> temp(m1.Rows(), m1.Columns());
00494                 vdPow(m1.Length(), m1.Data(), m2.Data(), temp.Data());
00495                 return temp;
00496         }
00497         
00498         
00499         Vector<float>& PowI(Vector<float>& m1, Vector<float>& m2)
00500         {
00501                 if(m1.Length() != m2.Length())
00502                 {
00503                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00504                         Utility::RunTimeError("Vector lengths are not the same!");
00505                 }
00506                 
00507                 vsPow(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00508                 return m1;
00509         }
00510         
00511         Vector<double>& PowI(Vector<double>& m1, Vector<double>& m2)
00512         {
00513                 if(m1.Length() != m2.Length())
00514                 {
00515                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00516                         Utility::RunTimeError("Vector lengths are not the same!");
00517                 }
00518                 
00519                 vdPow(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00520                 return m1;
00521         }
00522         
00523         Matrix<float>& PowI(Matrix<float>& m1, Matrix<float>& m2)
00524         {
00525                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00526                 {
00527                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00528                         Utility::RunTimeError("Matrix dimensions does not match!");
00529                 }
00530                 
00531                 vsPow(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00532                 return m1;
00533         }
00534         
00535         Matrix<double>& PowI(Matrix<double>& m1, Matrix<double>& m2)
00536         {
00537                 if(m1.Rows() != m2.Rows() || m1.Columns() != m2.Columns())
00538                 {
00539                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00540                         Utility::RunTimeError("Matrix dimensions does not match!");
00541                 }
00542                 
00543                 vdPow(m1.Length(), m1.Data(), m2.Data(), m1.Data());
00544                 return m1;
00545         }
00546         
00547         
00548         // Pow of vector elements to a constant
00549         Vector<float> Powx(Vector<float>& m1, const float m2)
00550         {
00551                 Vector<float> temp(m1.Length());
00552                 vsPowx(m1.Length(), m1.Data(), m2, temp.Data());
00553                 return temp;
00554         }
00555         
00556         Vector<double> Powx(Vector<double>& m1, const double m2)
00557         {
00558                 Vector<double> temp(m1.Length());
00559                 vdPowx(m1.Length(), m1.Data(), m2, temp.Data());
00560                 return temp;
00561         }
00562         
00563         Matrix<float> Powx(Matrix<float>& m1, const float m2)
00564         {
00565                 Matrix<float> temp(m1.Rows(), m1.Columns());
00566                 vsPowx(m1.Length(), m1.Data(), m2, temp.Data());
00567                 return temp;
00568         }
00569         
00570         Matrix<double> Powx(Matrix<double>& m1, const double m2)
00571         {
00572                 Matrix<double> temp(m1.Rows(), m1.Columns());
00573                 vdPowx(m1.Length(), m1.Data(), m2, temp.Data());
00574                 return temp;
00575         }
00576         
00577         
00578         Vector<float>& PowxI(Vector<float>& m1, const float m2)
00579         {
00580                 vsPowx(m1.Length(), m1.Data(), m2, m1.Data());
00581                 return m1;
00582         }
00583         
00584         Vector<double>& PowxI(Vector<double>& m1, const double m2)
00585         {
00586                 vdPowx(m1.Length(), m1.Data(), m2, m1.Data());
00587                 return m1;
00588         }
00589         
00590         Matrix<float>& PowxI(Matrix<float>& m1, const float m2)
00591         {
00592                 vsPowx(m1.Length(), m1.Data(), m2, m1.Data());
00593                 return m1;
00594         }
00595         
00596         Matrix<double>& PowxI(Matrix<double>& m1, const double m2)
00597         {
00598                 vdPowx(m1.Length(), m1.Data(), m2, m1.Data());
00599                 return m1;
00600         }
00601         
00602         
00603         
00604         
00605         // Exponent of elements
00606         Vector<float> Exp(Vector<float>& m)
00607         {
00608                 Vector<float> temp(m.Length());
00609                 vsExp(m.Length(), m.Data(), temp.Data());
00610                 return temp;
00611         }
00612         
00613         Vector<double> Exp(Vector<double>& m)
00614         {
00615                 Vector<double> temp(m.Length());
00616                 vdExp(m.Length(), m.Data(), temp.Data());
00617                 return temp;
00618         }
00619         
00620         Matrix<float> Exp(Matrix<float>& m)
00621         {
00622                 Matrix<float> temp(m.Rows(), m.Columns());
00623                 vsExp(m.Length(), m.Data(), temp.Data());
00624                 return temp;
00625         }
00626         
00627         Matrix<double> Exp(Matrix<double>& m)
00628         {
00629                 Matrix<double> temp(m.Rows(), m.Columns());
00630                 vdExp(m.Length(), m.Data(), temp.Data());
00631                 return temp;
00632         }
00633         
00634         
00635         Vector<float>& ExpI(Vector<float>& m)
00636         {
00637                 vsExp(m.Length(), m.Data(), m.Data());
00638                 return m;
00639         }
00640         
00641         Vector<double>& ExpI(Vector<double>& m)
00642         {
00643                 vdExp(m.Length(), m.Data(), m.Data());
00644                 return m;
00645         }
00646         
00647         Matrix<float>& ExpI(Matrix<float>& m)
00648         {
00649                 vsExp(m.Length(), m.Data(), m.Data());
00650                 return m;
00651         }
00652         
00653         Matrix<double>& ExpI(Matrix<double>& m)
00654         {
00655                 vdExp(m.Length(), m.Data(), m.Data());
00656                 return m;
00657         }
00658         
00659         
00660         
00661         // Ln of elements
00662         Vector<float> Ln(Vector<float>& m)
00663         {
00664                 Vector<float> temp(m.Length());
00665                 vsLn(m.Length(), m.Data(), temp.Data());
00666                 return temp;
00667         }
00668         
00669         Vector<double> Ln(Vector<double>& m)
00670         {
00671                 Vector<double> temp(m.Length());
00672                 vdLn(m.Length(), m.Data(), temp.Data());
00673                 return temp;
00674         }
00675         
00676         Matrix<float> Ln(Matrix<float>& m)
00677         {
00678                 Matrix<float> temp(m.Rows(), m.Columns());
00679                 vsLn(m.Length(), m.Data(), temp.Data());
00680                 return temp;
00681         }
00682         
00683         Matrix<double> Ln(Matrix<double>& m)
00684         {
00685                 Matrix<double> temp(m.Rows(), m.Columns());
00686                 vdLn(m.Length(), m.Data(), temp.Data());
00687                 return temp;
00688         }
00689         
00690         
00691         Vector<float>& LnI(Vector<float>& m)
00692         {
00693                 vsLn(m.Length(), m.Data(), m.Data());
00694                 return m;
00695         }
00696         
00697         Vector<double>& LnI(Vector<double>& m)
00698         {
00699                 vdLn(m.Length(), m.Data(), m.Data());
00700                 return m;
00701         }
00702         
00703         Matrix<float>& LnI(Matrix<float>& m)
00704         {
00705                 vsLn(m.Length(), m.Data(), m.Data());
00706                 return m;
00707         }
00708         
00709         Matrix<double>& LnI(Matrix<double>& m)
00710         {
00711                 vdLn(m.Length(), m.Data(), m.Data());
00712                 return m;
00713         }
00714         
00715         
00716         // Log10 of elements
00717         Vector<float> Log10(Vector<float>& m)
00718         {
00719                 Vector<float> temp(m.Length());
00720                 vsLog10(m.Length(), m.Data(), temp.Data());
00721                 return temp;
00722         }
00723         
00724         Vector<double> Log10(Vector<double>& m)
00725         {
00726                 Vector<double> temp(m.Length());
00727                 vdLog10(m.Length(), m.Data(), temp.Data());
00728                 return temp;
00729         }
00730         
00731         Matrix<float> Log10(Matrix<float>& m)
00732         {
00733                 Matrix<float> temp(m.Rows(), m.Columns());
00734                 vsLog10(m.Length(), m.Data(), temp.Data());
00735                 return temp;
00736         }
00737         
00738         Matrix<double> Log10(Matrix<double>& m)
00739         {
00740                 Matrix<double> temp(m.Rows(), m.Columns());
00741                 vdLog10(m.Length(), m.Data(), temp.Data());
00742                 return temp;
00743         }
00744         
00745         
00746         Vector<float>& Log10I(Vector<float>& m)
00747         {
00748                 vsLog10(m.Length(), m.Data(), m.Data());
00749                 return m;
00750         }
00751         
00752         Vector<double>& Log10I(Vector<double>& m)
00753         {
00754                 vdLog10(m.Length(), m.Data(), m.Data());
00755                 return m;
00756         }
00757         
00758         Matrix<float>& Log10I(Matrix<float>& m)
00759         {
00760                 vsLog10(m.Length(), m.Data(), m.Data());
00761                 return m;
00762         }
00763         
00764         Matrix<double>& Log10I(Matrix<double>& m)
00765         {
00766                 vdLog10(m.Length(), m.Data(), m.Data());
00767                 return m;
00768         }
00769         
00770         
00771         
00772         // Cos of elements
00773         Vector<float> Cos(Vector<float>& m)
00774         {
00775                 Vector<float> temp(m.Length());
00776                 vsCos(m.Length(), m.Data(), temp.Data());
00777                 return temp;
00778         }
00779         
00780         Vector<double> Cos(Vector<double>& m)
00781         {
00782                 Vector<double> temp(m.Length());
00783                 vdCos(m.Length(), m.Data(), temp.Data());
00784                 return temp;
00785         }
00786         
00787         Matrix<float> Cos(Matrix<float>& m)
00788         {
00789                 Matrix<float> temp(m.Rows(), m.Columns());
00790                 vsCos(m.Length(), m.Data(), temp.Data());
00791                 return temp;
00792         }
00793         
00794         Matrix<double> Cos(Matrix<double>& m)
00795         {
00796                 Matrix<double> temp(m.Rows(), m.Columns());
00797                 vdCos(m.Length(), m.Data(), temp.Data());
00798                 return temp;
00799         }
00800         
00801         
00802         Vector<float>& CosI(Vector<float>& m)
00803         {
00804                 vsCos(m.Length(), m.Data(), m.Data());
00805                 return m;
00806         }
00807         
00808         Vector<double>& CosI(Vector<double>& m)
00809         {
00810                 vdCos(m.Length(), m.Data(), m.Data());
00811                 return m;
00812         }
00813         
00814         Matrix<float>& CosI(Matrix<float>& m)
00815         {
00816                 vsCos(m.Length(), m.Data(), m.Data());
00817                 return m;
00818         }
00819         
00820         Matrix<double>& CosI(Matrix<double>& m)
00821         {
00822                 vdCos(m.Length(), m.Data(), m.Data());
00823                 return m;
00824         }
00825         
00826         
00827         // Sin of elements
00828         Vector<float> Sin(Vector<float>& m)
00829         {
00830                 Vector<float> temp(m.Length());
00831                 vsSin(m.Length(), m.Data(), temp.Data());
00832                 return temp;
00833         }
00834         
00835         Vector<double> Sin(Vector<double>& m)
00836         {
00837                 Vector<double> temp(m.Length());
00838                 vdSin(m.Length(), m.Data(), temp.Data());
00839                 return temp;
00840         }
00841         
00842         Matrix<float> Sin(Matrix<float>& m)
00843         {
00844                 Matrix<float> temp(m.Rows(), m.Columns());
00845                 vsSin(m.Length(), m.Data(), temp.Data());
00846                 return temp;
00847         }
00848         
00849         Matrix<double> Sin(Matrix<double>& m)
00850         {
00851                 Matrix<double> temp(m.Rows(), m.Columns());
00852                 vdSin(m.Length(), m.Data(), temp.Data());
00853                 return temp;
00854         }
00855         
00856         
00857         Vector<float>& SinI(Vector<float>& m)
00858         {
00859                 vsSin(m.Length(), m.Data(), m.Data());
00860                 return m;
00861         }
00862         
00863         Vector<double>& SinI(Vector<double>& m)
00864         {
00865                 vdSin(m.Length(), m.Data(), m.Data());
00866                 return m;
00867         }
00868         
00869         Matrix<float>& SinI(Matrix<float>& m)
00870         {
00871                 vsSin(m.Length(), m.Data(), m.Data());
00872                 return m;
00873         }
00874         
00875         Matrix<double>& SinI(Matrix<double>& m)
00876         {
00877                 vdSin(m.Length(), m.Data(), m.Data());
00878                 return m;
00879         }
00880         
00881         
00882         // Tan of elements
00883         Vector<float> Tan(Vector<float>& m)
00884         {
00885                 Vector<float> temp(m.Length());
00886                 vsTan(m.Length(), m.Data(), temp.Data());
00887                 return temp;
00888         }
00889         
00890         Vector<double> Tan(Vector<double>& m)
00891         {
00892                 Vector<double> temp(m.Length());
00893                 vdTan(m.Length(), m.Data(), temp.Data());
00894                 return temp;
00895         }
00896         
00897         Matrix<float> Tan(Matrix<float>& m)
00898         {
00899                 Matrix<float> temp(m.Rows(), m.Columns());
00900                 vsTan(m.Length(), m.Data(), temp.Data());
00901                 return temp;
00902         }
00903         
00904         Matrix<double> Tan(Matrix<double>& m)
00905         {
00906                 Matrix<double> temp(m.Rows(), m.Columns());
00907                 vdTan(m.Length(), m.Data(), temp.Data());
00908                 return temp;
00909         }
00910         
00911         
00912         Vector<float>& TanI(Vector<float>& m)
00913         {
00914                 vsTan(m.Length(), m.Data(), m.Data());
00915                 return m;
00916         }
00917         
00918         Vector<double>& TanI(Vector<double>& m)
00919         {
00920                 vdTan(m.Length(), m.Data(), m.Data());
00921                 return m;
00922         }
00923         
00924         Matrix<float>& TanI(Matrix<float>& m)
00925         {
00926                 vsTan(m.Length(), m.Data(), m.Data());
00927                 return m;
00928         }
00929         
00930         Matrix<double>& TanI(Matrix<double>& m)
00931         {
00932                 vdTan(m.Length(), m.Data(), m.Data());
00933                 return m;
00934         }
00935         
00936         
00937         // Acos of elements
00938         Vector<float> Acos(Vector<float>& m)
00939         {
00940                 Vector<float> temp(m.Length());
00941                 vsAcos(m.Length(), m.Data(), temp.Data());
00942                 return temp;
00943         }
00944         
00945         Vector<double> Acos(Vector<double>& m)
00946         {
00947                 Vector<double> temp(m.Length());
00948                 vdAcos(m.Length(), m.Data(), temp.Data());
00949                 return temp;
00950         }
00951         
00952         Matrix<float> Acos(Matrix<float>& m)
00953         {
00954                 Matrix<float> temp(m.Rows(), m.Columns());
00955                 vsAcos(m.Length(), m.Data(), temp.Data());
00956                 return temp;
00957         }
00958         
00959         Matrix<double> Acos(Matrix<double>& m)
00960         {
00961                 Matrix<double> temp(m.Rows(), m.Columns());
00962                 vdAcos(m.Length(), m.Data(), temp.Data());
00963                 return temp;
00964         }
00965         
00966         
00967         Vector<float>& AcosI(Vector<float>& m)
00968         {
00969                 vsAcos(m.Length(), m.Data(), m.Data());
00970                 return m;
00971         }
00972         
00973         Vector<double>& AcosI(Vector<double>& m)
00974         {
00975                 vdAcos(m.Length(), m.Data(), m.Data());
00976                 return m;
00977         }
00978         
00979         Matrix<float>& AcosI(Matrix<float>& m)
00980         {
00981                 vsAcos(m.Length(), m.Data(), m.Data());
00982                 return m;
00983         }
00984         
00985         Matrix<double>& AcosI(Matrix<double>& m)
00986         {
00987                 vdAcos(m.Length(), m.Data(), m.Data());
00988                 return m;
00989         }
00990         
00991         
00992         // Asin of elements
00993         Vector<float> Asin(Vector<float>& m)
00994         {
00995                 Vector<float> temp(m.Length());
00996                 vsAsin(m.Length(), m.Data(), temp.Data());
00997                 return temp;
00998         }
00999         
01000         Vector<double> Asin(Vector<double>& m)
01001         {
01002                 Vector<double> temp(m.Length());
01003                 vdAsin(m.Length(), m.Data(), temp.Data());
01004                 return temp;
01005         }
01006         
01007         Matrix<float> Asin(Matrix<float>& m)
01008         {
01009                 Matrix<float> temp(m.Rows(), m.Columns());
01010                 vsAsin(m.Length(), m.Data(), temp.Data());
01011                 return temp;
01012         }
01013         
01014         Matrix<double> Asin(Matrix<double>& m)
01015         {
01016                 Matrix<double> temp(m.Rows(), m.Columns());
01017                 vdAsin(m.Length(), m.Data(), temp.Data());
01018                 return temp;
01019         }
01020         
01021         
01022         Vector<float>& AsinI(Vector<float>& m)
01023         {
01024                 vsAsin(m.Length(), m.Data(), m.Data());
01025                 return m;
01026         }
01027         
01028         Vector<double>& AsinI(Vector<double>& m)
01029         {
01030                 vdAsin(m.Length(), m.Data(), m.Data());
01031                 return m;
01032         }
01033         
01034         Matrix<float>& AsinI(Matrix<float>& m)
01035         {
01036                 vsAsin(m.Length(), m.Data(), m.Data());
01037                 return m;
01038         }
01039         
01040         Matrix<double>& AsinI(Matrix<double>& m)
01041         {
01042                 vdAsin(m.Length(), m.Data(), m.Data());
01043                 return m;
01044         }
01045         
01046         
01047         // Atan of elements
01048         Vector<float> Atan(Vector<float>& m)
01049         {
01050                 Vector<float> temp(m.Length());
01051                 vsAtan(m.Length(), m.Data(), temp.Data());
01052                 return temp;
01053         }
01054         
01055         Vector<double> Atan(Vector<double>& m)
01056         {
01057                 Vector<double> temp(m.Length());
01058                 vdAtan(m.Length(), m.Data(), temp.Data());
01059                 return temp;
01060         }
01061         
01062         Matrix<float> Atan(Matrix<float>& m)
01063         {
01064                 Matrix<float> temp(m.Rows(), m.Columns());
01065                 vsAtan(m.Length(), m.Data(), temp.Data());
01066                 return temp;
01067         }
01068         
01069         Matrix<double> Atan(Matrix<double>& m)
01070         {
01071                 Matrix<double> temp(m.Rows(), m.Columns());
01072                 vdAtan(m.Length(), m.Data(), temp.Data());
01073                 return temp;
01074         }
01075         
01076         
01077         Vector<float>& AtanI(Vector<float>& m)
01078         {
01079                 vsAtan(m.Length(), m.Data(), m.Data());
01080                 return m;
01081         }
01082         
01083         Vector<double>& AtanI(Vector<double>& m)
01084         {
01085                 vdAtan(m.Length(), m.Data(), m.Data());
01086                 return m;
01087         }
01088         
01089         Matrix<float>& AtanI(Matrix<float>& m)
01090         {
01091                 vsAtan(m.Length(), m.Data(), m.Data());
01092                 return m;
01093         }
01094         
01095         Matrix<double>& AtanI(Matrix<double>& m)
01096         {
01097                 vdAtan(m.Length(), m.Data(), m.Data());
01098                 return m;
01099         }
01100         
01101         
01102         // Atan2 of elements
01103         Vector<float> Atan2(Vector<float>& m1, Vector<float>& m2)
01104         {
01105                 if(m1.Length() != m2.Length())
01106                 {
01107                         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
01108