looked at tutorial and still confused

This is a discussion on looked at tutorial and still confused within the C++ Programming forums, part of the General Programming Boards category; okay when if its okay with u ill write post the instructions so it be clearer than me explaing\ By ...

  1. #16
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    okay when if its okay with u ill write post the instructions so it be clearer than me explaing\


    By calling the function smatrix(A,x,n),with n=4,
    which you will construct, determine the components of the matrix A_s=(A+A_t)/2, where
    A_t stands for the transpose matrix of A, and the components of the
    vector y=(A_s*x)/norm_x, where norm_x denotes the norm (length) of the vector x.
    Print the components of the matrix A_s and the vector y in the main.
    Free dinamically allocated memory

  2. #17
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    oh oops then its c sorry for the mistake, i guess i should have posted this in the other forum
    i feel dumb now

  3. #18
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by rafacnsoccer View Post
    oh oops then its c sorry for the mistake, i guess i should have posted this in the other forum
    i feel dumb now
    It doesn't matter that much, as long as you are sure which way you are suppose to go.

    I don't know much about math, can you do this on paper? As for this bit:

    Quote Originally Posted by rafacnsoccer View Post
    Print the components of the matrix A_s and the vector y in the main.
    Free dinamically allocated memory
    That means smatrix will either return a **double (a new matrix), or else it could change A in place (if that is feasible). If you don't need to use the original A again, changing in place would be better (but it might be impossible depending on the details of the math part).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #19
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    see i look online and all i find are programs using this type of transpose, which i dnt know if its the same
    insert
    Code:
    int main()
    {
       int i,j;
       double a[4][5] = {{  1.00,  2.00,  3.00,  4.00,  5.00},
                         {  1.00,  4.00,  9.00, 16.00, 25.00},
                         {  1.00,  8.00, 27.00, 64.00,125.00},
                         {  1.00, 16.00, 81.00,256.00,625.00}};
     
       double b[5][4];
     
       transpose_matrix(&a[0][0], &b[0][0], 4, 5);
       for(j=0;j<4;j++)
       {
         for(i=0;i<5;i++)
         {
            printf("%6.2lf ", a[j][i]);
         }
         printf("\n");
       }
       printf("--\n");
       for(j=0;j<5;j++)
       {
         for(i=0;i<4;i++)
         {
            printf("%6.2lf ", b[j][i]);
         }
         printf("\n");
       }
    }

  5. #20
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    yea so i am not too sure how to much on or how to translate this using the file pointer

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21