summaryrefslogtreecommitdiff
path: root/src/matrixOperations/cat
diff options
context:
space:
mode:
authortorset2009-01-16 16:22:45 +0000
committertorset2009-01-16 16:22:45 +0000
commit6336fd8c8f24e474913ce7e85fbb2d0fad6283df (patch)
tree3be1f64f9f9f4c194ad85452a8629a0ba73aae41 /src/matrixOperations/cat
parent206ead570d3a93760a23e1a9f426ad09e793dac5 (diff)
downloadscilab2c-6336fd8c8f24e474913ce7e85fbb2d0fad6283df.tar.gz
scilab2c-6336fd8c8f24e474913ce7e85fbb2d0fad6283df.tar.bz2
scilab2c-6336fd8c8f24e474913ce7e85fbb2d0fad6283df.zip
Update with Scilab2C modifs (maybe some errors)
Diffstat (limited to 'src/matrixOperations/cat')
-rw-r--r--src/matrixOperations/cat/dcata.c3
-rw-r--r--src/matrixOperations/cat/testDoubleMatrixConcatenation.c18
2 files changed, 20 insertions, 1 deletions
diff --git a/src/matrixOperations/cat/dcata.c b/src/matrixOperations/cat/dcata.c
index 79469c30..e594bf0f 100644
--- a/src/matrixOperations/cat/dcata.c
+++ b/src/matrixOperations/cat/dcata.c
@@ -15,13 +15,14 @@
** Emulate Scilab (from help cat) :
** then the concatenation is done according to the rows
**
-** A1=[1 2 3 ; 4 5 6]; A2=[7 8 9 ; 10 11 12]; y=cat(1,A1,A2) => y=[1 2 3 ; 4 5 61 ;7 8 9; 10 11 12]
+** A1=[1 2 3 ; 4 5 6]; A2=[7 8 9 ; 10 11 12]; y=cat(1,A1,A2) => y=[1 2 3 ; 4 5 6 ;7 8 9; 10 11 12]
**
*/
void drowcata(double *in1, int lines1, int columns1, double *in2, int lines2, int columns2, double* out) {
int i = 0;
int j = 0;
+
for (i = 0 ; i < columns1 && i < columns2 ; ++i)
{
for (j = 0 ; j < lines1 ; ++j)
diff --git a/src/matrixOperations/cat/testDoubleMatrixConcatenation.c b/src/matrixOperations/cat/testDoubleMatrixConcatenation.c
index 129e7518..29ab3c65 100644
--- a/src/matrixOperations/cat/testDoubleMatrixConcatenation.c
+++ b/src/matrixOperations/cat/testDoubleMatrixConcatenation.c
@@ -140,6 +140,24 @@ static void drowcataTest() {
assert(out_6_2[9] == 8.0);
assert(out_6_2[10] == 11.0);
assert(out_6_2[11] == 12.0);
+
+ drowcata(in1, 1, 6, in2, 1, 6, out_6_2);
+ for (i = 0 ; i < 12 ; ++i) {
+ printf("out_6_2[%d] = %e\n", i, out_6_2[i]);
+ }
+ assert(out_6_2[0] == 1.0);
+ assert(out_6_2[1] == 3.0);
+ assert(out_6_2[2] == 2.0);
+ assert(out_6_2[3] == 4.0);
+ assert(out_6_2[4] == 5.0);
+ assert(out_6_2[5] == 7.0);
+ assert(out_6_2[6] == 6.0);
+ assert(out_6_2[7] == 8.0);
+ assert(out_6_2[8] == 9.0);
+ assert(out_6_2[9] == 11.0);
+ assert(out_6_2[10] == 10.0);
+ assert(out_6_2[11] == 12.0);
+
}
static void zrowcatsTest(void) {