Matrices...

This is a discussion on Matrices... within the C++ Programming forums, part of the General Programming Boards category; For anybody here who's taken Algebra II or higher or knows about matrices: Is there any way to use matrices ...

  1. #1
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942

    Matrices...

    For anybody here who's taken Algebra II or higher or knows about matrices:

    Is there any way to use matrices in C++?

    Maybe

    [code]
    matrix a = {3 4 5}{6 7 8}{9 10 11};
    matrix b = {1 2 3}{4 5 6}{7 8 9};
    matrix c;

    c = a*b;

    or something?

    possible?

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Multidimensional arrays would be a good idea.

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    7
    it is posible to use matrices ( more dimensional arrays ) but u ll have to tell the compiler how to add them togather (not only that, every single matrix calculation form - and there are many as you know) .... if u need help with maths i would recommend maple 7 ( great program, matrix , laplace transf., furier theorems and so on - very easy to use ) ... try it out ( i ll check out how you calculate matrix in ms visual and write back .... but again try maple 7 first )

  4. #4
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    I was thinking about that, but that would mean more work for me, and I'm lazy :P

    Well, I guess I'm stuck with Multi-D Arrays...

  5. #5
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    And my program's done. I found a way to do it w/o arrays. I was making a 3D Systems of Equations program thing. Now I can cheat in math class :P

  6. #6
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    There is a way! Although I've not used them (yet...) they are called Valarrays, and "The C++ Standard Library" says:

    The C++ standard library provides the class valarray for the processing of arrays of numeric values. A valarray is a representation of the mathematical concept of a linear sequence of values. It has one dimension, but you can get the illusion of higher dimensionality by special techniques of computed indices and powerful subsetting capabilities. Therefore, a valarray can be used as a base both for vector and matrix operations as well as for the processing of mathematical systems of polynomial equations with good performance.
    Sounds good doesn't it?
    An example of the usefulness of valarrays:

    z = a*x*x + b*x + c

    where each variable is an array of "hundreds of numeric values"

    I might be reading more about these tonight :P

    Code:
    #include <valarray>
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C simple Matrices
    By Cyberman86 in forum C Programming
    Replies: 3
    Last Post: 05-07-2009, 05:20 PM
  2. Help getting started..matrices
    By BobDole11 in forum C Programming
    Replies: 7
    Last Post: 11-15-2008, 08:51 PM
  3. adding matrices, help with switches
    By quiet_forever in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2007, 08:21 AM
  4. Comparing Matrices (D3D9)
    By MicroFiend in forum Game Programming
    Replies: 2
    Last Post: 10-12-2005, 08:36 AM
  5. Problem multiplying rotation matrices together
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 03-04-2003, 08:20 AM

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