?
Solved

C++ Help with Matrices

Posted on 2014-04-13
9
Medium Priority
?
251 Views
Last Modified: 2014-04-13
Hi i need help multiplying 2 matrix arrays b_matrix and p_matrix such that it creates a V_matrix and then use that V_matrix to create the C_matrix.

This isnt necessarily 'matrix' multiplication, more so scalar, by that I mean i coded the formula such that the first row of the V_matrix will be 0 60 50 45.

Can anyone help me?
new-qap-ee-code-help.txt
0
Comment
Question by:college_student
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
9 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 39998245
The code that you've got there to do the multiplication looks fine. You just need to name the function properly (you can't have the square brackets in a function name) and then call that function from within your code. And I can't see how this would be too much of a drama because you have already done exactly this with the "costMatrix()" function!
0
 

Author Comment

by:college_student
ID: 39998249
how would i call it within the code? and would the proper name be V_matrix()?
0
 

Author Comment

by:college_student
ID: 39998265
ok ill keep that in mind. could you help answer my question though?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Subrat (C++ windows/Linux)
ID: 39998276
I don't know while updating the message, i found some error related to {i} tag something....
So uploading the file for your reference.
Including to the above answer given by expert....

Look into the attachment.
help.txt
0
 
LVL 36

Accepted Solution

by:
mccarl earned 2000 total points
ID: 39998279
So I am assuming that you haven't written all this code yourself then?

Whoever wrote the "costMatrix()" function has given you a pretty good hint as to what to do. The code that you have posted shows how to declare a function, costMatrix, is an example of this, and also how to call that function from within other parts of your code (look at the fourth line of code in your main() function body. So all you need to do is follow those examples.

would the proper name be V_matrix()?
The proper name would be whatever you wanted to call it that makes sense to you. But yes, that is closer to the correct syntax to yuse when declaring the function. But I wouldn't call the function the same as an existing variable name. You may want to call the function something descriptive such as "calculateVMatrix()", although I am sure that as far as your algorithm goes, that there is probably an even better description for what generating the V matrix is really doing.
0
 

Author Closing Comment

by:college_student
ID: 39998295
Thanks for your help. i got it now
0
 
LVL 36

Expert Comment

by:mccarl
ID: 39998296
Not a problem! :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question