-
matrix (was: Need help for C++!!!)
I need someone to make my program on C++ A program introducing numerical values in a matrix "a" (3, 4). A program to transpose the matrix "a" in a new matrix "ta"(4, 3).
This is for School, or my teacher will be verry angry with me, pls help me someone.!!
-
This forum is not for us to do your homework for you. Try it, post what you have, and ask for some help is fine, but for us to do it for you, that is cheating and you learn nothing and we get stuck with someone at our job who knows nothing because he cheated through school, and then we have to do both his job and our own.... its an ugly world when that happens.
However, on the grounds that if you turn this in you will still fail (once you cannot explain it) I will offer you my high speed xpose routine, in hopes that you learn something from it.
Workspace is a global, because I need fast more than I need clean deep in my engine.
Matrix& Matrix::operator! ()
{//Standard matrix transpose (matlab uses ' but c++ cannot overload to use it)
//NOT of a matrix is nonsense so ! fills in nicely here
register unsigned int j;
register unsigned int k;
if(rows == 1 || cols ==1) //it would be nice to just flip rows and cols but result assign would be unsafe!
{
WORKSPACE = *this;
WORKSPACE.rows = cols;
WORKSPACE.cols = rows;
return(WORKSPACE);
}
WORKSPACE.rows = cols;
WORKSPACE.cols = rows;
for(k = 0; k < rows; k++)
{
for(j = 0; (j < cols); j++)
{
WORKSPACE.data[j*rows + k] = data[k*cols +j];
}
}
return(WORKSPACE);
}
-
I wouldn't want your teacher to be very angry, which is what would probably happen if s/he found out you're asking other people to do your homework for you.
Seriously, you need to show some effort on your side and come up with specific questions.
Danny Kalev
Similar Threads
-
By greenmile in forum C++
Replies: 2
Last Post: 10-16-2008, 10:09 PM
-
Replies: 7
Last Post: 05-29-2008, 09:11 AM
-
By Peter_APIIT in forum C++
Replies: 18
Last Post: 06-09-2007, 04:32 AM
-
By emmanuella in forum C++
Replies: 2
Last Post: 11-23-2006, 05:07 PM
-
By ASPSmith Training in forum dotnet.announcements
Replies: 0
Last Post: 06-18-2002, 03:39 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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks