hi, can anyone help me with matrices multiplication function. how do i go about doing it if i wanna do multiplication of 2 square matrices? i'll first take in the size of the matrix
example:
cin >> 3
is there any solution/help to do a dynamic multiplication? ?
1 1539
There are several ways of doing matrix multiplication in c++, depending what your need is. You can program it from scratch - then you need a data structure to hold your matrix (e.g. an array[][] or a std::vector<std ::vector<double > >), and then work from there. This is easiest and probably best if you just want to play with it.
There are also several class libraries available on the internet that provides pre-programmed functions and data structures for doing matrix work, including Blitz++, MTL, or the matrix capabilities of the Gnu Scientific Library. There is also a MATLAB library out there that lets you use MATLAB-like code directly in C++.
No matter which way you do it though, it is going to cost you some work to get it running.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ben Ingram |
last post by:
Hi all,
I am writing a template matrix class in which the template parameters are
the number of rows and number of columns. There are a number of reasons
why this is an appropriate tradeoff for my particular application. One of the
advantages is that the _compiler_ can force inner matrix dimensions used in
multiplication to agree. A _complie-time_ error will be triggered if you
write A * B and the number of coluns in A does not equal the...
|
by: christopher diggins |
last post by:
Here is some code I wrote for Matrix multiplication for arbitrary
dimensionality known at compile-time. I am curious how practical it is. For
instance, is it common to know the dimensionality of matricies at
compile-time? Any help would be appreciated. Hopefully this code comes in
useful for someone, let me know if you find it useful, or if you have
suggestions on how to improve it.
// Public Domain by Christopher Diggins, 2005
...
|
by: robix |
last post by:
Hi again. I'm now asking your help because of a smal problem i'm getting
with my multiplication matrix code.
I'll try to give you as many details as possible.
My matrix structure:
typedef struct {
int col; /* number of colowns */
int lin; /* number of lines*/
|
by: amitnanda |
last post by:
Hi Guys,
I have a matrix multiplication program in C that multiplies two
matrices.
When their size is 3*3 or 800*800, the program runs fine. But above
that size, I get a "segmentation fault".
I need this huge size as part of my assignment.
|
by: Frank-O |
last post by:
Hi ,
Recently I have been commited to the task of "translating" some complex
statistical algorithms from Matlab to C++. The goal is to be three
times as fast as matlab ( the latest) .
I've used various techniques ( loop unrolling, loop jamming...) and
tried some matrix libraries : newmat (slow for large matrix) , STL
(fast but ..not usefull) , hand coding (brain consuming...), and
recently Meschach...
| |
by: lituncse |
last post by:
dear friends,
i have come across a problem which is difficult to solve for me.it's about starssen's matrix multiplication.in general matrix multiplication we need 8 multiplications and 4 additions but for the starssen's matrix multiplication we need 7 multiplication and 14 additions which is very important from time complexity point of view.please give a solution if anyone knows.
ratikanta panda
|
by: amitsoni.1984 |
last post by:
Hi,
Is there any direct function for matrix multiplication in Python or
any of its packages? or do we have to multiply element by element?
Thank you,
Amit
|
by: crazygrey |
last post by:
Hello, I'm a newbie to C++ so excuse me if my question was trivial but
it is important to me.
I'm implementing a simple code to find the forward kinematics of a
robot:
#include "stdafx.h"
#include<iostream>
#include<iomanip>
#include<fstream>
#include"math.h"
|
by: Sozos |
last post by:
Hi guys. I have a problem with writing the base case for the following matrix multiplication function I have implemented. Please help.
#define index(i,j,power) (((i)<<(power))+(j))
void recMultiply(int i, int j, float a, int k, int l, float b, int x, int y, float c, int s);
int i, j, k, s, matrixsize, blocksize, jj, kk, power, bsize;
float sum, maxr, total=0.0, startmult, finishmult, multtime;
float* A = NULL;
float* B = NULL;
|
by: joegao1 |
last post by:
can some one give me a hint?
I want to program the code for matrix multiplication with as less arithmetical / multiplication operations as possible.
my task is to calculate the matrix multiplication A*B*A' , where
- A' refers to the transpose of matrix A
- matrix B is symmetric matrix.
- (optional) it will be much better if the result of (A*B) or (A*B)' can be stored as temperal matrix, as
this value is required thereafter.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |