Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27
  1. #21
    lulzim is offline Member
    Join Date
    Feb 2011
    Posts
    44
    Rep Power
    0

    Default

    I dont know how can u do it with only one loop ???? then please show us ur idea how can u do with only one loop ??

  2. #22
    lulzim is offline Member
    Join Date
    Feb 2011
    Posts
    44
    Rep Power
    0

    Default

    for (int i= 0; i < matrix.length; i++)
    for (int j= 0; j < matrix.length; j++) // assume a square matrix
    if (i != j && matrix[i][j] != 0) return false;
    return true;

    what is the if condition for return true ??

  3. #23
    yellowledbet is offline Senior Member
    Join Date
    Feb 2011
    Location
    Georgia, USA
    Posts
    122
    Rep Power
    0

    Default

    Wow, I should have looked up the definition of diagnol matrix and brush on my algebra, I was going by my own made up definition based on how I intrepreted your post. I am really sorry for misleading you. Regards

  4. #24
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,372
    Blog Entries
    7
    Rep Power
    25

    Default

    Quote Originally Posted by lulzim View Post
    for (int i= 0; i < matrix.length; i++)
    for (int j= 0; j < matrix.length; j++) // assume a square matrix
    if (i != j && matrix[i][j] != 0) return false;
    return true;

    what is the if condition for return true ??
    That if-statement in the inner loop returns false if an element not on the main diagonal was not equal to zero. Your question doesn't make any sense.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  5. #25
    lulzim is offline Member
    Join Date
    Feb 2011
    Posts
    44
    Rep Power
    0

    Default

    if(exp) return true; here expr what could be ??
    return false

  6. #26
    lulzim is offline Member
    Join Date
    Feb 2011
    Posts
    44
    Rep Power
    0

    Default

    My question is how to make an if condition that first return true i mean what is expression within if condition that returns true statement

  7. #27
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,372
    Blog Entries
    7
    Rep Power
    25

    Default

    Quote Originally Posted by lulzim View Post
    My question is how to make an if condition that first return true i mean what is expression within if condition that returns true statement
    Please try again because your question doesn't make any sense (and it is a run-on sentense). b.t.w. there is no condition that returns true; if all the matrix elements are tested the matrix is a diagonal matrix and you can simply return true; no condition needed.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Help with dox matrix printer
    By Albert in forum Advanced Java
    Replies: 7
    Last Post: 09-06-2011, 08:50 AM
  2. Matrix class
    By maz22 in forum New To Java
    Replies: 5
    Last Post: 10-15-2010, 06:53 AM
  3. help in matrix
    By Engineer in forum New To Java
    Replies: 7
    Last Post: 10-06-2010, 01:26 PM
  4. matrix multiply
    By slixtrix in forum New To Java
    Replies: 8
    Last Post: 09-13-2010, 06:50 AM
  5. Help with matrix
    By susan in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 04:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •