コード例 #1
0
ファイル: matrix.c プロジェクト: djachoc/R-Package-npRmpi
/*
 *-----------------------------------------------------------------------------
 *       funct:  mat_free
 *       desct:  free an allocated matrix
 *       given:  A = matrix
 *       retrn:  nothing <actually 0 = NULL A passed, 1 = normal exit>
 *-----------------------------------------------------------------------------
 */
int mat_free( MATRIX A )
{
	int i;

	if (A==NULL)
	{
		REprintf("\nAttempting to free a non-existent matrix in mat_free()\n");
		return (0);
	}

	for (i=0; i<MatRow(A); i++)
	{
		if((A[i]==NULL))
		{
			REprintf("\nAttempting to free a non-existent matrix row in mat_free()\n");
			return (0);
		}
		else
		{
			free(A[i]);
		}
	}

	free(Mathead(A));

	return (1);
}
コード例 #2
0
ファイル: matrix.c プロジェクト: PAAW/mAEWing1
/*
*-----------------------------------------------------------------------------
*	funct:	mat_free
*	desct:	free an allocated matrix
*	given:  A = matrix
*	retrn:	nothing <actually 0 = NULL A passed, 1 = normal exit>
*-----------------------------------------------------------------------------
*/
int mat_free(MATRIX A)
{
	int i;

	if (A == NULL)
		return (0);
	for (i=0; i<MatRow(A); i++)
		{
		free( A[i] );
		}
	free( Mathead(A) );
	return (1);
}