removed transpose.c, since it is now contained in csr_matop.c in the seq_mv
directory, and changed the calling sequence for hypre_CSRMatrixTranspose.c in rap.
This commit is contained in:
parent
3984b5ece1
commit
72f7edc43d
@ -79,7 +79,6 @@ FILES =\
|
||||
relax.c\
|
||||
schwarz.c\
|
||||
scaled_matnorm.c\
|
||||
transpose.c\
|
||||
trunc.c\
|
||||
Atrunc.c\
|
||||
HYPRE_amg.c\
|
||||
|
||||
@ -220,9 +220,6 @@ int update_entry( int weight , int *weight_max , int *previous , int *next , int
|
||||
int remove_entry( int weight , int *weight_max , int *previous , int *next , int *first , int *last , int head , int tail , int i );
|
||||
int move_entry( int weight , int *weight_max , int *previous , int *next , int *first , int *last , int head , int tail , int i );
|
||||
|
||||
/* transpose.c */
|
||||
int hypre_CSRMatrixTranspose( hypre_CSRMatrix *A , hypre_CSRMatrix **AT );
|
||||
|
||||
/* trunc.c */
|
||||
int hypre_AMGTruncation( hypre_CSRMatrix *A , double trunc_factor , int max_elmts );
|
||||
void swap3( int *v , double *w , int i , int j );
|
||||
|
||||
@ -67,7 +67,7 @@ hypre_CSRMatrix **RAP_ptr;
|
||||
* Copy RT into R so that we have row-wise access to restriction.
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
hypre_CSRMatrixTranspose(RT, &R); /* could call PETSc MatTranspose */
|
||||
hypre_CSRMatrixTranspose(RT, &R, 1); /* could call PETSc MatTranspose */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Access the CSR vectors for R, A, P. Also get sizes of fine and
|
||||
|
||||
@ -1,129 +0,0 @@
|
||||
|
||||
|
||||
/*BHEADER**********************************************************************
|
||||
* (c) 1998 The Regents of the University of California
|
||||
*
|
||||
* See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
|
||||
* notice, contact person, and disclaimer.
|
||||
*
|
||||
* $Revision$
|
||||
*********************************************************************EHEADER*/
|
||||
/******************************************************************************
|
||||
*
|
||||
* Finds transpose of a hypre_CSRMatrix
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* hypre_CSRMatrixTranspose
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
int hypre_CSRMatrixTranspose(A, AT)
|
||||
|
||||
hypre_CSRMatrix *A;
|
||||
hypre_CSRMatrix **AT;
|
||||
|
||||
{
|
||||
double *A_data = hypre_CSRMatrixData(A);
|
||||
int *A_i = hypre_CSRMatrixI(A);
|
||||
int *A_j = hypre_CSRMatrixJ(A);
|
||||
int num_rowsA = hypre_CSRMatrixNumRows(A);
|
||||
int num_colsA = hypre_CSRMatrixNumCols(A);
|
||||
int num_nonzerosA = hypre_CSRMatrixNumNonzeros(A);
|
||||
|
||||
double *AT_data;
|
||||
int *AT_i;
|
||||
int *AT_j;
|
||||
int num_rowsAT;
|
||||
int num_colsAT;
|
||||
int num_nonzerosAT;
|
||||
|
||||
int max_col;
|
||||
int i, j;
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* First, ascertain that num_cols and num_nonzeros has been set.
|
||||
* If not, set them.
|
||||
*--------------------------------------------------------------*/
|
||||
|
||||
if (! num_nonzerosA)
|
||||
{
|
||||
num_nonzerosA = A_i[num_rowsA];
|
||||
}
|
||||
|
||||
if (! num_colsA)
|
||||
{
|
||||
max_col = 0;
|
||||
for (i = 0; i < num_rowsA; ++i)
|
||||
{
|
||||
for (j = A_i[i]; j < A_i[i+1]; j++)
|
||||
{
|
||||
if (A_j[j] > max_col)
|
||||
max_col = A_j[j];
|
||||
}
|
||||
}
|
||||
num_colsA = max_col+1;
|
||||
}
|
||||
|
||||
num_rowsAT = num_colsA;
|
||||
num_colsAT = num_rowsA;
|
||||
num_nonzerosAT = num_nonzerosA;
|
||||
|
||||
*AT = hypre_CSRMatrixCreate(num_rowsAT, num_colsAT, num_nonzerosAT);
|
||||
hypre_CSRMatrixInitialize(*AT);
|
||||
|
||||
AT_data = hypre_CSRMatrixData(*AT);
|
||||
AT_i = hypre_CSRMatrixI(*AT);
|
||||
AT_j = hypre_CSRMatrixJ(*AT);
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
* Count the number of entries in each column of A (row of AT)
|
||||
* and fill the AT_i array.
|
||||
*-----------------------------------------------------------------*/
|
||||
|
||||
for (i = 0; i < num_nonzerosA; i++)
|
||||
{
|
||||
++AT_i[A_j[i]+1];
|
||||
}
|
||||
|
||||
for (i = 2; i <= num_rowsAT; i++)
|
||||
{
|
||||
AT_i[i] += AT_i[i-1];
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* Load the data and column numbers of AT
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
for (i = 0; i < num_rowsA; i++)
|
||||
{
|
||||
for (j = A_i[i]; j < A_i[i+1]; j++)
|
||||
{
|
||||
AT_j[AT_i[A_j[j]]] = i;
|
||||
AT_data[AT_i[A_j[j]]] = A_data[j];
|
||||
AT_i[A_j[j]]++;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------
|
||||
* AT_i[j] now points to the *end* of the jth row of entries
|
||||
* instead of the beginning. Restore AT_i to front of row.
|
||||
*------------------------------------------------------------*/
|
||||
|
||||
for (i = num_rowsAT; i > 0; i--)
|
||||
{
|
||||
AT_i[i] = AT_i[i-1];
|
||||
}
|
||||
|
||||
AT_i[0] = 0;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user