Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> shell script from c
noobie
post Dec 10 2008, 08:41 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 3
Joined: 10-December 08
Member No.: 13,789



Hallo i am totally new with linux and i am trying to make a shell script for gaussian elimination.I have written the code in c because it is easier for me to understand.But i have some problems when trying to write it in a shell script.
here is the c code

CODE
#include <stdio.h>
#include<conio.h>


int main()
{
        int n;
        float a[10][11],t;
    int i, j,k,max;

    
    for(i = 0; i < n; ++i)
        for (j = 0; j < n + 1; ++j)
            scanf("%f", &a[i][j]);

            for (i = 0; i < n; ++i)
                {
                max = i;
                  for (j = i + 1; j < n; ++j)
                  if (a[j][i] > a[max][i])
                     max = j;

                 for (j = 0; j < n + 1; ++j)
                  {
            t = a[max][j];
            a[max][j] = a[i][j];
            a[i][j] = t;
          }
                }
        for (j = n; j >= i; --j)
            for (k = i + 1; k < n; ++k)
                a[k][j] -= a[k][i]/a[i][i] * a[i][j];


                                for (i = n - 1; i >= 0; --i) {
        a[i][n] = a[i][n] / a[i][i];
        a[i][i] = 1;
        for (j = i - 1; j >= 0; --j) {
            a[j][n] -= a[j][i] * a[i][n];
            a[j][i] = 0;
        }
    }
            for (i = 0; i < n; ++i) {
        for (j = 0; j < n + 1; ++j)
            printf("%.2f\t", a[i][j]);
        printf("\n");
    }
        getch();
    return 0;
}



i cannot find out how to create a table in my script for reading the matrix...
Any help appreciated...


Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
edwardthompson
post Jan 6 2009, 04:45 AM
Post #2


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 6-January 09
Member No.: 13,839



I think its a very poor script.

Where is the retention?

What happen with the writing in HD?. You have to be careful with your HD and the bigs databases.

And the bandwith? Why not use a temporal directory and make a synchronization to a final directory to save some of bandwith in the ftp connection? Or much more better.... why ftp?? you can save more time an bandwith if you make rsync

What happen with big databases? You spend more time, CPU and bandwith in make the dumps all hours and move it to the ftp that let the applications runs through db

I think that is a script that make the job but.... is very poor


--------------------
If there is something good in the world then we copy with pride.
UnlockiPhonesoftware
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd October 2017 - 05:17 AM