Vectors are both row and column contiguous.
Plus indentation fixes.
@@ -683,7 +683,7 @@ fn blas_row_major_2d<A, S>(a: &ArrayBase<S, Ix2>) -> bool
let (m, n) = a.dim();
let s0 = a.strides()[0];
let s1 = a.strides()[1];
- if s1 != 1 {
+ if !(s1 == 1 || n == 1) {
return false;
}
if s0 < 1 || s1 < 1 {
@@ -714,7 +714,7 @@ fn blas_column_major_2d<A, S>(a: &ArrayBase<S, Ix2>) -> bool
let (m, n) = a.dim();
let s0 = a.strides()[0];
let s1 = a.strides()[1];
- if s0 != 1 {
+ if !(s0 == 1 || m == 1) {
return false;
}
if s0 < 1 || s1 < 1 {
@@ -764,7 +764,7 @@ mod blas_tests {
fn blas_row_major_2d_row_matrix() {
let m: Array2<f32> = Array2::zeros((1, 5));
assert!(blas_row_major_2d::<f32, _>(&m));
- assert!(!blas_column_major_2d::<f32, _>(&m));
+ assert!(blas_column_major_2d::<f32, _>(&m));
}
#[test]
@@ -778,7 +778,7 @@ mod blas_tests {
fn blas_row_major_2d_transposed_row_matrix() {
let m: Array2<f32> = Array2::zeros((1, 5));
let m_t = m.t();
- assert!(!blas_row_major_2d::<f32, _>(&m_t));
+ assert!(blas_row_major_2d::<f32, _>(&m_t));
assert!(blas_column_major_2d::<f32, _>(&m_t));
}
