Matrix sorting

Rampas, Tomas Rampas@gedas.cz
Fri Jul 11 09:40:00 GMT 2003


Hello,
I have a question about matrix.
I have a gsl_matrix object an I would like to sort that matrix along the
specific column. Is it posible in GSL?
I tried gsl_heapsort and STL qsort but with not success.

My code follows:

gsl_heapsort(matrix->data, matrix->size1, matrix->size2 * sizeof(double),
compare);

int compare( const void *arg1, const void *arg2 )
{
	if ((double *)arg1 < (double *)arg2) 
		return -1;
	else if ((double *)arg1 > (double *)arg2) 
		return 1;
	else
	return 0;
}

By the code above doesn't sort my matrix object.

Any suggestion would be appreciated.


Tomáš Rampas
---------------------------------------------------------------
gedas ČR s.r.o.
System analyst, MCP
TGM  840, 293 01 Mladá Boleslav, Czech Republic
Telefon/phone   +420-326-711-411
Telefax/fax       +420-326-711-420
rampas@gedas.cz
<http://www.gedas.com/>




More information about the Gsl-discuss mailing list