77/*
88*
99* Content:
10- * Example of solving a system of linear equations with general
11- * block tridiagonal coefficient matrix
10+ * Example of solving a system of linear equations with general
11+ * block tridiagonal coefficient matrix
1212************************************************************************
1313* Purpose:
14- * ========
15- * Testing solution of a linear system of equations with general block
14+ * ========
15+ * Testing solution of a linear system of equations with general block
1616* tridiagonal matrix of coefficients
1717* D(1)*X(1) + C(1)*X(2) = F(1)
18- * B(1)*X(1) + D(2)*X(2) + C(2)*X(3) = F(2)
19- * B(2)*X(2) + D(3)*X(3) + C(3)*X(4) = F(3)
18+ * B(1)*X(1) + D(2)*X(2) + C(2)*X(3) = F(2)
19+ * B(2)*X(2) + D(3)*X(3) + C(3)*X(4) = F(3)
2020* ...
21- * B(N-2)*X(N-2) + D(N-1)*X(N-1) + C(N-1)*X(N) = F(N-1)
22- * B(N-1)*X(N-1) + D(N)*X(N) = F(N)
21+ * B(N-2)*X(N-2) + D(N-1)*X(N-1) + C(N-1)*X(N) = F(N-1)
22+ * B(N-1)*X(N-1) + D(N)*X(N) = F(N)
2323* Here D(J),B(J),C(J) are NB by NB matrices - block matrix coefficients
2424* X(J),F(J) are NB by NRHS-matrices - unknowns and RHS components
2525*
26- * Solving is done via LU factorization of the coefficient matrix
26+ * Solving is done via LU factorization of the coefficient matrix
2727* (call DGEBLTTRF) followed by call DGEBLTTRS to solve a system of
2828* equations with coefficient matrix factored by DGEBLTTRF.
2929*
3030* Coefficients and right hand sides are randomly generated.
3131*
32- * Testing is done via calculating
32+ * Testing is done via calculating
3333* max{||F(1)-D(1)*X(1)-C(1)*X(2)||,
3434* ||F(2)-B(1)*X(1)-D(1)*X(1)-C(1)*X(2)||,
3535* ...
3636* ||F(N)-B(N-1)*X(N-1)-D(N)*X(N)||}
3737*
38- * ||.|| denotes Frobenius norm of a respective matrix
38+ * ||.|| denotes Frobenius norm of a respective matrix
3939*/
4040#include < cstdint>
4141#include < iostream>
@@ -65,7 +65,7 @@ int main() {
6565 int64_t ldf = nb*n;
6666
6767 int64_t info = 0 ;
68-
68+
6969 // Asynchronous error handler
7070 auto error_handler = [&] (sycl::exception_list exceptions) {
7171 for (auto const & e : exceptions) {
@@ -83,7 +83,7 @@ int main() {
8383 }
8484 };
8585
86- sycl::device device{sycl::default_selector{} };
86+ sycl::device device{sycl::default_selector_v };
8787 sycl::queue queue (device, error_handler);
8888 sycl::context context = queue.get_context ();
8989
@@ -132,9 +132,9 @@ int main() {
132132 std::cout << " matrix by calculating ratios of residuals" << std::endl;
133133 std::cout << " to RHS vectors' norms." << std::endl;
134134
135- // LU factorization of the coefficient matrix
135+ // LU factorization of the coefficient matrix
136136 info = dgeblttrf (queue, n, nb, d.data (), dl.data (), du1.data (), du2.data (), ipiv.data ());
137- if (info) {
137+ if (info) {
138138 std::cout << " DGEBLTTRF returned nonzero INFO = " << info << std::endl;
139139 return 1 ;
140140 }
@@ -145,10 +145,10 @@ int main() {
145145 std::cout << -info << " -th parameter in call of dgeblttrs has illegal value" << std::endl;
146146 return 1 ;
147147 } else {
148- // computing the residual
148+ // computing the residual
149149 double eps = resid2 (n, nb, nrhs, dlcpy.data (), dcpy.data (), du1cpy.data (), f.data (), ldf, fcpy.data (), ldf);
150150 std::cout << " max_(i=1,...,nrhs){||ax(i)-f(i)||/||f(i)||} = " << eps << std::endl;
151- }
151+ }
152152
153153 return 0 ;
154154}
0 commit comments