[CLN-list] how to locate arrays in CLN library

Richard B. Kreckel kreckel at ginac.de
Thu Jun 18 22:16:00 CEST 2009


sopik at fzu.cz wrote:
> I'd like to to work with fields of complex numbers of high precision using
> the CLN library. I can't successfuly allocate the memory using memalloc
> however. I tired few possibilities, but nothing worked. There is no notice
> about this topic in manual or in mail discussion, so it seems to be
> straightforward. But I have no idea how to do it.

I'm not sure what you are trying to do, but working with complex numbers 
is straightforward. This is C++ and you should rely on the power of 
constructors/destructors and, if necessary, use new/delete for memory 
management, instead of malloc/free.

Here is a working mini-example:

#include <cln/cln.h>
#include <iostream>
using namespace std;
using namespace cln;

int main()
     cl_N x = -4;
     cl_N sqrt_x = sqrt( x );
     if ( sqrt_x == complex( 0, 2 ) ) {
         cout << "See, it works!" << endl;

If this doesn't help, please post some example code.

Best wishes
Richard B. Kreckel

More information about the CLN-list mailing list