[RFC]: mismatch between BLAS band storage and `to-compact` layout

Đang mở
#10,863 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #10865 của @DivitJain26 — đã đóng, không merge

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
data

Hướng nghiên cứu

Bắt đầu với entry point @stdlib/array/base/banded/to-compact và triển khai blas/base/cgbmv được đề cập trong issue. So sánh các quy ước lưu trữ colexicographic của chúng với tài liệu BLAS được liên kết, sau đó kiểm tra các issue liên quan và các bài kiểm thử của package. Được coi là hoàn tất khi layout theo cột dự kiến được quyết định một cách rõ ràng và output quan sát được khớp với quyết định đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

Description

While implementing blas/base/cgbmv, I noticed that the band matrix storage format expected by BLAS gbmv differs from the layout produced by @stdlib/array/base/banded/to-compact.

to-compact produces a diagonal-centered layout, whereas BLAS expects a band storage layout compatible with the gbmv routines (as documented in (Intel® oneAPI Math Kernel Library).

Because of this difference, to-compact cannot be directly used for preparing matrices for gbmv.

This behaviour is only present in colexicographic or column wise packing.

For example, given:
var A = [
  [  1,  2,  3,  0,  0 ],
  [ -2,  4,  5,  6,  0 ],
  [ -3, -5,  7,  8,  9 ],
  [  0, -6, -8, 10, 11 ],
  [  0,  0, -9,-11, 12 ]
];
Output from to-compact
Column wise (colexicographic) packing
AC = toCompact( A, 2, 2, true );
/* e.g., returns =>
    [
        [ 0,  0,  1,  -2, -3 ],
        [ 0,  2,  4,  -5, -6 ],
        [ 3,  5,  7,  -8, -9 ],
        [ 6,  8, 10, -11,  0 ],
        [ 9, 11, 12,   0,  0 ]
    ]
*/
Expected BLAS band storage (MKL / Netlib)

BLAS gbmv expects band matrices packed differently.

Band Matrix
A general band matrix A of m rows and n columns with kl sub-diagonals, ku super-diagonals and leading dimension lda is represented as a one dimensional array a of size at least lda * n (respectively, lda * m) if column (respectively, row) major layout is used.
Before entry in any BLAS function using a general band matrix, the leading (kl + ku + 1) by n (respectively, m) part of the array a must contain the matrix A. This matrix must be supplied column-by-column (respectively, row-by-row), with the main diagonal of the matrix in row ku (respectively, column kl) of the array (0-based indexing), the first super-diagonal starting at position 1 (respectively, 0) in row (ku – 1) (respectively, column (kl + 1)), the first sub-diagonal starting at position 0 (respectively, 1) in row (ku + 1) (respectively, column (kl – 1)), and so on. Elements in the array a that do not correspond to elements in the band matrix (such as the top left ku-by-ku triangle) are not referenced.

Acompact = [
  [  0,   0,  1,  2, 3 ],
  [  0,  -2,  4,  5, 6 ],
  [ -3,  -5,  7,  8, 9 ],
  [ -6,  -8, 10, 11, 0 ],
  [ -9, -11, 12,  0, 0 ]
]
Related Issues

Related issues # , # , and # .

Questions

No.

Demo

No response

Reproduction
var toCompact = require('@stdlib/array/base/banded/to-compact');

var A = [
  [  1,  2,  3,  0,  0 ],
  [ -2,  4,  5,  6,  0 ],
  [ -3, -5,  7,  8,  9 ],
  [  0, -6, -8, 10, 11 ],
  [  0,  0, -9,-11, 12 ]
];

var AC = toCompact( A, 2, 2, true );

console.log( AC );
Expected Results
[
  [  0,   0,  1,  2, 3 ],
  [  0,  -2,  4,  5, 6 ],
  [ -3,  -5,  7,  8, 9 ],
  [ -6,  -8, 10, 11, 0 ],
  [ -9, -11, 12,  0, 0 ]
]
Actual Results
[
  [ 0,  0,  1,  -2, -3 ],
  [ 0,  2,  4,  -5, -6 ],
  [ 3,  5,  7,  -8, -9 ],
  [ 6,  8, 10, -11,  0 ],
  [ 9, 11, 12,   0,  0 ]
]
Version

No response

Environments

Node.js

Browser Version

No response

Node.js / npm Version

20.20.0

Platform

Linux

Checklist
  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
224

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stdlib-js/stdlib

Tất cả issue của stdlib-js/stdlib

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.