• Jason Rhinelander's avatar
    Eigen: don't require conformability on length-1 dimensions · efa8726f
    Jason Rhinelander authored
    Fixes #738
    
    The current check for conformability fails when given a 2D, 1xN or Nx1
    input to a row-major or column-major, respectively, Eigen::Ref, leading
    to a copy-required state in the type_caster, but this later failed
    because the copy was also non-conformable because it had the same shape
    and strides (because a 1xN or Nx1 is both F and C contiguous).
    
    In such cases we can safely ignore the stride on the "1" dimension since
    it'll never be used: only the "N" dimension stride needs to match the
    Eigen::Ref stride, which both fixes the non-conformable copy problem,
    but also avoids a copy entirely as long as the "N" dimension has a
    compatible stride.
    efa8726f
test_eigen.cpp 14.5 KB