ESYS13  Revision_
PasoUtil.h
Go to the documentation of this file.
00001 
00002 /*******************************************************
00003 *
00004 * Copyright (c) 2003-2012 by University of Queensland
00005 * Earth Systems Science Computational Center (ESSCC)
00006 * http://www.uq.edu.au/esscc
00007 *
00008 * Primary Business: Queensland, Australia
00009 * Licensed under the Open Software License version 3.0
00010 * http://www.opensource.org/licenses/osl-3.0.php
00011 *
00012 *******************************************************/
00013 
00014 
00015 #ifndef INC_PASO_UTIL
00016 #define INC_PASO_UTIL
00017 
00018 /**************************************************************/
00019 
00020 /*   Some utility routines: */
00021 
00022 /**************************************************************/
00023 
00024 /*   Copyrights by ACcESS Australia, 2003,2004,2005 */
00025 /*   author: l.gross@uq.edu.au */
00026 
00027 /**************************************************************/
00028 
00029 #include "Common.h"
00030 #include "esysUtils/Esys_MPI.h"
00031 #ifdef _OPENMP
00032 #include <omp.h>
00033 #endif
00034 
00035 /**************************************************************/
00036 
00037 index_t Paso_Util_cumsum(dim_t,index_t*);
00038 bool_t Paso_Util_isAny(dim_t N,index_t* array,index_t value);
00039 void Paso_zeroes(const dim_t n, double* x);
00040 void Paso_Update(const dim_t n, const double a, double* x, const double b, const double* y);
00041 void Paso_LinearCombination(const dim_t n, double*z, const double a,const double* x, const double b, const double* y);
00042 double Paso_InnerProduct(const dim_t n,const double* x, const double* y, Esys_MPIInfo* mpiinfo);
00043 double Paso_l2(const dim_t n, const double* x, Esys_MPIInfo* mpiinfo);
00044 void ApplyGivensRotations(const dim_t n,double* v,const double* c,const double* s);
00045 void Paso_Copy(const dim_t n, double* out, const double* in);
00046 bool_t Paso_fileExists( const char* filename );
00047 double Paso_lsup(const dim_t n, const double* x, Esys_MPIInfo* mpiinfo);
00048 index_t Paso_Util_cumsum_maskedTrue(dim_t N,index_t* array, bool_t* mask);
00049 index_t Paso_Util_cumsum_maskedFalse(dim_t N,index_t* array, bool_t* mask);
00050 index_t Paso_Util_arg_max(dim_t n, dim_t* lambda);
00051 index_t Paso_Util_iMax(const dim_t N,const index_t* array);
00052 dim_t Paso_Util_numPositives(const dim_t N, const double *x);
00053 
00054 #define Paso_Scale(n, x, a) Paso_Update(n, a, x, 0, x);
00055 #define Paso_AXPY(n, x, a, y) Paso_Update(n, 1., x, a,  y);
00056 #define Paso_copyShortDouble(n, source, target)  memcpy(target,source,sizeof(double)*(size_t)n)
00057 
00058 
00059 #endif /* #ifndef INC_PASO_UTIL */