Solved

C++ Help with Matrices

Posted on 2014-04-13
9
209 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
  • 3
  • 3
9 Comments
 
LVL 35

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 8

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 35

Accepted Solution

by:
mccarl earned 500 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 35

Expert Comment

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now