@@ -40,6 +40,7 @@ struct set_matrix<T, DEVICE_CPU> {
4040 }
4141};
4242
43+ // --- 1. Matrix Decomposition ---
4344template <typename T>
4445struct lapack_trtri <T, DEVICE_CPU> {
4546 void operator ()(
@@ -73,6 +74,66 @@ struct lapack_potrf<T, DEVICE_CPU> {
7374 }
7475};
7576
77+
78+ template <typename T>
79+ struct lapack_getrf <T, DEVICE_CPU> {
80+ void operator ()(
81+ const int & m,
82+ const int & n,
83+ T* Mat,
84+ const int & lda,
85+ int * ipiv)
86+ {
87+ int info = 0 ;
88+ lapackConnector::getrf (m, n, Mat, lda, ipiv, info);
89+ if (info != 0 ) {
90+ throw std::runtime_error (" getrf failed with info = " + std::to_string (info));
91+ }
92+ }
93+ };
94+
95+ template <typename T>
96+ struct lapack_getri <T, DEVICE_CPU> {
97+ void operator ()(
98+ const int & n,
99+ T* Mat,
100+ const int & lda,
101+ const int * ipiv,
102+ T* work,
103+ const int & lwork)
104+ {
105+ int info = 0 ;
106+ lapackConnector::getri (n, Mat, lda, ipiv, work, lwork, info);
107+ if (info != 0 ) {
108+ throw std::runtime_error (" getri failed with info = " + std::to_string (info));
109+ }
110+ }
111+ };
112+
113+
114+ // --- 2. Linear System Solvers ---
115+ template <typename T>
116+ struct lapack_getrs <T, DEVICE_CPU> {
117+ void operator ()(
118+ const char & trans,
119+ const int & n,
120+ const int & nrhs,
121+ T* A,
122+ const int & lda,
123+ const int * ipiv,
124+ T* B,
125+ const int & ldb)
126+ {
127+ int info = 0 ;
128+ lapackConnector::getrs (trans, n, nrhs, A, lda, ipiv, B, ldb, info);
129+ if (info != 0 ) {
130+ throw std::runtime_error (" getrs failed with info = " + std::to_string (info));
131+ }
132+ }
133+ };
134+
135+
136+ // --- 3. Standard & Generalized Eigenvalue ---
76137template <typename T>
77138struct lapack_heevd <T, DEVICE_CPU> {
78139 using Real = typename GetTypeReal<T>::type;
@@ -338,60 +399,9 @@ struct lapack_hegvx<T, DEVICE_CPU> {
338399 }
339400};
340401
341- template <typename T>
342- struct lapack_getrf <T, DEVICE_CPU> {
343- void operator ()(
344- const int & m,
345- const int & n,
346- T* Mat,
347- const int & lda,
348- int * ipiv)
349- {
350- int info = 0 ;
351- lapackConnector::getrf (m, n, Mat, lda, ipiv, info);
352- if (info != 0 ) {
353- throw std::runtime_error (" getrf failed with info = " + std::to_string (info));
354- }
355- }
356- };
357402
358- template <typename T>
359- struct lapack_getri <T, DEVICE_CPU> {
360- void operator ()(
361- const int & n,
362- T* Mat,
363- const int & lda,
364- const int * ipiv,
365- T* work,
366- const int & lwork)
367- {
368- int info = 0 ;
369- lapackConnector::getri (n, Mat, lda, ipiv, work, lwork, info);
370- if (info != 0 ) {
371- throw std::runtime_error (" getri failed with info = " + std::to_string (info));
372- }
373- }
374- };
375403
376- template <typename T>
377- struct lapack_getrs <T, DEVICE_CPU> {
378- void operator ()(
379- const char & trans,
380- const int & n,
381- const int & nrhs,
382- T* A,
383- const int & lda,
384- const int * ipiv,
385- T* B,
386- const int & ldb)
387- {
388- int info = 0 ;
389- lapackConnector::getrs (trans, n, nrhs, A, lda, ipiv, B, ldb, info);
390- if (info != 0 ) {
391- throw std::runtime_error (" getrs failed with info = " + std::to_string (info));
392- }
393- }
394- };
404+
395405
396406template struct set_matrix <float , DEVICE_CPU>;
397407template struct set_matrix <double , DEVICE_CPU>;
@@ -408,6 +418,24 @@ template struct lapack_trtri<double, DEVICE_CPU>;
408418template struct lapack_trtri <std::complex <float >, DEVICE_CPU>;
409419template struct lapack_trtri <std::complex <double >, DEVICE_CPU>;
410420
421+
422+ template struct lapack_getrf <float , DEVICE_CPU>;
423+ template struct lapack_getrf <double , DEVICE_CPU>;
424+ template struct lapack_getrf <std::complex <float >, DEVICE_CPU>;
425+ template struct lapack_getrf <std::complex <double >, DEVICE_CPU>;
426+
427+ template struct lapack_getri <float , DEVICE_CPU>;
428+ template struct lapack_getri <double , DEVICE_CPU>;
429+ template struct lapack_getri <std::complex <float >, DEVICE_CPU>;
430+ template struct lapack_getri <std::complex <double >, DEVICE_CPU>;
431+
432+
433+ template struct lapack_getrs <float , DEVICE_CPU>;
434+ template struct lapack_getrs <double , DEVICE_CPU>;
435+ template struct lapack_getrs <std::complex <float >, DEVICE_CPU>;
436+ template struct lapack_getrs <std::complex <double >, DEVICE_CPU>;
437+
438+
411439template struct lapack_heevd <float , DEVICE_CPU>;
412440template struct lapack_heevd <double , DEVICE_CPU>;
413441template struct lapack_heevd <std::complex <float >, DEVICE_CPU>;
@@ -428,20 +456,5 @@ template struct lapack_hegvx<double, DEVICE_CPU>;
428456template struct lapack_hegvx <std::complex <float >, DEVICE_CPU>;
429457template struct lapack_hegvx <std::complex <double >, DEVICE_CPU>;
430458
431- template struct lapack_getrf <float , DEVICE_CPU>;
432- template struct lapack_getrf <double , DEVICE_CPU>;
433- template struct lapack_getrf <std::complex <float >, DEVICE_CPU>;
434- template struct lapack_getrf <std::complex <double >, DEVICE_CPU>;
435-
436- template struct lapack_getri <float , DEVICE_CPU>;
437- template struct lapack_getri <double , DEVICE_CPU>;
438- template struct lapack_getri <std::complex <float >, DEVICE_CPU>;
439- template struct lapack_getri <std::complex <double >, DEVICE_CPU>;
440-
441- template struct lapack_getrs <float , DEVICE_CPU>;
442- template struct lapack_getrs <double , DEVICE_CPU>;
443- template struct lapack_getrs <std::complex <float >, DEVICE_CPU>;
444- template struct lapack_getrs <std::complex <double >, DEVICE_CPU>;
445-
446459} // namespace kernels
447460} // namespace container
0 commit comments