summaryrefslogtreecommitdiff
path: root/2.3-1/src
diff options
context:
space:
mode:
authorimushir2015-12-29 12:21:00 +0530
committerimushir2015-12-29 12:21:00 +0530
commit03a27e6884942182e984433fd2ebba7e5f55a4d9 (patch)
treeb4148cc669bb596ab1c9e5f30740a2adcf9efb79 /2.3-1/src
parent9cca024b567957a3c0829b527b5c7815d46ea787 (diff)
downloadScilab2C-03a27e6884942182e984433fd2ebba7e5f55a4d9.tar.gz
Scilab2C-03a27e6884942182e984433fd2ebba7e5f55a4d9.tar.bz2
Scilab2C-03a27e6884942182e984433fd2ebba7e5f55a4d9.zip
added support for magnitude
Diffstat (limited to '2.3-1/src')
-rw-r--r--2.3-1/src/c/matrixOperations/includes/matrixMagnitude.h13
-rw-r--r--2.3-1/src/c/matrixOperations/interfaces/int_vmagn.h16
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/i16magna.c33
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/i16magns.c13
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/i8magna.c33
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/i8magns.c13
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/u16magna.c33
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/u16magns.c13
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/u8magna.c33
-rw-r--r--2.3-1/src/c/matrixOperations/magnitude/u8magns.c13
10 files changed, 213 insertions, 0 deletions
diff --git a/2.3-1/src/c/matrixOperations/includes/matrixMagnitude.h b/2.3-1/src/c/matrixOperations/includes/matrixMagnitude.h
index 7b65c6d9..a9f4e71c 100644
--- a/2.3-1/src/c/matrixOperations/includes/matrixMagnitude.h
+++ b/2.3-1/src/c/matrixOperations/includes/matrixMagnitude.h
@@ -17,6 +17,7 @@
#include "dynlib_matrixoperations.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -34,6 +35,18 @@ EXTERN_MATOPS float cmagna(floatComplex* in, int rows, int cols);
EXTERN_MATOPS double zmagns(doubleComplex in);
EXTERN_MATOPS double zmagna(doubleComplex* in, int rows, int cols);
+EXTERN_MATOPS uint8 u8magns(uint8 in);
+EXTERN_MATOPS uint8 u8magna(uint8* in, int rows, int cols);
+
+EXTERN_MATOPS uint16 u16magns(uint16 in);
+EXTERN_MATOPS uint16 u16magna(uint16* in, int rows, int cols);
+
+EXTERN_MATOPS int8 i8magns(int8 in);
+EXTERN_MATOPS int8 i8magna(int8* in, int rows, int cols);
+
+EXTERN_MATOPS int16 i16magns(int16 in);
+EXTERN_MATOPS int16 i16magna(int16* in, int rows, int cols);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_vmagn.h b/2.3-1/src/c/matrixOperations/interfaces/int_vmagn.h
index 8a51755e..a8647aa2 100644
--- a/2.3-1/src/c/matrixOperations/interfaces/int_vmagn.h
+++ b/2.3-1/src/c/matrixOperations/interfaces/int_vmagn.h
@@ -24,6 +24,14 @@
#define z0vmagnz0(in) zmagns(in)
+#define u80vmagnu80(in) u8magns(in)
+
+#define u160vmagnu160(in) u16magns(in)
+
+#define i80vmagni80(in) i8magns(in)
+
+#define i160vmagni160(in) i16magns(in)
+
#define s2vmagns2(in,size) smagna(in, size[0], size[1])
#define d2vmagnd2(in,size) dmagna(in, size[0], size[1])
@@ -32,4 +40,12 @@
#define z2vmagnz2(in,size) zmagna(in, size[0], size[1])
+#define u82vmagnu82(in,size) u8magna(in, size[0], size[1])
+
+#define u162vmagnu162(in,size) u16magna(in, size[0], size[1])
+
+#define i82vmagni82(in,size) i8magna(in, size[0], size[1])
+
+#define i162vmagni162(in,size) i16magna(in, size[0], size[1])
+
#endif /* !__INT_VMAGN_H__ */
diff --git a/2.3-1/src/c/matrixOperations/magnitude/i16magna.c b/2.3-1/src/c/matrixOperations/magnitude/i16magna.c
new file mode 100644
index 00000000..884a278e
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/i16magna.c
@@ -0,0 +1,33 @@
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+
+int16 i16magna(int16* in, int rows, int cols){
+ int i=0,j=0;
+ int16 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/i16magns.c b/2.3-1/src/c/matrixOperations/magnitude/i16magns.c
new file mode 100644
index 00000000..d5deb28a
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/i16magns.c
@@ -0,0 +1,13 @@
+
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+int16 i16magns(int16 in){
+ return i16abss(in);
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/i8magna.c b/2.3-1/src/c/matrixOperations/magnitude/i8magna.c
new file mode 100644
index 00000000..1a8519a8
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/i8magna.c
@@ -0,0 +1,33 @@
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+
+int8 i8magna(int8* in, int rows, int cols){
+ int i=0,j=0;
+ int8 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/i8magns.c b/2.3-1/src/c/matrixOperations/magnitude/i8magns.c
new file mode 100644
index 00000000..1703505d
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/i8magns.c
@@ -0,0 +1,13 @@
+
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+int8 i8magns(int8 in){
+ return i8abss(in);
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/u16magna.c b/2.3-1/src/c/matrixOperations/magnitude/u16magna.c
new file mode 100644
index 00000000..10680c77
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/u16magna.c
@@ -0,0 +1,33 @@
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+
+uint16 u16magna(uint16* in, int rows, int cols){
+ int i=0,j=0;
+ uint16 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/u16magns.c b/2.3-1/src/c/matrixOperations/magnitude/u16magns.c
new file mode 100644
index 00000000..78853edc
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/u16magns.c
@@ -0,0 +1,13 @@
+
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+uint16 u16magns(uint16 in){
+ return u16abss(in);
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/u8magna.c b/2.3-1/src/c/matrixOperations/magnitude/u8magna.c
new file mode 100644
index 00000000..7f5df582
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/u8magna.c
@@ -0,0 +1,33 @@
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+
+uint8 u8magna(uint8* in, int rows, int cols){
+ int i=0,j=0;
+ uint8 out=0, colSum=0;
+
+ /* Other method :
+ drowsuma(in,rows,cols,temp);
+ out=max(temp,cols);
+ but we have to malloc a array */
+
+ if ((rows==1)||(cols==1)){
+ for(i=0;i<cols*rows;i++){
+ out += dmagns(in[i]);
+ }
+ }
+ else{
+ for(i=0;i<cols;i++){
+ colSum = 0;
+ for(j=0;j<rows;j++){
+ colSum += dmagns(in[i*rows+j]);
+ }
+ if (colSum>out) out=colSum;
+ }
+ }
+ return out;
+}
+
+
diff --git a/2.3-1/src/c/matrixOperations/magnitude/u8magns.c b/2.3-1/src/c/matrixOperations/magnitude/u8magns.c
new file mode 100644
index 00000000..e6d789ca
--- /dev/null
+++ b/2.3-1/src/c/matrixOperations/magnitude/u8magns.c
@@ -0,0 +1,13 @@
+
+/* SCilab2C FOSSEE IIT BOMBAY */
+
+
+
+#include "matrixMagnitude.h"
+#include "abs.h"
+
+uint8 u8magns(uint8 in){
+ return u8abss(in);
+}
+
+