-
Notifications
You must be signed in to change notification settings - Fork 802
P3371R5 Fix C++26 by making the rank-1, rank-2, rank-k, and rank-2k updates consistent with the BLAS #8550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
be411bc to
df99190
Compare
…pdates consistent with the BLAS Fixes NB US 168-277 (C++26 CD).
df99190 to
d933aae
Compare
| an \tcode{InMat} template parameter, and | ||
| a function parameter \tcode{InMat E}, | ||
| \tcode{t} applies to accesses done through the parameter \tcode{E}. | ||
| \tcode{F} only accesses the triangle of \tcode{E} specified by \tcodee{t}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failure was caused by the typo.
| \tcode{F} only accesses the triangle of \tcode{E} specified by \tcodee{t}. | |
| \tcode{F} only accesses the triangle of \tcode{E} specified by \tcode{t}. |
| // updating nonsymmetric rank-1 matrix update | ||
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, @\exposconcept{in-matrix}@ InMat, @\exposconcept{out-matrix}@ OutMat> | ||
| void matrix_rank_1_update(InVec1 x, InVec2 y, InMat E, OutMat A); | ||
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-matrix}@ InMat, @\exposconcept{in-vector}@ InVec2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The incoming paper is wrong here and needs to be fixed. The \itemdecl on line 14980 has the template parameters in the correct order (matching the non-parallel overload, and matching the function parameters). It should be fixed here in the synopsis.
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-matrix}@ InMat, @\exposconcept{in-vector}@ InVec2, | |
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, @\exposconcept{in-matrix}@ InMat, |
|
Too late now, but this would have been much less difficult to review as two commits, one doing all the Edit: three commits, even. One changing inout to in, one adding/removing blocks of text, and then one changing every "class Scalar" to "scalar Scalar", which needs to be done after adding the new functions. |
| template<class ExecutionPolicy, | ||
| @\exposconcept{in-vector}@ InVec, @\exposconcept{possibly-packed-inout-matrix}@ InOutMat, class Triangle> | ||
| void hermitian_matrix_rank_1_update(ExecutionPolicy&& exec, InVec x, InOutMat A, Triangle t); | ||
| class Scalar, @\exposconcept{in-vector InVec}@, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| class Scalar, @\exposconcept{in-vector InVec}@, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, | |
| class Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, |
| template<in-matrix InMat1, | ||
| in-matrix InMat2, | ||
| in-matrix InMat3, | ||
| possibly-packed-out-matrix OutMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<in-matrix InMat1, | |
| in-matrix InMat2, | |
| in-matrix InMat3, | |
| possibly-packed-out-matrix OutMat, | |
| template<@\exposconcept{in-matrix}@ InMat1, | |
| @\exposconcept{in-matrix}@ InMat2, | |
| @\exposconcept{in-matrix}@ InMat3, | |
| @\exposconcept{possibly-packed-out-matrix}@ OutMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many newlines here and in the \itemdecls that follow.
| in-matrix InMat1, | ||
| in-matrix InMat2, | ||
| in-matrix InMat3, | ||
| possibly-packed-out-matrix OutMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| in-matrix InMat1, | |
| in-matrix InMat2, | |
| in-matrix InMat3, | |
| possibly-packed-out-matrix OutMat, | |
| @\exposconcept{in-matrix}@ InMat1, | |
| @\exposconcept{in-matrix}@ InMat2, | |
| @\exposconcept{in-matrix}@ InMat3, | |
| @\exposconcept{possibly-packed-out-matrix}@ OutMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhoemmen please confirm that the new class Scalar template parameters being added by this paper should actually be scalar Scalar instead, since that's part of this paper, right?
Edit: yes, the editor's note at https://wiki.edg.com/pub/Wg21kona2025/StrawPolls/P3371R5.html#constrain-all-class-scalar-template-parameters says to rename all class Scalar to scalar Scalar after applying the changes from the paper. So the wording in the paper is "wrong" but the paper gives instructions for fixing it.
| Scalar alpha, InMat A, OutMat C, Triangle t); | ||
|
|
||
| // updating rank-k symmetric matrix update | ||
| template<class Scalar, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely this should be scalar
| template<class Scalar, | |
| template<@\exposconcept{scalar}@ Scalar, |
| void symmetric_matrix_rank_k_update( | ||
| Scalar alpha, | ||
| InMat1 A, InMat2 E, OutMat C, Triangle t); | ||
| template<class ExecutionPolicy, class Scalar, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<class ExecutionPolicy, class Scalar, | |
| template<class ExecutionPolicy, @\exposconcept{scalar}@ Scalar, |
| InMat1 A, InMat2 E, OutMat C, Triangle t); | ||
|
|
||
| // updating rank-k Hermitian matrix update | ||
| template<class Scalar, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<class Scalar, | |
| template<@\exposconcept{scalar}@ Scalar, |
| void hermitian_matrix_rank_k_update( | ||
| Scalar alpha, | ||
| InMat1 A, InMat2 E, OutMat C, Triangle t); | ||
| template<class ExecutionPolicy, class Scalar, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<class ExecutionPolicy, class Scalar, | |
| template<class ExecutionPolicy, @\exposconcept{scalar}@ Scalar, |
| Scalar alpha, InVec x, OutMat A, Triangle t); | ||
|
|
||
| // updating symmetric rank-1 matrix update | ||
| template<class Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<class Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, | |
| template<@\exposconcept{scalar}@ Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, |
and similarly in the other new functions below.
| @\exposconcept{possibly-packed-out-matrix}@ OutMat, | ||
| class Triangle> | ||
| void symmetric_matrix_rank_k_update( | ||
| Scalar alpha, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting of these new functions is inconsistent with the ones above and below them. I think we should ignore the incoming paper's formatting and be consistent.
| template<@\exposconcept{in-matrix}@ InMat1, @\exposconcept{in-matrix}@ InMat2, | ||
| @\exposconcept{possibly-packed-inout-matrix}@ InOutMat, class Triangle> | ||
| void symmetric_matrix_rank_2k_update(InMat1 A, InMat2 B, InOutMat C, Triangle t); | ||
| @\exposconcept{in-matrix}@ InMat3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these InMat3 template parameters don't need to be on a new line, they can follow InMat2.
| \mandates | ||
| \begin{itemize} | ||
| \item | ||
| \tcode{\exposconcept{possibly-multipliable}<OutMat, InVec2, InVec1>()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| \tcode{\exposconcept{possibly-multipliable}<OutMat, InVec2, InVec1>()} | |
| \tcode{\exposid{possibly-multipliable}<OutMat, InVec2, InVec1>()} |
This is just a function template, not a concept.
| \tcode{\exposconcept{possibly-multipliable}<OutMat, InVec2, InVec1>()} | ||
| is \tcode{true}, and | ||
| \item | ||
| \tcode{\exposconcept{possibly-addable}<OutMat, InMat, OutMat>()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| \tcode{\exposconcept{possibly-addable}<OutMat, InMat, OutMat>()} | |
| \tcode{\exposid{possibly-addable}<OutMat, InMat, OutMat>()} |
Just a function template, not a concept.
|
|
||
| template<class T> | ||
| concept @\defexposconcept{scalar}@ = | ||
| @\libconcept{semiregular}@<T> && (!@\exposconcept{is-mdspan}@<T>) && (!is_execution_policy_v<T>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @\libconcept{semiregular}@<T> && (!@\exposconcept{is-mdspan}@<T>) && (!is_execution_policy_v<T>); | |
| @\libconcept{semiregular}@<T> && (!@\exposid{is-mdspan}@<T>) && (!is_execution_policy_v<T>); |
This is just a variable template, not a concept.
| template<class ExecutionPolicy, | ||
| @\exposconcept{in-vector}@ InVec, @\exposconcept{possibly-packed-inout-matrix}@ InOutMat, class Triangle> | ||
| void symmetric_matrix_rank_1_update(ExecutionPolicy&& exec, InVec x, InOutMat A, Triangle t); | ||
| @\exposconcept{scalar}@ Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, class Triangle> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @\exposconcept{scalar}@ Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, class Triangle> | |
| @\exposconcept{scalar}@ Scalar, @\exposconcept{in-vector}@ InVec, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-out-matrix}@ OutMat, | |
| class Triangle> |
Overfull hbox
| \pnum | ||
| These functions perform | ||
| a Hermitian rank-1 update of the Hermitian matrix \tcode{A}, | ||
| an updating Hermitian rank-1 update of the Hermitian matrix \tcode{E}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| an updating Hermitian rank-1 update of the Hermitian matrix \tcode{E}, | |
| an updating Hermitian rank-1 update of the Hermitian matrix \tcode{A} | |
| using the Hermitian matrix \tcode{E}, |
| \effects | ||
| Computes a matrix $A'$ such that $A' = A + x x^H$ and | ||
| assigns each element of $A'$ to the corresponding element of $A$. | ||
| Computes a matrix $A = E + \alpha x x^H$, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Computes a matrix $A = E + \alpha x x^H$, | |
| Computes $A = E + \alpha x x^H$, |
| For accesses \tcode{E[i, j]} outside the triangle specified by \tcode{t}, | ||
| \tcode{F} only uses the value | ||
| \begin{itemize} | ||
| \item \tcode{\exposid{conj-if-needed}(E[j, i])} if the name of F starts with hermitian, or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| \item \tcode{\exposid{conj-if-needed}(E[j, i])} if the name of F starts with hermitian, or | |
| \item \tcode{\exposid{conj-if-needed}(E[j, i])} if the name of F starts with \tcode{hermitian}, or |
| \tcode{F} only uses the value | ||
| \begin{itemize} | ||
| \item \tcode{\exposid{conj-if-needed}(E[j, i])} if the name of F starts with hermitian, or | ||
| \item \tcode{E[j, i]} if the name of F starts with symmetric. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| \item \tcode{E[j, i]} if the name of F starts with symmetric. | |
| \item \tcode{E[j, i]} if the name of F starts with \tcode{symmetric}. |
jwakely
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paper has these line breaks in template parameter lists but they're unnecessary IMHO.
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | ||
| @\exposconcept{in-matrix}@ InMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | |
| @\exposconcept{in-matrix}@ InMat, | |
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, @\exposconcept{in-matrix}@ InMat, |
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | ||
| @\exposconcept{in-matrix}@ InMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | |
| @\exposconcept{in-matrix}@ InMat, | |
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, @\exposconcept{in-matrix}@ InMat, |
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | ||
| @\exposconcept{in-matrix}@ InMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | |
| @\exposconcept{in-matrix}@ InMat, | |
| template<@\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, @\exposconcept{in-matrix}@ InMat, |
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | ||
| @\exposconcept{in-matrix}@ InMat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, | |
| @\exposconcept{in-matrix}@ InMat, | |
| template<class ExecutionPolicy, @\exposconcept{in-vector}@ InVec1, @\exposconcept{in-vector}@ InVec2, @\exposconcept{in-matrix}@ InMat, |
|
|
||
| \pnum | ||
| \remarks | ||
| \tcode{A} my alias \tcode{E}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| \tcode{A} my alias \tcode{E}. | |
| \tcode{A} may alias \tcode{E}. |
| \item | ||
| \tcode{C.extent(0)} equals \tcode{C.extent(1)}, and | ||
| \tcode{\exposid{multipliable}(A, transposed(A), C)} | ||
| is \tcode{true}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The incoming paper has "and" after the semi-colon. I think we either want that, or just turn the semi-colon into a full stop. A list of preconditions has an implicit "and" between them anyway.
| \indexlibraryglobal{hermitian_matrix_rank_k_update}% | ||
| \indexlibraryglobal{symmetric_matrix_rank_k_update}% | ||
| \begin{itemdecl} | ||
| template<class Scalar, @\exposconcept{in-matrix}@ InMat, @\exposconcept{possibly-packed-inout-matrix}@ InOutMat, class Triangle> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something's gone wrong here, I think you've removed the hermitian_matrix_rank_k_update overloads with an alpha parameter, which should not have been removed.
The paper shows that we should end up with symmetric_matrix_rank_k_update with one input matrix, then hermitian_matrix_rank_k_update with one input matrix, then symmetric_matrix_rank_k_update with two input matrices, then hermitian_matrix_rank_k_update with two input matrices.
But these changes give us:
So we're missing the hermitian_matrix_rank_k_update overloads with one input matrix.
Are we going to get conflicts when the LWG issues from Kona are applied? |
Fixes #8479
Fixes NB US 168-277 (C++26 CD).
Also fixes cplusplus/papers#2028
Also fixes https://github.com/cplusplus/nbballot/issues/852