Results 1 to 8 of 8

Thread: [C++] Matrix Class

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004

    [C++] Matrix Class

    I have posted a beta version of my Matrix class.

    This is a class that simulates Linear Algebra matrix operations. Please tell me of what could be done to make this class better.

    [edit] This is version 1.0. A more recent version can be found toward the end of this thread.
    Attached Files Attached Files
    Last edited by Darkwraith; Sep 22nd, 2004 at 01:12 PM.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Here is the associated .h file to this class.
    Attached Files Attached Files
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Looks fine. In Inverse and Reduce you hide one local variable called lhs with another, which is not that good an idea. You could also maybe make it more efficient by having only one lhs instead of repeatedly creating and destroying them.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Just a couple of nitpicks:

    You use unsigned a lot in your code, perhaps qualifying this with a sized type for readability? (Most likely long, this seems to be 4 bytes on both 32-bit and 64-bit systems).

    Potentially, replacing assert() with something that will throw an exception could be useful; checking speed impact may be necessary.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Most likely long, this seems to be 4 bytes on both 32-bit and 64-bit systems)
    I think gcc makes long 64 bit on 64-bit systems.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Thanks for the input. I am thinking of templating the class.

    Once I have the project to which this belongs to done, I'll post the updated code. This way, the class should be throughly tested.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    I have the my most recent version of the Matrix class.

    Header:
    Attached Files Attached Files
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Here is the Implementation File for the Matrix class. Please tell me of any improvements you wish to suggest.
    Attached Files Attached Files
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

Posting Permissions

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



Click Here to Expand Forum to Full Width