Click here to Skip to main content
15,891,136 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 121K   2.6K   93  
A fast, reference counted, copy-on-write string class
#include "stdafx.h"
#include "hnum_slu_mt_machines.h"

#include "hnum_slucmn.h"

namespace harlinn
{
    namespace numerics
    {
        namespace SuperLU
        {

            int sp_ienv(int ispec)
            {
            /*
             * -- SuperLU MT routine (version 1.0) --
             * Univ. of California Berkeley, Xerox Palo Alto Research Center,
             * and Lawrence Berkeley National Lab.
             * August 15, 1997
             *
             *  Purpose   
             *  =======   
             *
             *  sp_ienv() is inquired to choose machine-dependent parameters for the
             *  local environment. See ISPEC for a description of the parameters.   
             *
             *  This version provides a set of parameters which should give good,   
             *  but not optimal, performance on many of the currently available   
             *  computers.  Users are encouraged to modify this subroutine to set   
             *  the tuning parameters for their particular machine using the option   
             *  and problem size information in the arguments.   
             *
             *  Arguments   
             *  =========   
             *
             *  ISPEC   (input) int
             *          Specifies the parameter to be returned as the value of SP_IENV.   
             *          = 1: the panel size w; a panel consists of w consecutive
             *               columns of matrix A in the process of Gaussian elimination.
             *               The best value depends on machine's cache characters.
             *          = 2: the relaxation parameter relax; if the number of
             *               nodes (columns) in a subtree of the elimination tree is less
             *               than relax, this subtree is considered as one supernode,
             *               regardless of the their row structures.
             *          = 3: the maximum size for a supernode;
             *          = 4: the minimum row dimension for 2-D blocking to be used;
             *          = 5: the minimum column dimension for 2-D blocking to be used;
             *          = 6: size of the array to store the values of the L supernodes;
             *               a negative number represents the fills growth factor, i.e.,
             *               the product of its magnitude and the number of nonzeros in the
             *               original A will be used to allocate storage;
             *               a positive number represents the number of nonzeros;
             *          = 7: size of the array to store the columns in U;
             *               a negative number represents the fills growth factor, i.e.,
             *               the product of its magnitude and the number of nonzeros in the
             *               original A will be used to allocate storage;
             *               a positive number represents the number of nonzeros;
             *          = 8: size of the array to store the subscripts of the L supernodes;
             *               a negative number represents the fills growth factor, i.e.,
             *               the product of its magnitude and the number of nonzeros in the
             *               original A will be used to allocate storage;
             *               a positive number represents the number of nonzeros;
             *   
             * (SP_IENV) (output) int
             *          >= 0: the value of the parameter specified by ISPEC   
             *          < 0:  if SP_IENV = -k, the k-th argument had an illegal value. 
             *
             *  ===================================================================== 
             */
                int i;

                switch (ispec) {

            #if ( MACH==SGI )
	            case 1: return (20);
	            case 2: return (6);
	            case 3: return (100);
	            case 4: return (800);
	            case 5: return (100);
            #elif ( MACH==ORIGIN ) 
	            case 1: return (12);
	            case 2: return (6);
	            case 3: return (100);
	            case 4: return (400);
	            case 5: return (100);
            #elif ( MACH==DEC )
	            case 1: return (16);
	            case 2: return (6);
	            case 3: return (50);
	            case 4: return (100);
	            case 5: return (40);
            #elif ( MACH==CRAY_PVP )
	            case 1: return (1);
	            case 2: return (6);
	            case 3: return (64);
	            case 4: return (400);
	            case 5: return (200);
            #elif ( MACH==SUN )
	            case 1: return (8);
	            case 2: return (6);
	            case 3: return (100);
	            case 4: return (400);
	            case 5: return (40);
            #else
	            case 1: return (20);
	            case 2: return (6);
	            case 3: return (200);
	            case 4: return (200);
	            case 5: return (100);
            #endif
                    case 6: return (-50);
                    case 7: return (-50);
                    case 8: return (-30);
                }

                /* Invalid value for ISPEC */
                i = 1;
                xerbla_("sp_ienv", &i);
                return 0;

            } /* sp_ienv_ */

        };
    };
};

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