diff options
Diffstat (limited to '2.3-1/src')
100 files changed, 3548 insertions, 417 deletions
diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/dranda.c b/2.3-1/src/c/auxiliaryFunctions/rand/dranda.c index f4678279..3defc264 100644 --- a/2.3-1/src/c/auxiliaryFunctions/rand/dranda.c +++ b/2.3-1/src/c/auxiliaryFunctions/rand/dranda.c @@ -16,5 +16,5 @@ void dranda(double *out, int size) { int i = 0; for (i = 0 ; i < size ; ++i) { out[i] = drands(); - } + } } diff --git a/2.3-1/src/c/auxiliaryFunctions/rand/drands.c b/2.3-1/src/c/auxiliaryFunctions/rand/drands.c index 9b7c4cf4..658cd0b0 100644 --- a/2.3-1/src/c/auxiliaryFunctions/rand/drands.c +++ b/2.3-1/src/c/auxiliaryFunctions/rand/drands.c @@ -34,37 +34,60 @@ double drands(void) { if (m2==0){ /* if first entry, compute machine integer word length */ - while (m>m2){ + while (m>m2){ m2=m; m=itwo*m2; + } + halfm = m2; - - /* compute multiplier and increment for linear congruential method */ + + /* compute multiplier and increment for linear congruential method */ ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; - ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) + 1; - mic = (m2 - ic) + m2; - - /* s is the scale factor for converting to floating point */ + + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) + 1; + + mic = (m2 - ic) + m2; + + /* s is the scale factor for converting to floating point */ s = 0.5/halfm; + + } /* compute next random number */ iy = iy*ia; + + /* the following statement is for computers which do not allow integer overflow on addition */ - if (iy > mic) iy = (iy - m2) - m2; + if (iy > mic) + { + iy = (iy - m2) - m2; + + } iy = iy + ic; /* the following statement is for computers where the word length for addition is greater than for multiplication */ - if (iy/2 > m2) iy = (iy - m2) - m2; + if (iy/2 > m2) + { + iy = (iy - m2) - m2; + + } /* the following statement is for computers where integer overflow affects the sign bit */ - if (iy < 0) iy = (iy + m2) + m2; + if (iy < 0) + { + iy = (iy + m2) + m2; + + + } + + return (double)iy*s; } diff --git a/2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ b/2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ deleted file mode 100644 index 20593bff..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ +++ /dev/null @@ -1,24 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitget.h" -#include<stdio.h> - -uint16 u16bitgets(uint16 value,int position) -{ - - value = value >> (position -1); - value = value & 1; - return value; - - /*unsigned char mask = 1<<(position-1); - uint16 bit = value&mask; - if(bit > 0) - { - return 1; - } - else - { - return 0; - }*/ - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ b/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ deleted file mode 100644 index 130bff86..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ +++ /dev/null @@ -1,24 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitget.h" -#include<stdio.h> - -uint8 u8bitgets(uint8 value,int position) -{ - - value = value >> (position -1); - value = value & 1; - return value; - - /*unsigned char mask = 1<<(position-1); - uint8 bit = value&mask; - if(bit > 0) - { - return 1; - } - else - { - return 0; - }*/ - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ deleted file mode 100644 index d411e6e4..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitand.h" - -void dbitanda(double* x,double* y,int size,double* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = dbitands(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitor/dbitands.c~ b/2.3-1/src/c/elementaryFunctions/bitor/dbitands.c~ deleted file mode 100644 index a66e3c13..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/dbitands.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitand.h" - -double dbitands(double x,double y) -{ - return ((int)x & (int)y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u16bitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u16bitanda.c~ deleted file mode 100644 index 743161ea..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u16bitanda.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitand.h" - -void u16bitanda(uint16* x,uint16* y,int size,uint16* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u16bitands(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u16bitands.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u16bitands.c~ deleted file mode 100644 index 7ba73c15..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u16bitands.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitand.h" - -uint16 u16bitands(uint16 x,uint16 y) -{ - return (x & y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c~ deleted file mode 100644 index 84722e18..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitor.h" - -void u16bitora(uint16* x,uint16* y,int size,uint16* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u16bitors(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c~ deleted file mode 100644 index e48e3000..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitor.h" - -uint16 u16bitors(uint16 x,uint16 y) -{ - return (x | y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u8bitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u8bitanda.c~ deleted file mode 100644 index e1260a71..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u8bitanda.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitand.h" - -void u8bitanda(uint8* x,uint8* y,int size,uint8* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u8bitands(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u8bitands.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u8bitands.c~ deleted file mode 100644 index eda3ccc6..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u8bitands.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitand.h" - -uint8 u8bitands(uint8 x,uint8 y) -{ - return (x & y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c~ deleted file mode 100644 index edda9bba..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitor.h" - -void u8bitora(uint8* x,uint8* y,int size,uint8* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u8bitors(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c~ b/2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c~ deleted file mode 100644 index 56d3540d..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitor.h" - -uint8 u8bitors(uint8 x,uint8 y) -{ - return (x | y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ b/2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ deleted file mode 100644 index 953e46c9..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ +++ /dev/null @@ -1,20 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitset.h" -#include<stdio.h> - -uint16 u16bitsets(uint16 value,int position,int bit_value) -{ - if(bit_value==1) - { - unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe - return (mask1 | value); - } - else - { - unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe - return (mask2 & value); - - } - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ b/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ deleted file mode 100644 index 5f44dcd8..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ +++ /dev/null @@ -1,20 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitset.h" -#include<stdio.h> - -uint8 u8bitsets(uint8 value,int position,int bit_value) -{ - if(bit_value==1) - { - unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe - return (mask1 | value); - } - else - { - unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe - return (mask2 & value); - - } - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ deleted file mode 100644 index d411e6e4..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitand.h" - -void dbitanda(double* x,double* y,int size,double* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = dbitands(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/dbitands.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/dbitands.c~ deleted file mode 100644 index a66e3c13..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/dbitands.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitand.h" - -double dbitands(double x,double y) -{ - return ((int)x & (int)y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u16bitanda.c~ deleted file mode 100644 index 743161ea..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitanda.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitand.h" - -void u16bitanda(uint16* x,uint16* y,int size,uint16* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u16bitands(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitands.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u16bitands.c~ deleted file mode 100644 index 7ba73c15..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitands.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitand.h" - -uint16 u16bitands(uint16 x,uint16 y) -{ - return (x & y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitora.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u16bitora.c~ deleted file mode 100644 index 84722e18..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitora.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitor.h" - -void u16bitora(uint16* x,uint16* y,int size,uint16* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u16bitors(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitors.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u16bitors.c~ deleted file mode 100644 index e48e3000..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitors.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitor.h" - -uint16 u16bitors(uint16 x,uint16 y) -{ - return (x | y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitxora.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u16bitxora.c~ deleted file mode 100644 index 6f50f068..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitxora.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitxor.h" - -void u16bitxora(uint16* x,uint16* y,int size,uint16* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u16bitxors(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitxors.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u16bitxors.c~ deleted file mode 100644 index 03ca8f83..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u16bitxors.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitxor.h" - -uint16 u16bitxors(uint16 x,uint16 y) -{ - return (x ^ y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u8bitanda.c~ deleted file mode 100644 index e1260a71..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitanda.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitand.h" - -void u8bitanda(uint8* x,uint8* y,int size,uint8* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u8bitands(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitands.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u8bitands.c~ deleted file mode 100644 index eda3ccc6..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitands.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitand.h" - -uint8 u8bitands(uint8 x,uint8 y) -{ - return (x & y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitora.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u8bitora.c~ deleted file mode 100644 index edda9bba..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitora.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitor.h" - -void u8bitora(uint8* x,uint8* y,int size,uint8* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u8bitors(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitors.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u8bitors.c~ deleted file mode 100644 index 56d3540d..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitors.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitor.h" - -uint8 u8bitors(uint8 x,uint8 y) -{ - return (x | y); - -} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitxora.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u8bitxora.c~ deleted file mode 100644 index ad7cc24e..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitxora.c~ +++ /dev/null @@ -1,14 +0,0 @@ -/* Scilab2C FOSSEE IITB */ -#include "bitxor.h" - -void u8bitxora(uint8* x,uint8* y,int size,uint8* out) -{ - int i = 0; - for(i=0;i<size;i++) - { - out[i] = u8bitxors(x[i],y[i]); - } - - -} - diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitxors.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/u8bitxors.c~ deleted file mode 100644 index 9a346eee..00000000 --- a/2.3-1/src/c/elementaryFunctions/bitxor/u8bitxors.c~ +++ /dev/null @@ -1,9 +0,0 @@ -/* Scilab2C FOSSEE IITB */ - -#include "bitxor.h" - -uint8 u8bitxors(uint8 x,uint8 y) -{ - return (x ^ y); - -} diff --git a/2.3-1/src/c/matrixOperations/determ/i16determa.c b/2.3-1/src/c/matrixOperations/determ/i16determa.c new file mode 100644 index 00000000..a1184553 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/determ/i16determa.c @@ -0,0 +1,92 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +int16 i16determa(int16 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + int16 out=0; + int16 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(int16*)malloc((unsigned int)(size*size)*sizeof(int16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + int16 out=0, pivot=0; + int16 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(int16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/2.3-1/src/c/matrixOperations/determ/i8determa.c b/2.3-1/src/c/matrixOperations/determ/i8determa.c new file mode 100644 index 00000000..9693fe67 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/determ/i8determa.c @@ -0,0 +1,92 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +int8 i8determa(int8 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + int8 out=0; + int8 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(int8*)malloc((unsigned int)(size*size)*sizeof(int8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + int8 out=0, pivot=0; + int8 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(int8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/2.3-1/src/c/matrixOperations/determ/u16determa.c b/2.3-1/src/c/matrixOperations/determ/u16determa.c new file mode 100644 index 00000000..480d1ed3 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/determ/u16determa.c @@ -0,0 +1,92 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +uint16 u16determa(uint16 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + uint16 out=0; + uint16 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(uint16*)malloc((unsigned int)(size*size)*sizeof(uint16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + uint16 out=0, pivot=0; + uint16 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(uint16)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/2.3-1/src/c/matrixOperations/determ/u8determa.c b/2.3-1/src/c/matrixOperations/determ/u8determa.c new file mode 100644 index 00000000..3fb18d54 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/determ/u8determa.c @@ -0,0 +1,92 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#include <stdlib.h> +#ifndef WITHOUT_LAPACK +#include "lapack.h" +#endif +#include "determ.h" +#include "lapack.h" + +uint8 u8determa(uint8 * in, int size){ +#ifndef WITHOUT_LAPACK + int i=0, info=0; + uint8 out=0; + uint8 *inCopy=NULL; + int* tmp=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=(uint8*)malloc((unsigned int)(size*size)*sizeof(uint8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + tmp=(int*)malloc((unsigned int)size*sizeof(int)); + dgetrf_(&size, &size, inCopy, &size, tmp, &info); + out=1; + for (i=0;i<size;i++){ + if (tmp[i]!=i+1) out=-out; + out=inCopy[i*(size+1)]*out; + } + free(tmp); + free(inCopy); + break; + } + +#else + int i=0, j=0, k=0; + uint8 out=0, pivot=0; + uint8 *inCopy=NULL; + + /*Calculation of the determinant*/ + switch (size){ + case 2 : out = in[0]*in[3]-in[1]*in[2]; + break; + case 3 : /*regle de Sarrus*/ + out = in[0]*in[4]*in[8]+in[1]*in[5]*in[6]+in[2]*in[3]*in[7] + -in[0]*in[5]*in[7]-in[1]*in[3]*in[8]-in[2]*in[4]*in[6]; + break; + default : + + /*Copy the input matrix*/ + inCopy=malloc((unsigned int)(size*size)*sizeof(uint8)); + for (i=0;i<size*size;i++) inCopy[i]=in[i]; + + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + pivot = inCopy[i*size+j]/inCopy[i*size+i]; + for (k=0;k<size-i;k++){ + inCopy[i*size+j+k*size]-=pivot*inCopy[i*size+i+k*size]; + } + } + } + out=1; + for (i=0;i<size;i++){ + out *= inCopy[i*size+i]; + } + free(inCopy); + break; + + } +#endif + + + return out; +} diff --git a/2.3-1/src/c/matrixOperations/diag/ddiaga.c b/2.3-1/src/c/matrixOperations/diag/ddiaga.c new file mode 100644 index 00000000..26363ef9 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/ddiaga.c @@ -0,0 +1,40 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void ddiaga(double in, int size,int insert_post,double *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/ddiagexa.c b/2.3-1/src/c/matrixOperations/diag/ddiagexa.c new file mode 100644 index 00000000..191c1311 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/ddiagexa.c @@ -0,0 +1,130 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void ddiagexa(double *in, int _row,int _column,int extract_post,double *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/ddiagexs.c b/2.3-1/src/c/matrixOperations/diag/ddiagexs.c new file mode 100644 index 00000000..fb007b52 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/ddiagexs.c @@ -0,0 +1,53 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +double ddiagexs(double *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/ddiagina.c b/2.3-1/src/c/matrixOperations/diag/ddiagina.c new file mode 100644 index 00000000..c4093b2d --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/ddiagina.c @@ -0,0 +1,59 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void ddiagina(double *in, int _row,int _column,int insert_post,double *out) +{ + + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/ddiagins.c b/2.3-1/src/c/matrixOperations/diag/ddiagins.c new file mode 100644 index 00000000..d1fc527a --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/ddiagins.c @@ -0,0 +1,37 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void ddiagins(double *in, int size,double *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/ddiags.c b/2.3-1/src/c/matrixOperations/diag/ddiags.c new file mode 100644 index 00000000..b43e5d63 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/ddiags.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +double ddiags(double in) +{ + + return in; + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i16diaga.c b/2.3-1/src/c/matrixOperations/diag/i16diaga.c new file mode 100644 index 00000000..29f92907 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i16diaga.c @@ -0,0 +1,40 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void i16diaga(int16 in, int size,int insert_post,int16 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i16diagexa.c b/2.3-1/src/c/matrixOperations/diag/i16diagexa.c new file mode 100644 index 00000000..7e85c916 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i16diagexa.c @@ -0,0 +1,130 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void i16diagexa(int16 *in, int _row,int _column,int extract_post,int16 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i16diagexs.c b/2.3-1/src/c/matrixOperations/diag/i16diagexs.c new file mode 100644 index 00000000..87536ce1 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i16diagexs.c @@ -0,0 +1,53 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +int16 i16diagexs(int16 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i16diagina.c b/2.3-1/src/c/matrixOperations/diag/i16diagina.c new file mode 100644 index 00000000..518f627c --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i16diagina.c @@ -0,0 +1,58 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i16diagins.c b/2.3-1/src/c/matrixOperations/diag/i16diagins.c new file mode 100644 index 00000000..f0d46eb9 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i16diagins.c @@ -0,0 +1,37 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void i16diagins(int16 *in, int size,int16 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i16diags.c b/2.3-1/src/c/matrixOperations/diag/i16diags.c new file mode 100644 index 00000000..b08657f5 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i16diags.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +int16 i16diags(int16 in) +{ + + return in; + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i8diaga.c b/2.3-1/src/c/matrixOperations/diag/i8diaga.c new file mode 100644 index 00000000..c41ec9df --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i8diaga.c @@ -0,0 +1,40 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void i8diaga(int8 in, int size,int insert_post,int8 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i8diagexa.c b/2.3-1/src/c/matrixOperations/diag/i8diagexa.c new file mode 100644 index 00000000..56fab854 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i8diagexa.c @@ -0,0 +1,130 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void i8diagexa(int8 *in, int _row,int _column,int extract_post,int8 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i8diagexs.c b/2.3-1/src/c/matrixOperations/diag/i8diagexs.c new file mode 100644 index 00000000..6aa76049 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i8diagexs.c @@ -0,0 +1,53 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +int8 i8diagexs(int8 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i8diagina.c b/2.3-1/src/c/matrixOperations/diag/i8diagina.c new file mode 100644 index 00000000..77a7e074 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i8diagina.c @@ -0,0 +1,58 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i8diagins.c b/2.3-1/src/c/matrixOperations/diag/i8diagins.c new file mode 100644 index 00000000..adb7eb96 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i8diagins.c @@ -0,0 +1,37 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void i8diagins(int8 *in, int size,int8 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/i8diags.c b/2.3-1/src/c/matrixOperations/diag/i8diags.c new file mode 100644 index 00000000..d4e44894 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/i8diags.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +int8 i8diags(int8 in) +{ + + return in; + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u16diaga.c b/2.3-1/src/c/matrixOperations/diag/u16diaga.c new file mode 100644 index 00000000..90a10536 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u16diaga.c @@ -0,0 +1,40 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void u16diaga(uint16 in, int size,int insert_post,uint16 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u16diagexa.c b/2.3-1/src/c/matrixOperations/diag/u16diagexa.c new file mode 100644 index 00000000..da2088c5 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u16diagexa.c @@ -0,0 +1,130 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void u16diagexa(uint16 *in, int _row,int _column,int extract_post,uint16 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u16diagexs.c b/2.3-1/src/c/matrixOperations/diag/u16diagexs.c new file mode 100644 index 00000000..c32849e6 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u16diagexs.c @@ -0,0 +1,53 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +uint16 u16diagexs(uint16 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u16diagina.c b/2.3-1/src/c/matrixOperations/diag/u16diagina.c new file mode 100644 index 00000000..f5dc6f99 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u16diagina.c @@ -0,0 +1,58 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u16diagins.c b/2.3-1/src/c/matrixOperations/diag/u16diagins.c new file mode 100644 index 00000000..84cfcb29 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u16diagins.c @@ -0,0 +1,37 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void u16diagins(uint16 *in, int size,uint16 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u16diags.c b/2.3-1/src/c/matrixOperations/diag/u16diags.c new file mode 100644 index 00000000..0f463b09 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u16diags.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +uint16 u16diags(uint16 in) +{ + + return in; + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u8diaga.c b/2.3-1/src/c/matrixOperations/diag/u8diaga.c new file mode 100644 index 00000000..05a03ba2 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u8diaga.c @@ -0,0 +1,40 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void u8diaga(uint8 in, int size,int insert_post,uint8 *out) +{ + + int i; + + for(i=0;i < ((size+abs(insert_post))*(size+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + + out[abs(insert_post)] = in; + + } + else + { + + out[(size + insert_post)*insert_post] = in; + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u8diagexa.c b/2.3-1/src/c/matrixOperations/diag/u8diagexa.c new file mode 100644 index 00000000..258e10b0 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u8diagexa.c @@ -0,0 +1,130 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void u8diagexa(uint8 *in, int _row,int _column,int extract_post,uint8 *out) +{ + + + int j; + if(_row == _column) + { + if(extract_post <= 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + out[j] = in[((_column+1)*j)-extract_post] ; + + } + } + else + { + for ( j = extract_post ; j < _column ; j++ ) + { + + + out[j-extract_post] = in[((_column+1)*j)-extract_post] ; + + } + } + + } + else if(_row > _column) + { + + if(extract_post >=0) + { + + for(j = extract_post; j < _column;j++) + { + + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + + } + else + { + + if((abs(extract_post) <= (_row - _column))) + { + for(j = 0; j < _column ; j++) + { + out[j] = in[((_row+1)*j)-extract_post]; + + } + } + else + { + + for(j=0; j < (_row + extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + } + + + + } + + } + + } + else if (_row < _column) + { + + if(extract_post > 0) + { + if((extract_post <= (_column - _row))) + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + else + { + for(j=extract_post;j < _column;j++) + { + out[j-extract_post] = in[((_row+1)*j)-extract_post]; + } + + } + + } + else + { + + + for(j=0;j < (_row+extract_post);j++) + { + + out[j] = in[((_row+1)*j)-extract_post]; + + + + } + + + + } + + + } + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u8diagexs.c b/2.3-1/src/c/matrixOperations/diag/u8diagexs.c new file mode 100644 index 00000000..fbb2ef3f --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u8diagexs.c @@ -0,0 +1,53 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +uint8 u8diagexs(uint8 *in, int _row,int _column,int extract_post) +{ + + if(_row == _column) + { + + if(extract_post < 0) + { + + return in[_row-1] ; + } + else + { + + return in[(_row)*(_row-1)] ; + + } + } + + else + { + + if(extract_post < 0) + { + + return in[_row-1]; + + } + else + { + return in[(_row)*(_column-1)]; + + } + + + + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u8diagina.c b/2.3-1/src/c/matrixOperations/diag/u8diagina.c new file mode 100644 index 00000000..bea24655 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u8diagina.c @@ -0,0 +1,58 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +#include<stdlib.h> // Used for Absolute value of insert_post +void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out) +{ + int i, j; + if(_row == 1) + { + _column = _column; + + } + else + { + _column = _row; + + } + + for(i=0;i < ((_column+abs(insert_post))*(_column+abs(insert_post)));i++) + { + out[i] = 0; + + } + + if(insert_post < 0) + { + for ( j = 0 ; j < _column ; j++ ) + { + + + + out[((_column+abs(insert_post))*j)+abs(insert_post)+j] = in[j]; + } + + } + else + { + for ( j = insert_post ; j < _column+insert_post ; j++ ) + { + + + out[((_column+insert_post)*j)-insert_post+j] = in[j-insert_post] ; + + } + } + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u8diagins.c b/2.3-1/src/c/matrixOperations/diag/u8diagins.c new file mode 100644 index 00000000..f2765952 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u8diagins.c @@ -0,0 +1,37 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +void u8diagins(uint8 *in, int size,uint8 *out) +{ + + int i, j; + for ( i = 0 ; i < size ; i++ ) + { + for ( j = 0 ; j < size ; j++ ) + { + if(i==j) + { + out[(size+1)*i] = in[i] ; + /* Because to replace the diagonal element with input matrix, (_coulmn+1)*i gives the diagonal postion for m*n matrix + i.e if 3*3 matrix then diagonal postion will be 0,4,6 and for 4*4 matrix diagonal postion will be 0,5,10,15 */ + + + } + + } + } + + + +} + diff --git a/2.3-1/src/c/matrixOperations/diag/u8diags.c b/2.3-1/src/c/matrixOperations/diag/u8diags.c new file mode 100644 index 00000000..97d2e515 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/diag/u8diags.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include "diag.h" +uint8 u8diags(uint8 in) +{ + + return in; + +} + diff --git a/2.3-1/src/c/matrixOperations/division/i16ldivma.c b/2.3-1/src/c/matrixOperations/division/i16ldivma.c new file mode 100644 index 00000000..e5a134d0 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/i16ldivma.c @@ -0,0 +1,111 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i16ldivma (int16* in1, int lines1, int columns1 , + int16* in2, int lines2, int columns2 , + int16* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int16 dblRcond = 0; + + int16 dblEps = 0; + int16 dblAnorm = 0; + + int16 *pAf = NULL; + int16 *pXb = NULL; + int16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (int16*)malloc(sizeof(int16) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (int16*)malloc(sizeof(int16) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (int16*)malloc(sizeof(int16) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/2.3-1/src/c/matrixOperations/division/i16rdivma.c b/2.3-1/src/c/matrixOperations/division/i16rdivma.c new file mode 100644 index 00000000..21f6cc94 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/i16rdivma.c @@ -0,0 +1,129 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i16rdivma ( int16 * in1, int lines1, int columns1, + int16 * in2, int lines2, int columns2, + int16 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int16 dblRcond = 0; + + int16 dblEps = 0; + int16 dblAnorm = 0; + + int16 *pAf = NULL; + int16 *pAt = NULL; + int16 *pBt = NULL; + int16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (int16*)malloc(sizeof(int16) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (int16*)malloc(sizeof(int16) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (int16*)malloc(sizeof(int16) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (int16*)malloc(sizeof(int16) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/2.3-1/src/c/matrixOperations/division/i16rdivv.c b/2.3-1/src/c/matrixOperations/division/i16rdivv.c new file mode 100644 index 00000000..72d3bd60 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/i16rdivv.c @@ -0,0 +1,24 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2009 - INRIA - Allan SIMON + * + * 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 + * + */ + + +#include "matrixDivision.h" + +int16 i16rdivv(int16 *in1, int16 *in2, int size){ + + int16 out[1] = { 0.0} ; + i16rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/2.3-1/src/c/matrixOperations/division/i8ldivma.c b/2.3-1/src/c/matrixOperations/division/i8ldivma.c new file mode 100644 index 00000000..85271c6b --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/i8ldivma.c @@ -0,0 +1,111 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i8ldivma (int8* in1, int lines1, int columns1 , + int8* in2, int lines2, int columns2 , + int8* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int8 dblRcond = 0; + + int8 dblEps = 0; + int8 dblAnorm = 0; + + int8 *pAf = NULL; + int8 *pXb = NULL; + int8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (int8*)malloc(sizeof(int8) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (int8*)malloc(sizeof(int8) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (int8*)malloc(sizeof(int8) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/2.3-1/src/c/matrixOperations/division/i8rdivma.c b/2.3-1/src/c/matrixOperations/division/i8rdivma.c new file mode 100644 index 00000000..5095d9c6 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/i8rdivma.c @@ -0,0 +1,129 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void i8rdivma ( int8 * in1, int lines1, int columns1, + int8 * in2, int lines2, int columns2, + int8 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + int8 dblRcond = 0; + + int8 dblEps = 0; + int8 dblAnorm = 0; + + int8 *pAf = NULL; + int8 *pAt = NULL; + int8 *pBt = NULL; + int8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (int8*)malloc(sizeof(int8) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (int8*)malloc(sizeof(int8) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (int8*)malloc(sizeof(int8) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (int8*)malloc(sizeof(int8) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/2.3-1/src/c/matrixOperations/division/i8rdivv.c b/2.3-1/src/c/matrixOperations/division/i8rdivv.c new file mode 100644 index 00000000..04c6c49e --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/i8rdivv.c @@ -0,0 +1,24 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2009 - INRIA - Allan SIMON + * + * 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 + * + */ + + +#include "matrixDivision.h" + +int8 i8rdivv(int8 *in1, int8 *in2, int size){ + + int8 out[1] = { 0.0} ; + i8rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/2.3-1/src/c/matrixOperations/division/u16ldivma.c b/2.3-1/src/c/matrixOperations/division/u16ldivma.c new file mode 100644 index 00000000..fde268fe --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/u16ldivma.c @@ -0,0 +1,111 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u16ldivma (uint16* in1, int lines1, int columns1 , + uint16* in2, int lines2, int columns2 , + uint16* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint16 dblRcond = 0; + + uint16 dblEps = 0; + uint16 dblAnorm = 0; + + uint16 *pAf = NULL; + uint16 *pXb = NULL; + uint16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (uint16*)malloc(sizeof(uint16) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (uint16*)malloc(sizeof(uint16) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (uint16*)malloc(sizeof(uint16) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/2.3-1/src/c/matrixOperations/division/u16rdivma.c b/2.3-1/src/c/matrixOperations/division/u16rdivma.c new file mode 100644 index 00000000..a77db453 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/u16rdivma.c @@ -0,0 +1,129 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u16rdivma ( uint16 * in1, int lines1, int columns1, + uint16 * in2, int lines2, int columns2, + uint16 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint16 dblRcond = 0; + + uint16 dblEps = 0; + uint16 dblAnorm = 0; + + uint16 *pAf = NULL; + uint16 *pAt = NULL; + uint16 *pBt = NULL; + uint16 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (uint16*)malloc(sizeof(uint16) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (uint16*)malloc(sizeof(uint16) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (uint16*)malloc(sizeof(uint16) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (uint16*)malloc(sizeof(uint16) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/2.3-1/src/c/matrixOperations/division/u16rdivv.c b/2.3-1/src/c/matrixOperations/division/u16rdivv.c new file mode 100644 index 00000000..9fc292c7 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/u16rdivv.c @@ -0,0 +1,24 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2009 - INRIA - Allan SIMON + * + * 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 + * + */ + + +#include "matrixDivision.h" + +uint16 u16rdivv(uint16 *in1, uint16 *in2, int size){ + + uint16 out[1] = { 0.0} ; + u16rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/2.3-1/src/c/matrixOperations/division/u8ldivma.c b/2.3-1/src/c/matrixOperations/division/u8ldivma.c new file mode 100644 index 00000000..a046fb41 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/u8ldivma.c @@ -0,0 +1,111 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u8ldivma (uint8* in1, int lines1, int columns1 , + uint8* in2, int lines2, int columns2 , + uint8* out ){ + + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint8 dblRcond = 0; + + uint8 dblEps = 0; + uint8 dblAnorm = 0; + + uint8 *pAf = NULL; + uint8 *pXb = NULL; + uint8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); + + + lines2 = 0 ; + + /* Array allocations*/ + pAf = (uint8*)malloc(sizeof(uint8) * (unsigned int) lines1 * (unsigned int) columns1); + pXb = (uint8*)malloc(sizeof(uint8) * (unsigned int) max(lines1,columns1) * (unsigned int) columns2); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); + pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); + + + + cNorm = '1'; + pDwork = (uint8*)malloc(sizeof(uint8) *(unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + + dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); + if(lines1 == columns1) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); + dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines1, columns1); + C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); + memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); + C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + cNorm = 'F'; + C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); + } + } + + free(pAf); + free(pXb); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); +} diff --git a/2.3-1/src/c/matrixOperations/division/u8rdivma.c b/2.3-1/src/c/matrixOperations/division/u8rdivma.c new file mode 100644 index 00000000..478f6ac9 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/u8rdivma.c @@ -0,0 +1,129 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ +#include <stdlib.h> +#include <string.h> +#include "matrixDivision.h" +#include "lapack.h" + +void u8rdivma ( uint8 * in1, int lines1, int columns1, + uint8 * in2, int lines2, int columns2, + uint8 * out){ + + char cNorm = 0; + int iExit = 0; + + /*temporary variables*/ + int iWork = 0; + int iInfo = 0; + int iMax = 0; + uint8 dblRcond = 0; + + uint8 dblEps = 0; + uint8 dblAnorm = 0; + + uint8 *pAf = NULL; + uint8 *pAt = NULL; + uint8 *pBt = NULL; + uint8 *pDwork = NULL; + + int *pRank = NULL; + int *pIpiv = NULL; + int *pJpvt = NULL; + int *pIwork = NULL; + + iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); + + + /* Array allocations*/ + pAf = (uint8*)malloc(sizeof(uint8) * (unsigned int)columns2 * (unsigned int)lines2); + pAt = (uint8*)malloc(sizeof(uint8) * (unsigned int)columns2 *(unsigned int) lines2); + pBt = (uint8*)malloc(sizeof(uint8) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); + + pRank = (int*)malloc(sizeof(int)); + pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); + pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); + pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); + + + cNorm = '1'; + pDwork = (uint8*)malloc(sizeof(uint8) * (unsigned int)iWork); + dblEps = getRelativeMachinePrecision() ; + dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); + + /*tranpose A and B*/ + + dtransposea(in2, lines2, columns2, pAt); + dtransposea(in1, lines1, columns2, pBt); + + if(lines2 == columns2) + { + cNorm = 'F'; + dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); + dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); + if(iInfo == 0) + { + cNorm = '1'; + dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); + if(dblRcond > sqrt(dblEps)) + { + cNorm = 'N'; + dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); + dtransposea(pBt, columns2, lines1, out); + iExit = 1; + } + } + + } + + if(iExit == 0) + { + dblRcond = sqrt(dblEps); + cNorm = 'F'; + iMax = max(lines2, columns2); + memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); + dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, + pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); + + if(iInfo == 0) + { + + + /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ + + /*Mega caca de la mort qui tue des ours a mains nues + mais je ne sais pas comment le rendre "beau" :(*/ + { + int i,j,ij,ji; + for(j = 0 ; j < lines2 ; j++) + { + for(i = 0 ; i < lines1 ; i++) + { + ij = i + j * lines1; + ji = j + i * max(lines2, columns2); + out[ij] = pBt[ji]; + } + } + } + } + } + + free(pAf); + free(pAt); + free(pBt); + free(pRank); + free(pIpiv); + free(pJpvt); + free(pIwork); + free(pDwork); + +} + diff --git a/2.3-1/src/c/matrixOperations/division/u8rdivv.c b/2.3-1/src/c/matrixOperations/division/u8rdivv.c new file mode 100644 index 00000000..53ef809d --- /dev/null +++ b/2.3-1/src/c/matrixOperations/division/u8rdivv.c @@ -0,0 +1,24 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2009 - INRIA - Allan SIMON + * + * 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 + * + */ + + +#include "matrixDivision.h" + +uint8 u8rdivv(uint8 *in1, uint8 *in2, int size){ + + uint8 out[1] = { 0.0} ; + u8rdivma ( in1,1 ,size ,in2 , 1 , size , out ); + + return out[0] ; +} + + diff --git a/2.3-1/src/c/matrixOperations/includes/diag.h b/2.3-1/src/c/matrixOperations/includes/diag.h new file mode 100644 index 00000000..b4ca929d --- /dev/null +++ b/2.3-1/src/c/matrixOperations/includes/diag.h @@ -0,0 +1,96 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * 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 + * + */ + +#ifndef __DIAG_H__ +#define __DIAG_H__ + +#include "dynlib_matrixoperations.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_MATOPS double ddiags(double in ); + +EXTERN_MATOPS void ddiaga(double in, int size,int insert_post,double *out); + +EXTERN_MATOPS void ddiagina(double *in, int _row,int _column,int insert_post,double *out); + +EXTERN_MATOPS void ddiagins(double* in, int size, double* out ); + +EXTERN_MATOPS void ddiagexa(double* in,int row,int column,int insert_pos,double* out); + +EXTERN_MATOPS double ddiagexs(double* in,int row,int column,int extract_pos); + +EXTERN_MATOPS uint8 u8diags(uint8 in ); + +EXTERN_MATOPS void u8diaga(uint8 in, int size,int insert_post,uint8 *out); + +EXTERN_MATOPS void u8diagina(uint8 *in, int _row,int _column,int insert_post,uint8 *out); + +EXTERN_MATOPS void u8diagins(uint8* in, int size, uint8* out ); + +EXTERN_MATOPS void u8diagexa(uint8* in,int row,int column,int insert_pos,uint8* out); + +EXTERN_MATOPS uint8 u8diagexs(uint8* in,int row,int column,int extract_pos); + +EXTERN_MATOPS uint16 u16diags(uint16 in ); + +EXTERN_MATOPS void u16diaga(uint16 in, int size,int insert_post,uint16 *out); + +EXTERN_MATOPS void u16diagina(uint16 *in, int _row,int _column,int insert_post,uint16 *out); + +EXTERN_MATOPS void u16diagins(uint16* in, int size, uint16* out ); + +EXTERN_MATOPS void u16diagexa(uint16* in,int row,int column,int insert_pos,uint16* out); + +EXTERN_MATOPS uint16 u16diagexs(uint16* in,int row,int column,int extract_pos); + +EXTERN_MATOPS int8 i8diags(int8 in ); + +EXTERN_MATOPS void i8diaga(int8 in, int size,int insert_post,int8 *out); + +EXTERN_MATOPS void i8diagina(int8 *in, int _row,int _column,int insert_post,int8 *out); + +EXTERN_MATOPS void i8diagins(int8* in, int size, int8* out ); + +EXTERN_MATOPS void i8diagexa(int8* in,int row,int column,int insert_pos,int8* out); + +EXTERN_MATOPS int8 i8diagexs(int8* in,int row,int column,int extract_pos); + +EXTERN_MATOPS int16 i16diags(int8 in ); + +EXTERN_MATOPS void i16diaga(int16 in, int size,int insert_post,int16 *out); + +EXTERN_MATOPS void i16diagina(int16 *in, int _row,int _column,int insert_post,int16 *out); + +EXTERN_MATOPS void i16diagins(int16* in, int size, int16* out ); + +EXTERN_MATOPS void i16diagexa(int16* in,int row,int column,int insert_pos,int16* out); + +EXTERN_MATOPS int16 i16diagexs(int16* in,int row,int column,int extract_pos); + + + + + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__DIAG_H__ */ + diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_diag.h b/2.3-1/src/c/matrixOperations/interfaces/int_diag.h new file mode 100644 index 00000000..4d6553c5 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/interfaces/int_diag.h @@ -0,0 +1,87 @@ +/* + * 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_DIAG_H__ +#define __INT_DIAG_H__ + + + +#define d0diagd0(in1) ddiags(in1) + +#define d0d0diagd0(in1,in2) ddiags(in1) + +#define d0d0diagd2(in1,in2,out) ddiaga(in1,1,in2,out) + +#define d2diagd2(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? ddiagins(in1,size[1],out) : ddiagins(in1,size[0],out); } else {ddiagexa(in1,size[0],size[1],0,out) ;} + +#define d2d0diagd2(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { ddiagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {ddiagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? ddiagins(in1,size[1],out) : ddiagins(in1,size[0],out); };} + +#define d2d0diagd0(in1,size,in2) ddiagexs(in1,size[0],size[1],in2) + + + +#define u80diagu80(in1) u8diags(in1) + +#define u80d0diagu80(in1,in2) u8diags(in1) + +#define u80d0diagu82(in1,in2,out) u8diaga(in1,1,in2,out) + +#define u82diagu82(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? u8diagins(in1,size[1],out) : u8diagins(in1,size[0],out); } else {u8diagexa(in1,size[0],size[1],0,out) ;} + +#define u82d0diagu82(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { u8diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {u8diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? u8diagins(in1,size[1],out) : u8diagins(in1,size[0],out); };} + +#define u82d0diagu80(in1,size,in2) u8diagexs(in1,size[0],size[1],in2) + +#define u160diagu160(in1) u16diags(in1) + +#define u160d0diagu160(in1,in2) u16diags(in1) + +#define u160d0diagu162(in1,in2,out) u16diaga(in1,1,in2,out) + +#define u162diagu162(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? u16diagins(in1,size[1],out) : u16diagins(in1,size[0],out); } else {u16diagexa(in1,size[0],size[1],0,out) ;} + +#define u162d0diagu162(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { u16diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {u16diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? u16diagins(in1,size[1],out) : u16diagins(in1,size[0],out); };} + +#define u162d0diagu160(in1,size,in2) u16diagexs(in1,size[0],size[1],in2) + + + +#define i80diagi80(in1) i8diags(in1) + +#define i80d0diagi80(in1,in2) i8diags(in1) + +#define i80d0diagi82(in1,in2,out) i8diaga(in1,1,in2,out) + +#define i82diagi82(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? i8diagins(in1,size[1],out) : i8diagins(in1,size[0],out); } else {i8diagexa(in1,size[0],size[1],0,out) ;} + +#define i82d0diagi82(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { i8diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {i8diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? i8diagins(in1,size[1],out) : i8diagins(in1,size[0],out); };} + +#define i82d0diagi80(in1,size,in2) i8diagexs(in1,size[0],size[1],in2) + +#define i160diagi160(in1) i16diags(in1) + +#define i160d0diagi160(in1,in2) i16diags(in1) + +#define i160d0diagi162(in1,in2,out) i16diaga(in1,1,in2,out) + + +#define i162diagi162(in1,size,out) if(size[0] != size[1]) { (size[0]==1) ? i16diagins(in1,size[1],out) : i16diagins(in1,size[0],out); } else {i16diagexa(in1,size[0],size[1],0,out) ;} + +#define i162d0diagi162(in1,size,in2,out) if((size[0] != 1) && (size[1] != 1) ) { i16diagexa(in1,size[0],size[1],in2,out); } else { if(in2 != 0) {i16diagina(in1,size[0],size[1],in2,out);} else { (size[0] == 1) ? i16diagins(in1,size[1],out) : i16diagins(in1,size[0],out); };} + +#define i162d0diagi160(in1,size,in2) i16diagexs(in1,size[0],size[1],in2) + + + +#endif /* !__INT_DIAG_H__ */ diff --git a/2.3-1/src/c/operations/interfaces/int_OpLogOr.h b/2.3-1/src/c/operations/interfaces/int_OpLogOr.h index 5618ff63..c7acb51d 100644 --- a/2.3-1/src/c/operations/interfaces/int_OpLogOr.h +++ b/2.3-1/src/c/operations/interfaces/int_OpLogOr.h @@ -95,28 +95,28 @@ /*scalar or matrix */ #define s0s2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.2f || in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.0 || in2[i] != 0.0);} #define d0d2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.2 || in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.0 || in2[i] != 0.0);} #define c0c2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.2f || cimags(in1) != 0.2f) || (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.0 || cimags(in1) != 0.0) || (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define s0c2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.2f && (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1 != 0.0 && (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define c0s2OpLogOrs2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.2f || cimags(in1) != 0.2f) && in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1) != 0.0 || cimags(in1) != 0.0) && in2[i] != 0.0);} #define z0z2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.2 || zimags(in1) != 0.2) && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define d0z2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.2 && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1 != 0.0 && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define z0d2OpLogOrd2(in1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.2 || zimags(in1) != 0.2) && in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1) != 0.0 || zimags(in1) != 0.0) && in2[i] != 0.0);} #define u80u82OpLogOru82(in1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1 != 0 || in2[i] != 0);} @@ -133,28 +133,28 @@ /*matrix or matrix */ #define s2s2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.2f || in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.0 || in2[i] != 0.0);} #define d2d2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.2 || in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.0 || in2[i] != 0.0);} #define c2c2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.2f || cimags(in1[i]) != 0.2f) || (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.0 || cimags(in1[i]) != 0.0) || (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define s2c2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.2f && (creals(in2[i]) != 0.2f || cimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float(in1[i] != 0.0 && (creals(in2[i]) != 0.0 || cimags(in2[i])));} #define c2s2OpLogOrs2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.2f || cimags(in1[i]) != 0.2f) && in2[i] != 0.2f);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Float((creals(in1[i]) != 0.0 || cimags(in1[i]) != 0.0) && in2[i] != 0.0);} #define z2z2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.2 || zimags(in1[i]) != 0.2) && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define d2z2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.2 && (zreals(in2[i]) != 0.2 || zimags(in2[i])));} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double(in1[i] != 0.0 && (zreals(in2[i]) != 0.0 || zimags(in2[i])));} #define z2d2OpLogOrd2(in1, size1, in2, size2, out) {int i = 0 ;\ - for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.2 || zimags(in1[i]) != 0.2) && in2[i] != 0.2);} + for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Double((zreals(in1[i]) != 0.0 || zimags(in1[i]) != 0.0) && in2[i] != 0.0);} #define u82u82OpLogOru82(in1, size1, in2, size2, out) {int i = 0 ;\ for (i = 0 ; i < size2[0]*size2[1] ; i++ ) out[i] = Bool2Uint8(in1[i] != 0 || in2[i] != 0);} diff --git a/2.3-1/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c b/2.3-1/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c index ebfad618..29e6c0f7 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c +++ b/2.3-1/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c @@ -11,6 +11,7 @@ */ #include "cmd_analog_in.h" +#include "Arduino.h" uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin) { diff --git a/2.3-1/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c b/2.3-1/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c index 94d51f6f..aa7dac06 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c +++ b/2.3-1/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c @@ -11,6 +11,7 @@ */ #include "cmd_analog_out.h" +#include "Arduino.h" uint8 u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value) { diff --git a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c index 93905c94..07798aba 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c +++ b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c @@ -11,6 +11,7 @@ */ #include "cmd_dcmotor_run.h" +#include "Arduino.h" uint8 u8cmd_dcmotor_runs(uint8 board_no, uint8 motor_no, int16 duty) { diff --git a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c index 30b4b9b3..d1d0fea8 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c +++ b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c @@ -11,6 +11,7 @@ */ #include "cmd_dcmotor_setup.h" +#include "Arduino.h" uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; @@ -18,7 +19,7 @@ uint8 u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ uint8 pin_1, uint8 pin_2) { dcm_pin_1[motor_no] = pin_1; - dcm_pin_2[motor_no] = pin_2; + dcm_pin_2[motor_no] = pin_2; dcm_mode[motor_no] = driver_type; //Initialise pins diff --git a/2.3-1/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c b/2.3-1/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c index 1d0036a4..129db1a9 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c +++ b/2.3-1/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c @@ -11,6 +11,7 @@ */ #include "cmd_digital_in.h" +#include "Arduino.h" uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin) { diff --git a/2.3-1/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp b/2.3-1/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp new file mode 100644 index 00000000..a89363ba --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp @@ -0,0 +1,26 @@ +/* + Scilab2C FOSSEE IIT BOMBAY + */ + +#include "cmd_servo_attach.h" +#include "Arduino.h" +#include<Servo.h> +Servo servo1,servo2; +uint8 u8cmd_servo_attach(uint8 h,uint8 servo_no) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + if(servo_no == 1) + { + servo1.attach(9); + servo1.write(0); + } + else + { + servo2.attach(10); + servo2.write(0); + } + + return 0; +} + diff --git a/2.3-1/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp b/2.3-1/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp new file mode 100644 index 00000000..95faf4cd --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp @@ -0,0 +1,24 @@ +/* + Scilab2C FOSSEE IIT BOMBAY + */ +#include "cmd_servo_detach.h" +#include "Arduino.h" +#include<Servo.h> +Servo servo1,servo2; +uint8 u8cmd_servo_detach(uint8 h,uint8 servo_no) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + if(servo_no == 1) + { + servo1.detach(); + } + + else + { + servo2.detach(); + } + + return 0; +} + diff --git a/2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp b/2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp new file mode 100644 index 00000000..e8874766 --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp @@ -0,0 +1,27 @@ +/* + Scilab2C FOSSEE IIT BOMBAY + */ + +#include "cmd_servo_move.h" +#include "Arduino.h" +#include<Servo.h> +Servo servo1,servo2; +uint8 u8cmd_servo_move(uint8 h,uint8 servo_no,uint8 val) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + //val -> 0 to 180 angle of rotation + if (val>=0 && val<=180) + { + if (servo_no==1) + { + servo1.write(val); + } + else if (servo_no==2) + { + servo2.write(val); + } + } + return 0; +} + diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_analog_in.h b/2.3-1/src/c/scilab-arduino/includes/cmd_analog_in.h index 4478fb09..5361fe80 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_analog_in.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_analog_in.h @@ -15,7 +15,6 @@ #define __CMD_ANALOG_IN_H__ #include "types.h" -#include "Arduino.h" #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_analog_out.h b/2.3-1/src/c/scilab-arduino/includes/cmd_analog_out.h index e75c5a66..a0da68e1 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_analog_out.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_analog_out.h @@ -15,8 +15,6 @@ #define __CMD_ANALOG_OUT_H__ #include "types.h" -#include "Arduino.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_run.h b/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_run.h index 7631761b..82df60ad 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_run.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_run.h @@ -15,7 +15,6 @@ #define __CMD_DCMOTOR_RUN_H__ #include "types.h" -#include "Arduino.h" #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h b/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h index 94f5a161..66fa04e9 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h @@ -15,7 +15,6 @@ #define __CMD_DCMOTOR_SETUP_H__ #include "types.h" -#include "Arduino.h" #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_digital_in.h b/2.3-1/src/c/scilab-arduino/includes/cmd_digital_in.h index 9e809aa4..96fd24bb 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_digital_in.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_digital_in.h @@ -15,7 +15,6 @@ #define __CMD_DIGITAL_IN_H__ #include "types.h" -#include "Arduino.h" #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_digital_out.h b/2.3-1/src/c/scilab-arduino/includes/cmd_digital_out.h index 49739b0c..ee459d18 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_digital_out.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_digital_out.h @@ -15,7 +15,6 @@ #define __CMD_DIGITAL_OUT_H__ #include "types.h" -#include "Arduino.h" #ifdef __cplusplus extern "C" { diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_servo_attach.h b/2.3-1/src/c/scilab-arduino/includes/cmd_servo_attach.h new file mode 100644 index 00000000..5dd3ed6b --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_servo_attach.h @@ -0,0 +1,23 @@ +/* + Scilab2C FOSSEE IIT Bombay + */ + + +#ifndef __CMD_SERVO_ATTACH_H__ +#define __CMD_SERVO_ATTACH_H__ + +#include "types.h" +//#include <Servo.h> +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +uint8 u8cmd_servo_attach(uint8 h, uint8 servo_no ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_servo_detach.h b/2.3-1/src/c/scilab-arduino/includes/cmd_servo_detach.h new file mode 100644 index 00000000..ce74d62d --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_servo_detach.h @@ -0,0 +1,24 @@ +/* + Scilab2C FOSSEE IIT Bombay + */ + + +#ifndef __CMD_SERVO_DETACH_H__ +#define __CMD_SERVO_DETACH_H__ + +#include "types.h" +//#include<Servo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +uint8 u8cmd_servo_detach(uint8 h, uint8 servo_no ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_servo_move.h b/2.3-1/src/c/scilab-arduino/includes/cmd_servo_move.h new file mode 100644 index 00000000..9013d3cc --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_servo_move.h @@ -0,0 +1,24 @@ +/* + Scilab2C FOSSEE IIT Bombay + */ + + +#ifndef __CMD_SERVO_MOVE_H__ +#define __CMD_SERVO_MOVE_H__ + +#include "types.h" +//#include<Servo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +uint8 u8cmd_servo_move(uint8 h, uint8 servo_no,uint8 val); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/2.3-1/src/c/scilab-arduino/includes/sleep.h b/2.3-1/src/c/scilab-arduino/includes/sleep.h index cde27164..4c8cbc29 100644 --- a/2.3-1/src/c/scilab-arduino/includes/sleep.h +++ b/2.3-1/src/c/scilab-arduino/includes/sleep.h @@ -15,8 +15,6 @@ #define __SLEEP_H__ #include "types.h" -#include "Arduino.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h index 09f5c6ea..ead26acd 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h @@ -23,6 +23,9 @@ extern "C" { #define d0d0d0cmd_analog_outu80(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ (uint8)in2,(uint8)in3) +#define d0d0u80cmd_analog_outu80(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_servo.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_servo.h new file mode 100644 index 00000000..d99a0444 --- /dev/null +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_servo.h @@ -0,0 +1,27 @@ +/* + Scilab2C FOSSEE IIT BOMBAY + */ + + +#ifndef __INT_CMD_SERVO_H__ +#define __INT_CMD_SERVO_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d0d0cmd_servo_attachu80(in1,in2) u8cmd_servo_attach((uint8)in1,(uint8)in2); + +#define d0d0cmd_servo_detachu80(in1,in2) u8cmd_servo_detach((uint8)in1,(uint8)in2); + +#define d0d0d0cmd_servo_moveu80(in1,in2,in3) u8cmd_servo_move((uint8)in1,(uint8)in2,(uint8)in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DCMOTOR_H__ */ diff --git a/2.3-1/src/c/string/interfaces/int_string.h b/2.3-1/src/c/string/interfaces/int_string.h index e90f1f98..7cea7799 100644 --- a/2.3-1/src/c/string/interfaces/int_string.h +++ b/2.3-1/src/c/string/interfaces/int_string.h @@ -17,36 +17,36 @@ #include <stdio.h> -#define s0string(in,out) sstrings(in,out) +#define s0stringg0(in,out) sstrings(in,out) -#define d0string(in,out) dstrings(in,out) +#define d0stringg0(in,out) dstrings(in,out) -#define c0string(in,out) cstrings(in,out) +#define c0stringg0(in,out) cstrings(in,out) -#define z0string(in,out) zstrings(in,out) +#define z0stringg0(in,out) zstrings(in,out) -#define u80string(in,out) u8strings(in,out) +#define u80stringg0(in,out) u8strings(in,out) -#define i80string(in,out) i8strings(in,out) +#define i80stringg0(in,out) i8strings(in,out) -#define u160string(in,out) u16strings(in,out) +#define u160stringg0(in,out) u16strings(in,out) -#define i160string(in,out) i16strings(in,out) +#define i160stringg0(in,out) i16strings(in,out) -#define s2string(in,size,out) sstringa(in,size[0]*size[1],out) +#define s2stringg2(in,size,out) sstringa(in,size[0]*size[1],out) -#define d2string(in,size,out) dstringa(in,size[0]*size[1],out) +#define d2stringg2(in,size,out) dstringa(in,size[0]*size[1],out) -#define c2string(in,size,out) cstringa(in,size[0]*size[1],out) +#define c2stringg2(in,size,out) cstringa(in,size[0]*size[1],out) -#define z2string(in,size,out) zstringa(in,size[0]*size[1],out) +#define z2stringg2(in,size,out) zstringa(in,size[0]*size[1],out) -#define u82string(in,size,out) u8stringa(in,size[0]*size[1],out) +#define u82stringg2(in,size,out) u8stringa(in,size[0]*size[1],out) -#define i82string(in,size,out) i8stringa(in,size[0]*size[1],out) +#define i82stringg2(in,size,out) i8stringa(in,size[0]*size[1],out) -#define u162string(in,size,out) u16stringa(in,size[0]*size[1],out) +#define u162stringg2(in,size,out) u16stringa(in,size[0]*size[1],out) -#define i162string(in,size,out) i16stringa(in,size[0]*size[1],out) +#define i162stringg2(in,size,out) i16stringa(in,size[0]*size[1],out) #endif /* __INT_STRING_H__ */ |