44 static constexpr char UPLO =
UL;
52 pposv(
const IT rows,
const IT cols)
58 if(!this->ctx.is_valid())
return 0;
60 if(A.n_rows != A.n_cols || A.n_cols !=
B.n_rows)
return -1;
62 this->init_storage(A.n_rows);
64 this->ctx.scatter(A, this->ctx.desc_g(A.n_rows, A.n_cols),
this->loc.a,
this->loc.desc_a);
68 if constexpr(std::is_same_v<DT, double>) {
70 pdpotrf(&UPLO, &this->loc.n, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), &info);
72 else if constexpr(std::is_same_v<DT, float>) {
74 pspotrf(&UPLO, &this->loc.n, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), &info);
76 else if constexpr(std::is_same_v<DT, complex16>) {
78 pzpotrf(&UPLO, &this->loc.n, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), &info);
80 else if constexpr(std::is_same_v<DT, complex8>) {
82 pcpotrf(&UPLO, &this->loc.n, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), &info);
86 if((info = this->ctx.amx(info)) != 0)
return info;
88 return solve(std::move(
B));
92 if(
B.n_rows !=
this->loc.n)
return -1;
94 if(!this->ctx.is_valid())
return 0;
96 this->loc.b.resize(this->loc.rows *
this->ctx.cols(
B.n_cols,
this->loc.block));
98 const auto full_desc_b = this->ctx.desc_g(
B.n_rows,
B.n_cols);
105 if constexpr(std::is_same_v<DT, double>) {
107 pdpotrs(&UPLO, &this->loc.n, &
B.n_cols, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), (
E*)
this->loc.b.data(), &
this->ONE, &
this->ONE,
loc_desc_b.data(), &info);
109 else if constexpr(std::is_same_v<DT, float>) {
111 pspotrs(&UPLO, &this->loc.n, &
B.n_cols, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), (
E*)
this->loc.b.data(), &
this->ONE, &
this->ONE,
loc_desc_b.data(), &info);
113 else if constexpr(std::is_same_v<DT, complex16>) {
115 pzpotrs(&UPLO, &this->loc.n, &
B.n_cols, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), (
E*)
this->loc.b.data(), &
this->ONE, &
this->ONE,
loc_desc_b.data(), &info);
117 else if constexpr(std::is_same_v<DT, complex8>) {
119 pcpotrs(&UPLO, &this->loc.n, &
B.n_cols, (
E*)
this->loc.a.data(), &
this->ONE, &
this->ONE,
this->loc.desc_a.data(), (
E*)
this->loc.b.data(), &
this->ONE, &
this->ONE,
loc_desc_b.data(), &info);