-
-
Notifications
You must be signed in to change notification settings - Fork 813
feat: add C implementation for lapack/base/dlacpy
#5210
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: develop
Are you sure you want to change the base?
Conversation
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
/stdlib update-copyright-years |
Coverage Report
The above coverage report was generated for the changes in this PR. |
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
…ectories --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
…unctions --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: failed ---
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
lapack/base/dlacpy
lapack/base/dlacpy
@kgryte Please review this pr if possible. thank you. |
Signed-off-by: Athan <kgryte@gmail.com>
* @param strideB2 stride of the second dimension of `B` | ||
* @param offsetB starting index for `B` | ||
*/ | ||
void API_SUFFIX(c_copy_all)( const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) { |
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.
These should be private functions. Right now, you are exposing them outside the translation unit. That is not desired.
} | ||
|
||
for ( i1 = 0; i1 < N; i1++ ) { | ||
for ( i0 = 0; i0 <= stdlib_base_fast_min( i1, M-1 ); i0++ ) { |
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.
You shouldn't be using fast_min
. That is for doubles. Instead, either define an internal function or a macro for returning the min of two integers.
ib = offsetB; | ||
if ( stdlib_ndarray_is_row_major( 2, strides ) ) { | ||
for ( i1 = 0; i1 < M; i1++ ) { | ||
for ( i0 = 0; i0 <= stdlib_base_fast_min( i1, N-1 ); i0++ ) { |
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.
Same thing.
#include "stdlib/lapack/base/dlacpy.h" | ||
#include "stdlib/blas/base/shared.h" | ||
#include "stdlib/strided/base/stride2offset.h" | ||
#include "stdlib/math/base/special/fast/min.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.
You shouldn't be using this API.
sb2 = LDB; | ||
} else { // order === 'row-major' | ||
if ( LDA < N ) { | ||
return; |
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 is wrong. You should be using xerbla
. The JS implementation raises exceptions. That follows BLAS/LAPACK. We should do the same here.
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.
See CBLAS.
/** | ||
* Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics. | ||
* | ||
* @private |
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.
* @private |
Why is this annotation here?
* @param M number of rows in matrix `A` | ||
* @param N number of columns in matrix `A` | ||
* @param A input matrix | ||
* @param strideA1 stride of the first dimension of `A` |
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.
Prefer at least two spaces between a parameter and its description. Will require re-aligning all descriptions.
*/ | ||
void API_SUFFIX(c_dlacpy_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) { | ||
if ( uplo == CblasUpper ) { | ||
c_copy_upper( M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ); |
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.
If you are wrapping c_copy_upper
in API_SUFFIX
, you need to do the same here. Applies below, as well.
TODO | ||
#include "stdlib/blas/base/shared.h" | ||
|
||
double A[] = { 1.0, 2.0, 3.0, 4.0 }; |
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.
double A[] = { 1.0, 2.0, 3.0, 4.0 }; | |
const double A[] = { 1.0, 2.0, 3.0, 4.0 }; |
This array is not mutated. Applies here and below.
```c | ||
#include "stdlib/blas/base/shared.h" | ||
|
||
double A[] = { 1.0, 2.0, 3.0, 4.0, 5.0 }; |
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.
Why do these arrays have an odd number of elements?
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.
Left initial comments. As a general comment, you need to pay more attention to detail when submitting PRs. At this point, you've made over 130 PRs to the project, and I'd expect a higher level of quality.
@kgryte Thank you for your review. I will make sure to pay more attention to details as well as improve the quality of pr even more. As i open this pr way back it have some issues i will resolve them soon. |
@0PrashantYadav0 Are you planning on updating this PR or should we close this out? |
Resolves None.
Description
This pull request:
dlacpy
Related Issues
This pull request:
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers