solve_linsys.cpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002     
00003     solve_linsys.cpp -- See declarations in solve_linsys.hpp.
00004         ADD ADDITIONAL FILE DESCRIPTION HERE
00005 
00006     This file is a part of the Arageli library.
00007 
00008     Copyright (C) Nikolai Yu. Zolotykh, 1999--2006
00009     Copyright (C) Sergey S. Lyalin, 2006
00010     Copyright (C) Anna Bestaeva, 2006
00011     University of Nizhni Novgorod, Russia
00012 
00013 *****************************************************************************/
00014 
00021 #include "config.hpp"
00022 
00023 #if !defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE) || \
00024     defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE_solve_linsys)
00025 
00026 #include "gauss.hpp"
00027 
00028 #include "solve_linsys.hpp"
00029 
00030 
00031 namespace Arageli
00032 {
00033 
00034 
00035 template <typename A, typename B, typename X>
00036 solve_linsys_result solve_linsys (const A& a, const B& b, X& x)
00037 {
00038     // WARNING! Slow and temporary implementation.
00039     
00040     ARAGELI_ASSERT_0(a.is_square());
00041 
00042     try
00043     {
00044         x = inverse(a)*b;
00045         return SLR_UNIQUE;
00046     }
00047     catch(const matrix_is_singular& e)
00048     { return SLR_MULTIPLE; }
00049 }
00050 
00051 
00053 
00059 template <typename A, typename B>
00060 B solve_linsys (const A& a, const B& b)
00061 {
00062     // WARNING! Slow and temporary implementation.
00063     
00064     ARAGELI_ASSERT_0(a.is_square());
00065 
00066     try { return inverse(a)*b; }
00067     catch(const matrix_is_singular& e)
00068     { throw no_unique_solution(); }
00069 }
00070 
00071 
00072 }
00073 
00074 
00075 #else   // #if !defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE) || ...
00076 
00077 
00078 namespace Arageli
00079 {
00080 
00081 // PLACE ALL NOT TEMPLATE NOT INLINE IMPLEMENTATIONS HERE
00082 
00083 }
00084 
00085 
00086 #endif  // #if !defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE) || ...

Generated on Thu Aug 31 17:38:11 2006 for Arageli by  doxygen 1.4.7