Skip to content

Scale with Endomorphism #160

@bonfus

Description

@bonfus

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions