summaryrefslogtreecommitdiff
path: root/sci_gateway/cpp
diff options
context:
space:
mode:
authorttt2019-10-02 16:12:06 +0530
committerttt2019-10-02 16:12:06 +0530
commit5cbdabe67f771f9e5a997f9b50dbd04c6222f183 (patch)
treed5619969ba27d5646a485c13dc77876666c68448 /sci_gateway/cpp
parent899ad723ae19201752f46ba225ccfcae057e6a65 (diff)
downloadfossee-scilab-octave-toolbox-5cbdabe67f771f9e5a997f9b50dbd04c6222f183.tar.gz
fossee-scilab-octave-toolbox-5cbdabe67f771f9e5a997f9b50dbd04c6222f183.tar.bz2
fossee-scilab-octave-toolbox-5cbdabe67f771f9e5a997f9b50dbd04c6222f183.zip
matrix input transpose correction
Diffstat (limited to 'sci_gateway/cpp')
-rwxr-xr-xsci_gateway/cpp/libscilab_toolbox.sobin17024 -> 17024 bytes
-rw-r--r--sci_gateway/cpp/sci_matrix.cpp16
2 files changed, 11 insertions, 5 deletions
diff --git a/sci_gateway/cpp/libscilab_toolbox.so b/sci_gateway/cpp/libscilab_toolbox.so
index 5d957ed..3aec94f 100755
--- a/sci_gateway/cpp/libscilab_toolbox.so
+++ b/sci_gateway/cpp/libscilab_toolbox.so
Binary files differ
diff --git a/sci_gateway/cpp/sci_matrix.cpp b/sci_gateway/cpp/sci_matrix.cpp
index 7153903..0e2bc2c 100644
--- a/sci_gateway/cpp/sci_matrix.cpp
+++ b/sci_gateway/cpp/sci_matrix.cpp
@@ -18,7 +18,6 @@ extern "C"
static const char fname[] = "octave_fun";
-///////#####call octave_fun("hamming",[5],"periodic") ########////////////
int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
{
@@ -59,11 +58,18 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o
ins[i].in_data = malloc(sizeof(double)*size);
d = (double *)ins[i].in_data;
- for(j=0;j<size;j++)
+////This code snippet is to flatten matrix row wise and then store it
+ int p,q,k = 0;
+ for(p=0;p<row;p++)
{
- d[j] = n[j];
- //printf("%f\n",d[j]);
+ for(q=0;q<col;q++)
+ {
+ d[k] = n[p + q*row];
+ k++;
+ //printf("%f\n",d[j]);
+ }
}
+/////////////////////////////////////////
}
else if(scilab_getType(env, in[i])==10)
{
@@ -126,7 +132,7 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o
}
else
{
- Scierror(77, _("%s: Wrong number of output argument(s): This function can return a maximum of %d output(s).\n"), fname, funcall.n_out_arguments);
+ Scierror(77, _("%s: Wrong number of output arguments: This function can return a maximum of %d output(s).\n"), fname, funcall.n_out_arguments);
return 1;
}