Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale with Endomorphism #160

Open
bonfus opened this issue Jan 3, 2024 · 0 comments
Open

Scale with Endomorphism #160

bonfus opened this issue Jan 3, 2024 · 0 comments

Comments

@bonfus
Copy link

bonfus commented Jan 3, 2024

Hi, thanks for this fantastic library!

In order to make this work:

   Tensor<dtype> N(n_spin, len_N);
    N.fill_random(0.0,1.0);
    dtype scal(0,2.*M_PI);
    auto f = Endomorphism<dtype>([](dtype a){ return exp(a);});
    N.scale(scal, idxi, f);

I had to apply this patch:

--- a/src/interface/tensor.cxx
+++ b/src/interface/tensor.cxx
@@ -1770,7 +1770,7 @@ NORM_INFTY_INST(double)
   void Tensor<dtype>::scale(dtype               alpha,
                             const char *        idx_A,
                             Endomorphism<dtype> fseq){
-    CTF_int::scaling scl = CTF_int::scaling(this, idx_A, &fseq, (char const *)&alpha);
+    CTF_int::scaling scl = CTF_int::scaling(this, idx_A, (char const *)&alpha, &fseq);
     scl.execute();
   }

Is this a bug or I'm using it wrong?

@bonfus bonfus changed the title scale with Scale with Endomorphism Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant