Click here to Skip to main content
15,880,543 members
Articles / High Performance Computing / Vectorization

A C++ String Class

Rate me:
Please Sign up or sign in to vote.
4.96/5 (29 votes)
3 Jan 2015CPOL13 min read 120.5K   2.6K   93  
A fast, reference counted, copy-on-write string class
/*
 * -- SuperLU MT routine (version 2.0) --
 * Lawrence Berkeley National Lab, Univ. of California Berkeley,
 * and Xerox Palo Alto Research Center.
 * September 10, 2007
 *
 * Sparse matrix types and function prototypes.
 *
 */

#ifndef __SUPERLU_cSP_DEFS /* allow multiple inclusions */
#define __SUPERLU_cSP_DEFS

#include "hnum_slu_mt_machines.h"

/*
 * File name:           pcsp_defs.h
 * Purpose:             Sparse matrix types and function prototypes
 * History:
 */

#include "hnum_slucmn.h"
#include "hnum_slu_scomplex.h"


namespace harlinn
{
    namespace numerics
    {
        namespace SuperLU
        {
            namespace Complex
            {

                typedef GlobalLU_T<complex> GlobalLU_t;
                typedef pxgstrf_shared_T<GlobalLU_t> pxgstrf_shared_t;
                typedef pxgstrf_threadarg_T<pxgstrf_shared_t> pcgstrf_threadarg_t;


                /* *********************
                   Function prototypes
                   *********************/

                /* ----------------
                   Driver routines 
                   ---------------*/
                void pcgssv(int, SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, 
                       SuperMatrix *, int *);
                void pcgssvx(int, superlumt_options_t *, SuperMatrix *, int *, int *,  
	                equed_t *, float *, float *, SuperMatrix *, SuperMatrix *,
	                SuperMatrix *, SuperMatrix *, 
	                float *, float *, float *, float *, superlu_memusage_t *, 
	                int *);

                /* ---------------
                   Driver related 
                   ---------------*/
                void cgsequ (SuperMatrix *, float *, float *, float *,
                                    float *, float *, int *);
                void claqgs (SuperMatrix *, float *, float *, float, 
		                    float, float, equed_t *);
                void cgscon (char *, SuperMatrix *, SuperMatrix *,
		                    float, float *, int *);
                float cPivotGrowth(int, SuperMatrix *, int *,
			                   SuperMatrix *, SuperMatrix *);
                void cgsrfs (trans_t, SuperMatrix *, SuperMatrix *, SuperMatrix *,
		                    int *, int *, equed_t, float *, float *, SuperMatrix *,
		                    SuperMatrix *, float *, float *, Gstat_t *, int *);
                int  sp_ctrsv (char *, char *, char *, SuperMatrix *, SuperMatrix *,
		                      complex *, int *);
                int  sp_cgemv (char *, complex, SuperMatrix *, complex *,
		                      int, complex, complex *, int);
                int  sp_cgemm (char *, int, int, int, complex, SuperMatrix *, 
		                      complex *, int, complex, complex *, int);

                /* ----------------------
                   Factorization related
                   ----------------------*/

                void cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, complex *,
		                      int *, int *, Stype_t, Dtype_t, Mtype_t);
                void cCreate_CompCol_Permuted(SuperMatrix *, int, int, int, complex *, int *, int *, int *, Stype_t, Dtype_t, Mtype_t);
                void cCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
                void cCreate_Dense_Matrix(SuperMatrix *, int, int, complex *, int,
		                     Stype_t, Dtype_t, Mtype_t);
                void cCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, complex *, int *, int *,
			                int *, int *, int *, Stype_t, Dtype_t, Mtype_t);
                void cCreate_SuperNode_Permuted(SuperMatrix *, int, int, int, complex *, 
			                   int *, int *, int *, int *, int *, int *, 
			                   int *, int *, Stype_t, Dtype_t, Mtype_t);
                void cCopy_Dense_Matrix(int, int, complex *, int, complex *, int);

                

                void callocateA (int, int, complex **, int **, int **);
                
