Skip to content

Strange zeros in returned ndarray on python side that is correct on C++ side #573

Answered by Chronum94
Chronum94 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

I've had a look at the documentation and have written up a potential solution. However the solution 'looks not great' which is my best feeling about it. I understand that this is an aesthetic/best practices question, with potentially no obvious right answer.

  m.def(
      "eigh",
      [](slate::HermitianMatrix<double> &A)
      {

        struct Temp {
          std::vector<blas::real_type<double>> eps;
        };

        Temp *temp = new Temp();

        slate::heev(A, temp->eps);

        auto size = temp->eps.size();
        auto epsdata = temp->eps.data();
        size_t shape[1] = {size};

        nb::capsule owner(temp, [](void *p) noexcept {
          delete (Temp *) p;
    …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Chronum94
Comment options

Answer selected by Chronum94
@jamesETsmith
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants