I would like to convert from COO to CSR without making a new copy of my matrix. Is it OK to have actual arguments point to the same arrays, i.e. acsr and acoo are the same array and similar for the index arrays ? The help file does not specify.
In general, unless the documentation says so explicitly, it is not safe to have aliased arguments passed to library subroutines. Furthermore, In Fortran there is a restriction on procedure arguments being aliased:
220.127.116.11 Restrictions on entities associated with dummy arguments
1 While an entity is associated with a dummy argument, the following restrictions hold.
(3) Action that affects the value of the entity or any subobject of it shall be taken only through the dummy argument
The compiler may not be able to detect if your code violates this requirement, and it is hard to catch associated bugs at run time.
In the case that you mentioned, the COO representation contains two index arrays of size Nnz, whereas the CSR representation contains an index array of size Nnz and a row-pointer array of size N+1, so one output array does not match any corresponding input array in size.
Why take the risk? If the arrays are dynamically allocated, it is easy enough to discard the COO arrays once the conversion is completed, or to reuse the allocated memory for some other useful purpose.