You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often want to take a matrix view of an array A, reshaped to rank 2, for example to contract over one of the indices of A with another matrix using a BLAS gemm. Furthermore, sometimes I want to do this with a slice of the array A, taking care so that reshaping is only done in contiguous memory. I am getting an error when I try to do this with Fortran layout arrays. Here is a minimal working example:
#include "nda/nda.hpp"
using namespace nda;
int main() {
int m = 3;
int n = 3;
int p = 3;
// This code compiles
auto a = nda::array<double,3>(m,n,p);
auto a_reshaped = nda::reshaped_view(a(range(2),range(n),range(p)), std::array<int, 2>({2*n,p}));
auto a_matrix = matrix_const_view<double>(a_reshaped);
// This code does not compile
auto af = nda::array<double,3,F_layout>(m,n,p);
auto af_reshaped = nda::reshaped_view(a(range(m),range(n),range(2)), std::array<int, 2>({m,n*2}));
auto af_matrix = matrix_const_view<double,F_layout>(a_reshaped);
}
Note that the code compiles when I use C layout, but not when I use Fortran layout. The error is triggered at the matrix_const_view step, not at the reshaped_view step.
I am using the DEV_CUDA_LINALG branch of nda, hash #189c585fc78651859db279e98df53b1e4ee11a04, on a Linux machine.
The text was updated successfully, but these errors were encountered:
I often want to take a matrix view of an array A, reshaped to rank 2, for example to contract over one of the indices of A with another matrix using a BLAS gemm. Furthermore, sometimes I want to do this with a slice of the array A, taking care so that reshaping is only done in contiguous memory. I am getting an error when I try to do this with Fortran layout arrays. Here is a minimal working example:
Note that the code compiles when I use C layout, but not when I use Fortran layout. The error is triggered at the matrix_const_view step, not at the reshaped_view step.
I am using the DEV_CUDA_LINALG branch of nda, hash #189c585fc78651859db279e98df53b1e4ee11a04, on a Linux machine.
The text was updated successfully, but these errors were encountered: