Content |
LU-Zerlegung: Vorbereitung
Wir werden zunächst die ungeblockte LU-Zerlegung hpc::ulmlapack::getf2 implementieren. Dazu sind zunächst weitere BLAS Bausteine notwendig:
-
hpc::ulmblas::ger für die Rang-1 Operation \(A \leftarrow A + \alpha x\,y^T\).
-
hpc::ulmblas::scal für die Vektorskalierung \(x \leftarrow \alpha x\).
-
hpc::ulmblas::iamax für die Bestimmung eines Index \(i\) mit \(|\,x_i| = \max\limits_{j} |\,x_j|\)
-
hpc::ulmblas::swap für die Vertauschung \(x \leftrightarrow y\) zweier Vektoren.
Das Vorlesungsprojekt soll um diese Bausteine erweitert werden. Dazu sollen zunächst die Signaturen vorgegeben werden.
hpc::ulmblas::ger
#ifndef HPC_ULMBLAS_GER_H #define HPC_ULMBLAS_GER_H 1 #include <utility> namespace hpc { namespace ulmblas { template <typename Index, typename Alpha, typename TX, typename TY, typename TA> void ger(Index m, Index n, const Alpha &alpha, const TX *x, Index incX, const TY *y, Index incY, TA *A, Index incRowA, Index incColA) { /* ... */ } } } // namespace ulmblas, hpc #endif // HPC_ULMBLAS_GER_H
hpc::ulmblas::scal
#ifndef HPC_ULMBLAS_SCAL_H #define HPC_ULMBLAS_SCAL_H 1 namespace hpc { namespace ulmblas { template <typename Index, typename Alpha, typename TX> void scal(Index n, const Alpha &alpha, TX *x, Index incX) { /* ... */ } } } // namespace ulmblas, hpc #endif // HPC_ULMBLAS_SCAL_H
hpc::ulmblas::iamax
#ifndef HPC_ULMBLAS_IAMAX_H #define HPC_ULMBLAS_IAMAX_H 1 #include <cmath> namespace hpc { namespace ulmblas { template <typename Index, typename TX> Index iamax(Index n, const TX *x, Index incX) { /* ... */ } } } // namespace ulmblas, hpc #endif // HPC_ULMBLAS_IAMAX_H
hpc::ulmblas::swap
#ifndef HPC_ULMBLAS_SWAP_H #define HPC_ULMBLAS_SWAP_H 1 #include <utility> namespace hpc { namespace ulmblas { template <typename Index, typename TX, typename TY> void swap(Index n, TX *x, Index incX, TY *y, Index incY) { /* ... */ } } } // namespace ulmblas, hpc #endif // HPC_ULMBLAS_SWAP_H
Aufgaben
Implementiert diese Funktionen. Als Test wird die ungeblockte LU-Zerlegung auf der nächsten Seite dienen.