diff options
Diffstat (limited to 'src/c/matrixOperations')
20 files changed, 551 insertions, 1 deletions
diff --git a/src/c/matrixOperations/includes/matrixTrace.h b/src/c/matrixOperations/includes/matrixTrace.h index 76b7745..80f895d 100644 --- a/src/c/matrixOperations/includes/matrixTrace.h +++ b/src/c/matrixOperations/includes/matrixTrace.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -63,6 +64,44 @@ EXTERN_MATOPS floatComplex ctracea ( floatComplex* in ,int lines ) ; */ EXTERN_MATOPS doubleComplex ztracea ( doubleComplex* in ,int lines ) ; + +/* +** \brief Compute the trace of a uint8 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : uint8 containing the trace. +*/ +EXTERN_MATOPS uint8 u8tracea ( uint8* in ,int lines ) ; + + +/* +** \brief Compute the trace of a uint16 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : uint16 containing the trace. +*/ +EXTERN_MATOPS uint16 u16tracea ( uint16* in ,int lines ) ; + + +/* +** \brief Compute the trace of a int8 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : int8 containing the trace. +*/ +EXTERN_MATOPS int8 i8tracea ( int8* in ,int lines ) ; + + +/* +** \brief Compute the trace of a int16 matrix. +** \param in : input array. +** \param lines : number of lines +** \param out : int16 containing the trace. +*/ +EXTERN_MATOPS int16 i16tracea ( int16* in ,int lines ) ; + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/includes/matrixTranspose.h b/src/c/matrixOperations/includes/matrixTranspose.h index 122b618..7e2acbf 100644 --- a/src/c/matrixOperations/includes/matrixTranspose.h +++ b/src/c/matrixOperations/includes/matrixTranspose.h @@ -16,6 +16,7 @@ #include "dynlib_matrixoperations.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #include <math.h> #ifdef __cplusplus @@ -54,6 +55,45 @@ EXTERN_MATOPS void ctransposea ( floatComplex* in , int lines1 , int column1, fl */ EXTERN_MATOPS void ztransposea ( doubleComplex* in , int lines1 , int column1, doubleComplex* out ); + +/* +** \brief Compute the transpose of a uint8 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed uint8 matrix. +*/ +EXTERN_MATOPS void u8transposea ( uint8* in , int lines1 , int column1, uint8* out ); + +/* +** \brief Compute the transpose of a uint16 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed uint16 matrix. +*/ +EXTERN_MATOPS void u16transposea ( uint16* in , int lines1 , int column1, uint16* out ); + +/* +** \brief Compute the transpose of a int8 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed int8 matrix. +*/ +EXTERN_MATOPS void i8transposea ( int8* in , int lines1 , int column1, int8* out ); + +/* +** \brief Compute the transpose of a int16 matrix. +** \param in : input matrix. +** \param lines1 : number of lines +** \param column1 : number of column1 +** \param out : the transposed int16 matrix. +*/ +EXTERN_MATOPS void i16transposea ( int16* in , int lines1 , int column1, int16* out ); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/matrixOperations/interfaces/int_trace.h b/src/c/matrixOperations/interfaces/int_trace.h index 8bfea86..58c4299 100644 --- a/src/c/matrixOperations/interfaces/int_trace.h +++ b/src/c/matrixOperations/interfaces/int_trace.h @@ -21,7 +21,13 @@ #define c0tracec0(in) in -#define z0tracez0(in) in +#define u80traceu80(in) (uint8)in + +#define u160traceu160(in) (uint16)in + +#define i80tracei80(in) (int8)in + +#define i160tracei160(in) (int16)in #define s2traces0(in,size) stracea(in, size[0]) @@ -31,4 +37,12 @@ #define z2tracez0(in,size) ztracea(in, size[0]) +#define u82traceu80(in,size) u8tracea(in, size[0]) + +#define u162traceu160(in,size) u16tracea(in, size[0]) + +#define i82tracei80(in,size) i8tracea(in, size[0]) + +#define i162tracei160(in,size) i16trace(in,size[0]) + #endif /* !__INT_TRACE_H__ */ diff --git a/src/c/matrixOperations/interfaces/int_transpose.h b/src/c/matrixOperations/interfaces/int_transpose.h index 250d565..3fd328f 100644 --- a/src/c/matrixOperations/interfaces/int_transpose.h +++ b/src/c/matrixOperations/interfaces/int_transpose.h @@ -23,6 +23,14 @@ #define z0transposez0(in) in +#define u80transposeu80(in) (uint8)in + +#define u160transposeu160(in) (uint16)in + +#define i80transposei80(in) (int8)in + +#define i160transposei160(in) (int16)in + #define s2transposes2(in,size,out) stransposea(in, size[0], size[1], out) #define d2transposed2(in,size,out) dtransposea(in, size[0], size[1], out) @@ -31,4 +39,13 @@ #define z2transposez2(in,size,out) ztransposea(in, size[0], size[1], out) + +#define u82transposeu82(in,size,out) u8transposea(in, size[0], size[1], out) + +#define u162transposeu162(in,size,out) u16transposea(in, size[0], size[1], out) + +#define i82transposei82(in,size,out) i8transposea(in, size[0], size[1], out) + +#define i162transposei162(in,size,out) i16transposea(in, size[0], size[1], out) + #endif /* !__INT_TRANSPOSE_H__ */ diff --git a/src/c/matrixOperations/trace/i16tracea.c b/src/c/matrixOperations/trace/i16tracea.c new file mode 100644 index 0000000..6a3d6a8 --- /dev/null +++ b/src/c/matrixOperations/trace/i16tracea.c @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +int16 i16tracea ( int16* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + int16 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (int16)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/i16tracea.c~ b/src/c/matrixOperations/trace/i16tracea.c~ new file mode 100644 index 0000000..6a3d6a8 --- /dev/null +++ b/src/c/matrixOperations/trace/i16tracea.c~ @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +int16 i16tracea ( int16* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + int16 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (int16)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/i8tracea.c b/src/c/matrixOperations/trace/i8tracea.c new file mode 100644 index 0000000..88a1c46 --- /dev/null +++ b/src/c/matrixOperations/trace/i8tracea.c @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +int8 i8tracea ( int8* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + int8 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (int8)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/i8tracea.c~ b/src/c/matrixOperations/trace/i8tracea.c~ new file mode 100644 index 0000000..88a1c46 --- /dev/null +++ b/src/c/matrixOperations/trace/i8tracea.c~ @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +int8 i8tracea ( int8* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + int8 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (int8)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/u16tracea.c b/src/c/matrixOperations/trace/u16tracea.c new file mode 100644 index 0000000..3cf9943 --- /dev/null +++ b/src/c/matrixOperations/trace/u16tracea.c @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +uint16 u16tracea ( uint16* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + uint16 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (uint16)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/u16tracea.c~ b/src/c/matrixOperations/trace/u16tracea.c~ new file mode 100644 index 0000000..3cf9943 --- /dev/null +++ b/src/c/matrixOperations/trace/u16tracea.c~ @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +uint16 u16tracea ( uint16* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + uint16 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (uint16)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/u8tracea.c b/src/c/matrixOperations/trace/u8tracea.c new file mode 100644 index 0000000..97e73e2 --- /dev/null +++ b/src/c/matrixOperations/trace/u8tracea.c @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +uint8 u8tracea ( uint8* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + uint8 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (uint8)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/trace/u8tracea.c~ b/src/c/matrixOperations/trace/u8tracea.c~ new file mode 100644 index 0000000..97e73e2 --- /dev/null +++ b/src/c/matrixOperations/trace/u8tracea.c~ @@ -0,0 +1,28 @@ +/* + * 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 "matrixTrace.h" + +uint8 u8tracea ( uint8* in ,int lines){ + + + int i = 0 ; + //double out = 0 ; + uint8 out = 0; + + for ( i = 0 ; i < lines ; ++i) + out += (uint8)in[i*lines + i] ; + + return out; +} + + diff --git a/src/c/matrixOperations/transpose/i16transposea.c b/src/c/matrixOperations/transpose/i16transposea.c new file mode 100644 index 0000000..366de06 --- /dev/null +++ b/src/c/matrixOperations/transpose/i16transposea.c @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void i16transposea ( int16* in , int lines , int columns, int16* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (int16)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/i16transposea.c~ b/src/c/matrixOperations/transpose/i16transposea.c~ new file mode 100644 index 0000000..366de06 --- /dev/null +++ b/src/c/matrixOperations/transpose/i16transposea.c~ @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void i16transposea ( int16* in , int lines , int columns, int16* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (int16)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/i8transposea.c b/src/c/matrixOperations/transpose/i8transposea.c new file mode 100644 index 0000000..20d451a --- /dev/null +++ b/src/c/matrixOperations/transpose/i8transposea.c @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void i8transposea ( int8* in , int lines , int columns, int8* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (int8)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/i8transposea.c~ b/src/c/matrixOperations/transpose/i8transposea.c~ new file mode 100644 index 0000000..20d451a --- /dev/null +++ b/src/c/matrixOperations/transpose/i8transposea.c~ @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void i8transposea ( int8* in , int lines , int columns, int8* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (int8)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/u16transposea.c b/src/c/matrixOperations/transpose/u16transposea.c new file mode 100644 index 0000000..33b35ec --- /dev/null +++ b/src/c/matrixOperations/transpose/u16transposea.c @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void u16transposea ( uint16* in , int lines , int columns, uint16* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (uint16)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/u16transposea.c~ b/src/c/matrixOperations/transpose/u16transposea.c~ new file mode 100644 index 0000000..33b35ec --- /dev/null +++ b/src/c/matrixOperations/transpose/u16transposea.c~ @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void u16transposea ( uint16* in , int lines , int columns, uint16* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (uint16)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/u8transposea.c b/src/c/matrixOperations/transpose/u8transposea.c new file mode 100644 index 0000000..2d0dd74 --- /dev/null +++ b/src/c/matrixOperations/transpose/u8transposea.c @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void u8transposea ( uint8* in , int lines , int columns, uint8* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (uint8)in[i+j*lines]; + } + +} diff --git a/src/c/matrixOperations/transpose/u8transposea.c~ b/src/c/matrixOperations/transpose/u8transposea.c~ new file mode 100644 index 0000000..2d0dd74 --- /dev/null +++ b/src/c/matrixOperations/transpose/u8transposea.c~ @@ -0,0 +1,27 @@ +/* + * 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 "matrixTranspose.h" + +void u8transposea ( uint8* in , int lines , int columns, uint8* out ){ + + int i = 0 ; + int j = 0 ; + + for(i = 0 ; i < lines ; i++) + { + for(j = 0 ; j < columns ; j++) + + out[j+i*columns] = (uint8)in[i+j*lines]; + } + +} |