How to Access upper triangular Matrix elements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suresh4ind
    New Member
    • Apr 2007
    • 11

    #1

    How to Access upper triangular Matrix elements

    Hi
    i need to copy the upper triangular elements of matrix A[100][100] to an array
    B[5050],how to perform this ,can u send me the accessing formula
  • tnga
    New Member
    • Jul 2007
    • 27

    #2
    Originally posted by suresh4ind
    Hi
    i need to copy the upper triangular elements of matrix A[100][100] to an array
    B[5050],how to perform this ,can u send me the accessing formula
    You mean the up-right corner? So that's half the matrix...
    All you have to do is to read the lines of the matrix and everytime you read a line, start reading the next line one columm to the right. All you have to do is to write the values in array B in sequence. Did I understand correctly?

    Regards

    Comment

    • suresh4ind
      New Member
      • Apr 2007
      • 11

      #3
      i need the mathematical formula for accessing the elements of upper triangular elements to an lineary array

      Comment

      • suresh4ind
        New Member
        • Apr 2007
        • 11

        #4
        i think now the question will be more clear
        see we have access formula for elements in a matrix A[i][j] to an array[index]
        using row major is
        index=i*(no of columns)+j
        similarily i want the mathematical formula for accessing the upper triangular elements in to an array using row major

        Comment

        • tnga
          New Member
          • Jul 2007
          • 27

          #5
          Originally posted by suresh4ind
          i think now the question will be more clear
          see we have access formula for elements in a matrix A[i][j] to an array[index]
          using row major is
          index=i*(no of columns)+j
          similarily i want the mathematical formula for accessing the upper triangular elements in to an array using row major
          Yes, that's what i understood after your reply...
          I guess there must be something like dividing and using the rest of divisions between the position you want to get (index on B) and the length of the lines in the matrix...
          I know it's wrong, but i guess it's something like this:

          B[index]=a[index%n][i-index%n]

          using a nxn size matrix.

          Sorry, I can't help you very much on this. Just guessing...

          Comment

          • suresh4ind
            New Member
            • Apr 2007
            • 11

            #6
            hi thankx i got the answer

            Comment

            • tnga
              New Member
              • Jul 2007
              • 27

              #7
              Originally posted by suresh4ind
              hi thankx i got the answer
              What's the answer? Please share

              Comment

              Working...