[petsc-users] cusp complex and std complex

Harshad Sahasrabudhe hsahasra at purdue.edu
Thu Sep 5 12:31:37 CDT 2013


Sorry the last line of the error should read like this:

    test.cpp:9:8: note:   no known conversion for argument 3 from 'cusp::complex<double>' to 'std::complex<double>&'

Didn't copy it properly the last time.

Harshad

----- Original Message -----
From: "Harshad Sahasrabudhe" <hsahasra at purdue.edu>
To: "Matthew Knepley" <knepley at gmail.com>
Cc: petsc-users at mcs.anl.gov
Sent: Thursday, September 5, 2013 1:29:38 PM
Subject: Re: [petsc-users] cusp complex and std complex

Hi Matt,

I have attached a small test case which reproduces the problem. Here is the compilation command with the error:


    gcc -c test.cpp -I/u/sciteam/sahasrab/NEMO5/libs/petsc/include -I/u/sciteam/sahasrab/NEMO5/libs/petsc/arch-linux2-cxx-opt-cplx/include/ -I/opt/cray/mpt/6.0.1/gni/mpich2-
    cray/81/include/ -I/u/sciteam/sahasrab/NEMO5/libs/petsc/cusplibrary-master/ -I/opt/nvidia/cudatoolkit/5.0.35/include/

    test.cpp: In function 'int main()':
    test.cpp:24:27: error: no matching function for call to 'VectorP<std::complex<double> >::dot_product(VectorP<std::complex<double> >&, VectorP<std::complex<double> >&,    
    cusp::complex<double>&)'
       a.dot_product(a, b, p[1]);
                           ^
    test.cpp:24:27: note: candidate is:
    test.cpp:9:8: note: void VectorP<T>::dot_product(VectorP<T>&, VectorP<T>&, T&) [with T = std::complex<double>]
       void dot_product(VectorP<T>& vecA, VectorP<T>& vecB, T& prod)
            ^
    test.cpp:9:8: note:   no known conversion for argument 3 from 'cusp::complex<double>' to 'std::complex<double

My question is, is there no alternative to using VectorP<PetscScalar>?

NOTE: PETSc is compiled with CUSP.

Thanks,
Harshad




    >Are we supposed to guess where this happens? Please send the entire compile error, and if its in your code, send 
    >a simple code that demonstrates the problem. 


    >Matt 

    >-- 
    >What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. 
    >-- Norbert Wiener 


More information about the petsc-users mailing list