                void get_perm_c(int, SuperMatrix *, int *);
                void csp_colorder (SuperMatrix *, int *, superlumt_options_t *,
			                 SuperMatrix *);
                
                int  cPresetMap (const int, SuperMatrix *, pxgstrf_relax_t *, 
		                       superlumt_options_t *, GlobalLU_t *);
                int  DynamicSetMap(const int, const int, const int, pxgstrf_shared_t*);
                void pcgstrf (superlumt_options_t *, SuperMatrix *, int *, 
		                     SuperMatrix *, SuperMatrix *, Gstat_t *, int *);
                void pcgstrf_init (int, fact_t, trans_t, yes_no_t, int, int, float, yes_no_t, double,
			                  int *, int *, void *, int, SuperMatrix *,
			                  SuperMatrix *, superlumt_options_t *, Gstat_t *);
                pcgstrf_threadarg_t* pcgstrf_thread_init (SuperMatrix *, SuperMatrix *, SuperMatrix *,
		                     superlumt_options_t*, pxgstrf_shared_t*, Gstat_t*, int*);
                void pcgstrf_thread_finalize (pcgstrf_threadarg_t *, pxgstrf_shared_t *,
			                 SuperMatrix *, int *, SuperMatrix *, SuperMatrix *);
                void pcgstrf_finalize(superlumt_options_t *, SuperMatrix *);
                
                int pcgstrf_factor_snode (const int, const int, SuperMatrix *, const float,
		                      yes_no_t *, int *, int *, int*, int*, int*, int*,
		                      complex *, complex *, pxgstrf_shared_t *, int *);
                void pcgstrf_mark_busy_descends (int, int, int *, pxgstrf_shared_t *, int *, int *);
                int  pcgstrf_snode_dfs (const int, const int, const int, const int *,
			                       const int *, const int *, int*, int *, int *,
			                       pxgstrf_shared_t *);
                int  pcgstrf_snode_bmod (const int, const int, const int, const int,
				                complex *, complex *, GlobalLU_t*, Gstat_t*);
                void pcgstrf_panel_dfs (const int, const int, const int, const int,
			                       SuperMatrix *, int*, int*, int*, int*, int*, 
			                       int*, int*, int*, int*, int*, int*, int*, int*,
			                       complex*, GlobalLU_t *);
                void pcgstrf_panel_bmod (const int, const int, const int, const int,
				                const int, int*, int*, int*, int*, int*, int*,
				                int*, int*, complex*, complex*, 
				                pxgstrf_shared_t *);
                void pcgstrf_bmod1D (const int, const int, const int, const int, 
			                    const int, const int, const int, int, int,
			                    int *, int *, int *, int *, complex *, complex *, 
			                    GlobalLU_t *, Gstat_t *);
                void pcgstrf_bmod2D (const int, const int, const int, const int,
			                    const int, const int, const int, int, int,
			                    int *, int *, int *, int *, complex *, complex *,
			                    GlobalLU_t *, Gstat_t *);
#ifndef _MSC_VER
                void pcgstrf_bmod1D_mv2 (const int, const int, const int, const int, 
				                const int, const int, const int, int, int,
				                int *, int *, int *, int *, complex *, 
				                complex *, GlobalLU_t *, Gstat_t *);
                void pcgstrf_bmod2D_mv2 (const int, const int, const int, const int,
				                const int, const int, const int, int, int,
				                int *, int *, int *, int *, complex *, complex *,
				                GlobalLU_t *, Gstat_t *);
#endif
                int  pcgstrf_column_dfs(const int, const int, const int, const int,
			                       int*, int*, int*, int, int*, int*, int*, int*,
			                       int *, int *, int *, int *, pxgstrf_shared_t *);
                int  pcgstrf_column_bmod(const int, const int, const int, const int, 
				                int*, int*, complex*, complex*,
				                pxgstrf_shared_t *, Gstat_t *);
                int  pcgstrf_pivotL (const int, const int, const float, yes_no_t*,
			                    int*, int*, int*, int*, GlobalLU_t*, Gstat_t*);
                int  pcgstrf_copy_to_ucol (const int, const int, const int, const int *,
				                  const int *, const int *, complex*,
				                  pxgstrf_shared_t*);
                void pcgstrf_pruneL (const int, const int *, const int, const int,
			                    const int *, const int *, int*, int *,
			                    GlobalLU_t *);
                void compressSUP (const int, GlobalLU_t *);
                void creadmt (int *, int *, int *, complex **, int **, int **);
                void creadhb (int *, int *, int *, complex **, int **, int **);
                void cGenXtrue (int, int, complex *, int);
                void cFillRHS (trans_t, int, complex *, int,  SuperMatrix *, SuperMatrix *);
                void cgstrs (trans_t, SuperMatrix *, SuperMatrix*,  int*, int*, SuperMatrix*, Gstat_t *, int *);


