#include "../include/lass.h"

/**
 *
 * 	@file isss_dcg.c
 *
 * 	@brief LASs-ISSs dsss_dcg routine.
 *
 * 	LASs-ISSs is a software package provided by:
 * 	Barcelona Supercomputing Center - Centro Nacional de Supercomputacion
 *
 * 	@author Sandra Catalán sandra.catalan@bsc.es 
 * 	@author Pedro Valero-Lara pedro.valero@bsc.es 
 * 	@date 2019-05-30
 * 	@reviewer
 * 	@modified 
 *
 **/

/**
 *  
 *	@ingroup ISSs
 *   
 *	Solves a system of linear equations with the CSR format:
 *
 *		AX = B
 *
 *	where X and B are vectors, and 
 *  A is a sparse matrix stored in the next three vectors 
 *  VAL_A, COL_IND_A and ROW_PTR_A according to CSR format.
 *
 **/

/**
 *    
 *	@param[in]
 *  N   		int.
 *	    		N specifies the number of rows and columns of A.
 *
 *	@param[in]
 *  VAL_A		double *.
 *	       		VAL_A is a pointer to a vector which specifies the non-zero 
 *          	values of the original matrix A. 
 *   
 *	@param[in]
 *  COL_IND_A  	unsigned int *.
 * 		    	COL_IND_A is a pointer to a vector which specifies the 
 *				column index of each value of A in the original matrix. 
 *   
 *	@param[in]
 *  ROW_PTR_A   unsigned int *.
 * 		    	ROW_PTR_A is a pointer to a vector which specifies the number of
 *				values that A contains in each row of the original matrix.
 *
 *  @param[in]
 *  B       	double *.
 *          	B is a pointer to a vector of dimension N. 
 *
 *	@param[in, out]
 *  X  			double *.
 *          	X is a pointer to a vector of dimension N. 
 *				On exit, Y is overwritten by the CG result. 
 *   
 *
 **/

/**
 *
 *	@retval Success sucessful exit
 *	@retval NoSuccess unsucessful exit
 *
 **/

/**
 * 
 * @sa kdcg
 *
 **/

int isss_dcg( int N, 
		const double *VAL_A, const int *ROW_PTR_A, const int *COL_IND_A, 
		const double *B,
		double *X )
{

    if ( N < 0 )
    {
        fprintf( stderr, "Illegal value of N, in dsss_dcg code\n" );
        return NoSuccess;
    }

	return kdcg( N, VAL_A, ROW_PTR_A, COL_IND_A, B, X );

} 
