-
Notifications
You must be signed in to change notification settings - Fork 757
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
[LWG 19] P1673R13 A free function linear algebra interface based on the BLAS #6704
Conversation
ae27623
to
c8710ca
Compare
3a8aa93
to
aa6d7e9
Compare
aa6d7e9
to
47b2f70
Compare
@jensmaurer The definition of imag-if-needed for sub-bullet (1.2) is incorrect, I assume that otherwise, should be either otherwise, as the paper says or otherwise, |
1e16e8c
to
51afb68
Compare
@Dani-Hub, thanks for the hint:
Fixed; missing backslashes in LaTeX. |
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.
not done, but probably done for the night - here's what I have so far...
constexpr size_t num_rows = 5; | ||
constexpr size_t num_cols = 6; | ||
|
||
// y = 3.0 * A * x |
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 needed (same for C++ comments elsewhere)
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.
Hm... operator*
is not provided for the involved types, so formatting this as C++ code throughout isn't correct.
Formatting y, A, x as C++ code would work, but then this is almost indistinguishable from all-code.
@tkoeppe , what do you think?
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.
We should probably write the code as code, but the whole expression as in maths. We can either use \times
or \cdot
or just juxtaposition for the various kinds of multiplication.
But we can clean that up later, too.
void scaled_matvec_1(mdspan<double, extents<size_t, num_rows, num_cols>> A, | ||
mdspan<double, extents<size_t, num_cols>> x, mdspan<double, extents<size_t, num_rows>> y) { | ||
matrix_vector_product(scaled(3.0, A), x, y); | ||
} |
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.
Format as it is in the paper - it's easier to see what's happening
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 find all of this rather verbose. Maybe we should invent type aliases for these.
using Matrix = mdspan<double, extents<size_t, num_rows, num_cols>>;
@tkoeppe , what do you think?
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.
Yes, that would be helpful. Let's do that as a follow-up.
source/numerics.tex
Outdated
void scaled_matvec_2(mdspan<double, extents<size_t, num_rows, num_cols>> A, | ||
mdspan<double, extents<size_t, num_cols>> x, mdspan<double, extents<size_t, num_rows>> y) { |
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.
Format as it is in the paper - it's easier to see what's happening
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.
Thanks for the fixes so far!
Still have issues with:
- \tcode vs. italics used to represent the same variables (in paper also),
- spaces between variables in math expressions (looks like separate expressions, but without space as in paper, the string looks like a single variable), and
- missing "is \tcode{true}" after some expressions (in paper also)
|
||
\pnum | ||
\effects | ||
Computes $z = y + A x$. |
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 disagree. At the very least, preface this section with what /A/, etc, are. But really, they are the variables in the prototypes, so why wouldn't we just use them directly? Also, having 2 variables right next to each other with only a space and no operator between them is meaningless in either math or C++ code. At least the paper didn't include a space, so could be read mathematically as a multiplication, but doing that gets confusing because the string of variables can look like a single variable
f3d4d06
to
d695241
Compare
@jwakely , is there any specific text in the paper (that I'm currently overlooking) that would associate input math variables with same-named C++ function parameters? [linalg.general] p1.4 talks about output variables only. |
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.
Just 1 last required change
Computes a vector $x'$ such that $b = A x'$, | ||
and assigns each element of $x'$ to the corresponding element of $x$. | ||
If no such $x'$ exists, | ||
then the elements of \tcode{x} are valid but unspecified. |
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.
This x should be in math font (not \tcode) for consistency
d695241
to
e7b98fd
Compare
Erm, possibly not. We have similar problems in [rand], see #4295 for an old attempt to fix it there. |
e7b98fd
to
731356d
Compare
Thank you all very much for the reviews, and special thanks to Jens for the drafting! I'll merge this now, and we can perform follow-up cleanup afterwards. Thanks again! |
- Add closing brace in header synopsis at the end of the namespace. - Introduce abbreviations for repeated lengthy expressions. - Remove duplicate definition for struct sum_of_squares_result from [linalg.algs.blas1.ssq]. - Stale cross-references to [linalg.algs] re-pointed to [linalg].
… with alpha first
731356d
to
1945031
Compare
Fixes #6677
Fixes cplusplus/papers#557
Issues found and fixed in separate commits:
}
for namespace at end of synopsisT dot(...
: "T" was never introduced; did you mean "Scalar"?template<class Scalar, class ExecutionPolicy, ...> void symmetric_matrix_rank_k_update
: strange order of template parameterswhich is a bit complicated. Instead, they could just say "return dot(conjugated(v1), v2)" and rely on the auto-returning "dot" function to do the right thing. NOT FIXED in this pull request