/* Copyright 1998-2011 Research Foundation State University of New York */ /* This file is part of QUB Express. */ /* QUB Express is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation, either version 3 of the License, or */ /* (at your option) any later version. */ /* QUB Express is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* You should have received a copy of the GNU General Public License, */ /* named LICENSE.txt, in the QUB Express program directory. If not, see */ /* . */ #ifndef MILUTIL_H #define MILUTIL_H /* begin_html See also: Up: Index end_html */ #include "qubfast.h" inline double DSQR( double a ) { return ((a)==0.0?0.0:(a)*(a)); } inline double DMAX( double a, double b ) { return ((a)>(b)?(a):(b)); } inline double DMIN( double a, double b ) { return ((a)<(b)?(a):(b)); } // UNUSED inline int IMIN( int a, int b ) { return ((a)<(b)?(a):(b)); } inline int IMAX( int a, int b ) { return ((a)>(b)?(a):(b)); } #ifdef __cplusplus extern "C" { #endif QUBFAST_API int *int_alloc1D(int size); QUBFAST_API float *float_alloc1D(int size); QUBFAST_API double *double_alloc1D(int size); QUBFAST_API double **double_alloc2D(int row, int col); QUBFAST_API double ***double_alloc3D(int row, int col, int depth); QUBFAST_API void free_2D(char **ptr); QUBFAST_API void free_3D(char ***ptr); QUBFAST_API void mxm(int m, int n, int p, double **a, double **b, double **c); QUBFAST_API void mxv(int m, int n, double **a, double *beta, double *alpha); QUBFAST_API void vxm(int m, int n, double **a, double *beta, double *alpha); QUBFAST_API int imaxv(int *d, int n); QUBFAST_API double dsumv(double *d, int n); QUBFAST_API void dzerom(int m, int n, double **a); QUBFAST_API void dzerov(int n, double *v); #ifdef __cplusplus } #endif #endif