00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Math Library 00005 * Module : LinearAlgebraHelper 00006 * Package : Zeus.ZeusMath.System 00007 * Author : Benjamin Hadorn and Martin Abbuehl 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef LinearAlgebraHelperH 00033 #define LinearAlgebraHelperH 00034 00035 00036 #include <zeusmath/Config/PlatformDefines.hpp> 00037 00038 00039 BEGIN_NAMESPACE_Zeus 00040 00041 class TMatrix; 00042 00043 /******************************************************************************/ 00047 /******************************************************************************/ 00048 zeusmath_class TLinearAlgebraHelper 00049 { 00050 public: 00051 static Float calcDeterminant2(const Float& a11, const Float& a12, 00052 const Float& a21, const Float& a22); 00053 00054 static Float calcDeterminant3(const Float& a11, const Float& a12, const Float& a13, 00055 const Float& a21, const Float& a22, const Float& a23, 00056 const Float& a31, const Float& a32, const Float& a33); 00057 00058 static Float calcDeterminant(const TMatrix& rMatrix); 00059 00060 private: 00062 inline TLinearAlgebraHelper() { } 00064 inline virtual ~TLinearAlgebraHelper() { } 00065 }; 00066 00067 00068 00069 00070 /**************************************************************************/ 00080 /**************************************************************************/ 00081 inline /* static */ Float TLinearAlgebraHelper::calcDeterminant2(const Float& a11, 00082 const Float& a12, 00083 const Float& a21, 00084 const Float& a22) 00085 { 00086 return a11 * a22 - a21 * a12; 00087 } 00088 00089 00090 00091 /**************************************************************************/ 00106 /**************************************************************************/ 00107 inline /* static */ Float TLinearAlgebraHelper::calcDeterminant3(const Float& a11, 00108 const Float& a12, 00109 const Float& a13, 00110 const Float& a21, 00111 const Float& a22, 00112 const Float& a23, 00113 const Float& a31, 00114 const Float& a32, 00115 const Float& a33) 00116 { 00117 return + a11 * a22 * a33 00118 + a21 * a32 * a13 00119 + a31 * a12 * a23 00120 - a31 * a22 * a13 00121 - a32 * a23 * a11 00122 - a33 * a21 * a12; 00123 } 00124 00125 00126 END_NAMESPACE_Zeus 00127 00128 00129 #endif 00130