diff --git a/README.md b/README.md index 2e63dc0..c6338a8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,17 @@ -This repository is a test toolbox for Scilab. It requires "thirdparty" directory which can be downloaded as "external-library.zip" file from the page: https://scilab.in/fossee-scilab-toolbox. The "thirdparty" directory contains compiled library for a simple "multiplication" function written in C. After copying the "thirdparty" directory to the toolbox directory, on the scilab console run "exec builder.sce" to build the toolbox and then run "exec loader.sce" to load the toolbox. Type "help" in the scilab console and browse through the help content of "test_toolbox". The external-library.zip file also contains separate instructions to work with MinGW on Windows OS. +Documentation by : B C Sagar,as a part of Phase one FOSSEE SEMESTER long Internship Screening task by IIT Bombay for Scilab toolkit optimization. -This toolbox overall demonstrates -1. How to add a function defined in C in scilab -2. How to add a function defined in Scilab in Scilab -3. How to write help for the added functions -4. How to create a toolbox out of the above functions. +This repository is a test toolbox for Scilab. It requires "thirdparty" directory which can be downloaded as "external-library.zip" file from the page: +https://scilab.in/fossee-scilab-toolbox. The "thirdparty" directory contains compiled library for a simple "Transpose" function written in C. After copying the +"thirdparty" directory to the toolbox directory, on the scilab console run "exec builder.sce" to build the toolbox and then run "exec loader.sce" to load the +toolbox. Type "help" in the scilab console and browse through the help content of "test_toolbox". The external-library.zip file also contains separate instructions to work with Mint Linux. + + +This toolbox overall demonstrates: + +1. a stand alone C function that computes transpose of a nxm matrix. Name the file as “trans.c” + +2. a main file to call the C function. + +3. a folder named “test” inside the repository. Copied my working “trans.c” file and “main.c” file inside this folder. + +4. a shell script with a series of commands to compile and execute the “trans.c” and “main.c” file. I have copied the working shell script file inside the “test” folder. diff --git a/Test b/Test new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Test @@ -0,0 +1 @@ + diff --git a/test/main.c b/test/main.c new file mode 100644 index 0000000..349bf97 --- /dev/null +++ b/test/main.c @@ -0,0 +1,16 @@ +#include + main() { + int a[10][10], transpose[10][10], r, c, i, j; + printf("Enter rows and columns: "); + scanf("%d %d", &r, &c); + + // Assigning elements to the matrix + printf("\nEnter matrix elements:\n"); + for (i = 0; i < r; ++i) + for (j = 0; j < c; ++j) { + printf("Enter element a%d%d: ", i + 1, j + 1); + scanf("%d", &a[i][j]); + int transpose(r,c,a[i][j]); + } + + diff --git a/test/trans.c b/test/trans.c new file mode 100644 index 0000000..f92f508 --- /dev/null +++ b/test/trans.c @@ -0,0 +1,22 @@ +#include + +#include +#include +int transpose(int r,int c,int a[i][j]) + + // Finding the transpose of matrix a + for (i = 0; i < r; ++i) + for (j = 0; j < c; ++j) { + transpose[j][i] = a[i][j]; + } + + // Displaying the transpose of matrix a + printf("\nTranspose of the matrix:\n"); + for (i = 0; i < c; ++i) + for (j = 0; j < r; ++j) { + printf("%d ", transpose[i][j]); + if (j == r - 1) + printf("\n"); + } + return 0; +}