//===================================================== // File : blitz_LU_solve_interface.hh // Author : L. Plagne <laurent.plagne@edf.fr)> // Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 //===================================================== // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BLITZ_LU_SOLVE_INTERFACE_HH #define BLITZ_LU_SOLVE_INTERFACE_HH
#include"blitz/array.h" #include <vector>
BZ_USING_NAMESPACE(blitz)
template<class real> class blitz_LU_solve_interface : public blitz_interface<real>
{
// Pour conserver le meme header, on travaille sur X, copie du second-membre B
X = B.copy() ;
ASSERT( LU.rows()==LU.cols() ) ;
firstIndex indI ; // Forward substitution : int ii = 0 ;
real theSum = 0. ; for( int i=0; i<N; i++ ) { int ip = pivot( i ) ;
theSum = X( ip ) ; // theSum = B( ip ) ;
X( ip ) = X( i ) ; // B( ip ) = B( i ) ; if( ii ) {
theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ; // theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ; // theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;
} elseif( theSum ) {
ii = i+1 ;
}
X( i ) = theSum ; // B( i ) = theSum ;
} // Backsubstitution : for( int i=N-1; i>=0; i-- ) {
theSum = X( i ) ; // theSum = B( i ) ;
theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; // Store a component of the solution vector :
X( i ) = theSum/LU( i, i ) ; // B( i ) = theSum/LU( i, i ) ;
}
}
};
#endif
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-06-06)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.