summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/matrixOperations/diag/ddiaga.c
diff options
context:
space:
mode:
authorsiddhu89902016-03-02 14:32:06 +0530
committersiddhu89902016-03-02 14:32:06 +0530
commit070c6a83075034f4322faf84b1c4623da314a2e9 (patch)
tree4d1b2aa9ef7847620bd0e34a01957e9a05499923 /2.3-1/src/c/matrixOperations/diag/ddiaga.c
parentb31a4a5f8a03f516d6ec21efb31f9892cb46f9f3 (diff)
parentec6d011ec9b0e656f3c0d122fcba0c1d01e8cb32 (diff)
downloadScilab2C-070c6a83075034f4322faf84b1c4623da314a2e9.tar.gz
Scilab2C-070c6a83075034f4322faf84b1c4623da314a2e9.tar.bz2
Scilab2C-070c6a83075034f4322faf84b1c4623da314a2e9.zip
Merged with linspace and logspace
Diffstat (limited to '2.3-1/src/c/matrixOperations/diag/ddiaga.c')
-rw-r--r--2.3-1/src/c/matrixOperations/diag/ddiaga.c40
1 files changed, 40 insertions, 0 deletions
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;
+
+ }
+
+}
+