diff options
author | torset | 2009-02-17 15:34:23 +0000 |
---|---|---|
committer | torset | 2009-02-17 15:34:23 +0000 |
commit | 853aa42539de40bdcf220c0066b89e6da5d38936 (patch) | |
tree | 308b586a036e6bb9f59a399183776868d15ec4a4 /src/auxiliaryFunctions | |
parent | ec715fdbd253ac7c172d4f9e2305731e1e71908c (diff) | |
download | scilab2c-853aa42539de40bdcf220c0066b89e6da5d38936.tar.gz scilab2c-853aa42539de40bdcf220c0066b89e6da5d38936.tar.bz2 scilab2c-853aa42539de40bdcf220c0066b89e6da5d38936.zip |
add max function for arrays
Diffstat (limited to 'src/auxiliaryFunctions')
-rw-r--r-- | src/auxiliaryFunctions/includes/max.h | 4 | ||||
-rw-r--r-- | src/auxiliaryFunctions/includes/min.h | 3 | ||||
-rw-r--r-- | src/auxiliaryFunctions/interfaces/int_max.h | 26 | ||||
-rw-r--r-- | src/auxiliaryFunctions/interfaces/int_min.h | 26 |
4 files changed, 59 insertions, 0 deletions
diff --git a/src/auxiliaryFunctions/includes/max.h b/src/auxiliaryFunctions/includes/max.h index 30317114..c37bfea5 100644 --- a/src/auxiliaryFunctions/includes/max.h +++ b/src/auxiliaryFunctions/includes/max.h @@ -15,4 +15,8 @@ #define max(a,b) (a>=b?a:b) +#define maxa(a,size1,b,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=max(a[i],b[i]);\ + } + #endif /* !__MAX_H__ */ diff --git a/src/auxiliaryFunctions/includes/min.h b/src/auxiliaryFunctions/includes/min.h index 462bd671..70097d10 100644 --- a/src/auxiliaryFunctions/includes/min.h +++ b/src/auxiliaryFunctions/includes/min.h @@ -14,4 +14,7 @@ #define min(a,b) (a<=b?a:b) +#define mina(a,size1,b,size2,out) {int i;\ + for (i=0;i<size1[0]*size2[1];i++) out[i]=min(a[i],b[i]);\ + } #endif /* !__MIN_H__ */ diff --git a/src/auxiliaryFunctions/interfaces/int_max.h b/src/auxiliaryFunctions/interfaces/int_max.h new file mode 100644 index 00000000..a3f0562d --- /dev/null +++ b/src/auxiliaryFunctions/interfaces/int_max.h @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_MAX_H__ +#define __INT_MAX_H__ + +#define s0s0maxs0(in1,in2) max(in1,in2) + +#define d0d0maxd0(in1,in2) max(in1,in2) + +#define s2s2maxs2(in,size,out) maxa(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#define d2d2maxd2(in,size,out) maxa(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#endif /* !__INT_MAX_H__ */ diff --git a/src/auxiliaryFunctions/interfaces/int_min.h b/src/auxiliaryFunctions/interfaces/int_min.h new file mode 100644 index 00000000..d7c59c0c --- /dev/null +++ b/src/auxiliaryFunctions/interfaces/int_min.h @@ -0,0 +1,26 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_MIN_H__ +#define __INT_MIN_H__ + +#define s0s0mins0(in1,in2) min(in1,in2) + +#define d0d0mind0(in1,in2) min(in1,in2) + +#define s2s2mins2(in,size,out) mina(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#define d2d2mind2(in,size,out) mina(in1, size[0]*size[1], in2, size[0]*size[1], out) + +#endif /* !__INT_MIN_H__ */ |