0

I am using SuiteSparse @4.2.1_3 installed via macports and want to allocate a cholmod_dense structure. Consider the following piece of code:

/* start CHOLMOD */
cholmod_common c;
cholmod_dense* myv;
cholmod_dense* myv2;

cholmod_start (&c);
myv  = cholmod_l_allocate_dense( 4,1,4,CHOLMOD_REAL,&c);
myv2 = cholmod_allocate_dense(4,1,4,CHOLMOD_REAL,&c);
printf("myv=%p\n",myv);
printf("myv2=%p\n",myv2);

/* finish CHOLMOD */
cholmod_finish (&c) ; 

I get the following output:

myv=0x0
myv2=0x7fb86ac0c060

That means allocate cholmod_dense structure in long version does not work but integer version works well. Does anyone know a reason why this happens?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

0

You have to set the correct itype in the cholmod_common structure c.

c.itype=CHOLMOD_LONG;

/* Common->itype and Common->dtype are used to define the types of all
 * sparse matrices, triplet matrices, dense matrices, and factors
 * created using this Common struct.  The itypes and dtypes of all
 * parameters to all CHOLMOD routines must match.  */
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278