                /* ---------------
                   Memory related 
                   ---------------*/
                float pcgstrf_MemInit (int, int, superlumt_options_t *,
			                SuperMatrix *, SuperMatrix *, GlobalLU_t *);
                float pcgstrf_memory_use(const int, const int, const int);
                int  pcgstrf_WorkInit (int, int, int **, complex **);
                
                void pcgstrf_SetRWork (int, int, complex *, complex **, complex **);
                void pcgstrf_WorkFree (int *, complex *, GlobalLU_t *);
                int  pcgstrf_MemXpand (int, int, MemType, int *, GlobalLU_t *);

                complex *complexMalloc(int);
                complex *complexCalloc(int);
                int  memory_usage ();
                int  superlu_cQuerySpace (int, SuperMatrix *, SuperMatrix *, int, 
				                 superlu_memusage_t *);
                int  Glu_alloc (const int, const int, const int, const MemType,
		                       int *, pxgstrf_shared_t *);

                /* -------------------
                   Auxiliary routines
                   -------------------*/
                void    cfill(complex *, int, complex);
                void    cinf_norm_error(int, SuperMatrix *, complex *);
                void    snode_profile(int, int *);
                void    super_stats(int, int *, int *);
                void    panel_stats(int, int, int *, Gstat_t *);
                void    PrintSumm(char *, int, int, int);
                void    cPrintPerf(SuperMatrix *, SuperMatrix *, superlu_memusage_t *,
			                 float, float, float *, float *, char *,
			                 Gstat_t *);
                void    cCompRow_to_CompCol(int m, int n, int nnz, 
                                           complex *a, int *colind, int *rowptr,
                                           complex **at, int **rowind, int **colptr);


                /* -----------------------
                   Routines for debugging
                   -----------------------*/
                void    print_lu_col(int, char *, int, int, int, int *, GlobalLU_t *);
                void    print_panel_seg(int, int, int, int, int *, int *);
                void    ccheck_zero_vec(int, char *, int, complex *);
                void    check_repfnz(int, int, int, int *);


                void *pcgstrf_thread(void *arg);


            };
        };
    };
};


#endif /* __SUPERLU_CSP_DEFS */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Sea Surveillance AS
Norway Norway
Chief Architect - Sea Surveillance AS.

Specializing in integrated operations and high performance computing solutions.

I’ve been fooling around with computers since the early eighties, I’ve even done work on CP/M and MP/M.

Wrote my first “real” program on a BBC micro model B based on a series in a magazine at that time. It was fun and I got hooked on this thing called programming ...

A few Highlights:

  • High performance application server development
  • Model Driven Architecture and Code generators
  • Real-Time Distributed Solutions
  • C, C++, C#, Java, TSQL, PL/SQL, Delphi, ActionScript, Perl, Rexx
  • Microsoft SQL Server, Oracle RDBMS, IBM DB2, PostGreSQL
  • AMQP, Apache qpid, RabbitMQ, Microsoft Message Queuing, IBM WebSphereMQ, Oracle TuxidoMQ
  • Oracle WebLogic, IBM WebSphere
  • Corba, COM, DCE, WCF
  • AspenTech InfoPlus.21(IP21), OsiSoft PI


More information about what I do for a living can be found at: harlinn.com or LinkedIn

You can contact me at espen@harlinn.no

Comments and Discussions