Error transconjugate of complex[int, int]

Hello everyone,

On my installation of the 4.15 version, the operator ‘ of transposition and conjugation seems to not work on complex[int, int]. However it is doing the correct operation on sparse matrices. See the code below.

Thank you for your help.

Bests,

Mayeul

int m=5; 

complex[int,int] B(m,m);

for[i,j , bij : B] bij = i + 1i*j;

matrix<complex> Bmat(B);

cout << B << endl;

cout << Bmat << endl;

B = B';

Bmat = Bmat';

cout << B << endl;

cout << Bmat << endl;

You are right. However if you introduce an intermediate array B1 you get the correct result:

int m=5; 

complex[int,int] B(m,m);

for[i,j , bij : B] bij = i + 1i*j;

matrix<complex> Bmat(B);

cout << B << endl;

cout << Bmat << endl;

complex[int,int] B1(m,m);
B1 = B';
B = B1;

Bmat = Bmat';

cout << B << endl;

cout << Bmat << endl;

There is probably a bug that occurs when the same array B appears on both sides of the “=”.

This code in src/fflib/array_tlp.hpp is wrong when using the same K[int, int].

  1182	template<class K>  KNM<K> * set_mat_t(KNM<K> * a,Transpose<KNM<K> * > b ){
  1183	    ConjKNM_<K>  tb=b.t->t(); ;
  1184	    a->resize(tb.N(),tb.M());// correction mars 2013
  1185	    *a=tb;
  1186	    return a;}

Fixed in the develop branch at Copy array when using the same pointer · FreeFem/FreeFem-sources@2281154 · GitHub.