From a6efab1a42eda8c1e3902c2f2d030a9cb9cfd25e Mon Sep 17 00:00:00 2001 From: imushir Date: Tue, 9 Feb 2016 16:38:27 +0530 Subject: Support for Servo motor for Arduino. Support for'diag' in c --- 2.3-1/src/c/matrixOperations/determ/u16determa.c | 92 ++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 2.3-1/src/c/matrixOperations/determ/u16determa.c (limited to '2.3-1/src/c/matrixOperations/determ/u16determa.c') 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 +#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