[ANSWERED] Error in Type Comparisons and Assignments
I have a Matrix (vector of vectors) of a general type and I wished to decompose it as per Cholesky's Decomposition Method. I found that the dcomposition returns two Matrices, of which the first is calculated by some formulas and the second is the 'conjugate transpose' of the first. So my function declaration was as follows : pair<Matrix,Matrix> Decompose(); Now after calculation of the first element of the pair, I ran the following if-else block : Matrix L1(r,c) ,L2(r,c); /* Other Code */ if(typeid(this->mat.begin()->front())==typeid(Complex)) L2 = L1.CTranspose(); // If the type is Complex, we can assign conjugate transpose. else L2 = L1.Transpose(); // Else, the conjugate simply does not exist. Just assign normal transpose. Now, I get the following error, if I tried the function for a non complex Matrix: Error : no match for 'operator =' ( operand types are 'Matrix<long double>' and 'Matrix<Complex>' ) How can I repair this? Do I have no other choice but to specialize/overload the Decomposition Function for the Complex Type?