Hi!
I'm trying to do some operations on complex numbers in C with returning results to R, but it seems that arithmetic operators do not overloaded for complex numbers. I mean, I try a very simple code, like


#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>

int main(){
    Rcomplex e, z, s;
    e.r = M_PI; e.i = 0;
    z.r = 0; z.i = -2;
s = e * z; //here I get an error - invalid operands to binary * (have 'Rcomplex' and 'Rcomplex')
    return 0;
}


So, should I overload operators for R-complex numbers by myself or there is a way to use some operators already?
Because I'll even need operations like raising to a power or something...


Best regards,
Oleksandr

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to