472,373 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

custom Matrix class to VC++ standard doubles Matrix class

Hi,

I developed a custom Matrix class derived from custom VC++ doubles Array
class derived from a RealArray which is defined as:

typedef CArray<double,doubleRealArray;

Now I need to convert this custom Matrix class to standard doubles Matrix
(VC++) as I am passing it to some function that understands only the standard
class.

Is there some way of doing it?????

Any suggestions are appriciated.

Manj.
Dec 20 '07 #1
5 2716
Manjree Garg wrote:
Hi,

I developed a custom Matrix class derived from custom VC++ doubles Array
class derived from a RealArray which is defined as:

typedef CArray<double,doubleRealArray;

Now I need to convert this custom Matrix class to standard doubles Matrix
(VC++) as I am passing it to some function that understands only the standard
class.

Is there some way of doing it?????

Any suggestions are appriciated.
Manj:

Well, I think that depends on how you have set up your matrix class.

If you look at the Numerical Recipes matrix class (wwww.nr.com) you will
see how they have set it up to that it can be passed as an argument to a
routine expecting a standard two-dimensional array. This is done by
assigning all the memory in a contiguous array, and then defining
pointers into this array to get row-column indexing capability.

Personally, I would not touch CArray with a 10-foot pole. Rather I would
(and do) use either solutions based on std::vector, or a custom solution
such as the Numerical Recipes one.

--
David Wilkinson
Visual C++ MVP
Dec 20 '07 #2
Hi David

Thanks for your reply.

First of all I need to know if there is any standard doubles Matrix class
available in VC++ (VS.NET 2005).

If Yes then how to use it (some link?).

How can I find Numerical Recipes matrix class as the code is not available
at www.nr.com?
Regards,

Manj.

"David Wilkinson" wrote:
Manjree Garg wrote:
Hi,

I developed a custom Matrix class derived from custom VC++ doubles Array
class derived from a RealArray which is defined as:

typedef CArray<double,doubleRealArray;

Now I need to convert this custom Matrix class to standard doubles Matrix
(VC++) as I am passing it to some function that understands only the standard
class.

Is there some way of doing it?????

Any suggestions are appriciated.

Manj:

Well, I think that depends on how you have set up your matrix class.

If you look at the Numerical Recipes matrix class (wwww.nr.com) you will
see how they have set it up to that it can be passed as an argument to a
routine expecting a standard two-dimensional array. This is done by
assigning all the memory in a contiguous array, and then defining
pointers into this array to get row-column indexing capability.

Personally, I would not touch CArray with a 10-foot pole. Rather I would
(and do) use either solutions based on std::vector, or a custom solution
such as the Numerical Recipes one.

--
David Wilkinson
Visual C++ MVP
Dec 20 '07 #3
Manjree Garg wrote:
Hi David

Thanks for your reply.

First of all I need to know if there is any standard doubles Matrix class
available in VC++ (VS.NET 2005).

If Yes then how to use it (some link?).

How can I find Numerical Recipes matrix class as the code is not available
at www.nr.com?
Manj:

Yes, the Numerical Recipes web site is rather annoying. The utility
vector and matrix classes are actually public domain (I believe) and may
be found at

http://www.nr.com/codefile.php?nr3

Or, you could do what I just did and put "C++ matrix library" into
Google. You will find lots of hits, including the "Matrix Template
Library" which is based on STL.

--
David Wilkinson
Visual C++ MVP
Dec 20 '07 #4
Hello David

Thanks for the reply but my question still remains the same.

I am passing a doubles data matrix to a Matlab function (using Matlab
builder) via MWNumericArray which accepts standard doubles matrix. All the
links on google are for custom matrix which it doesn't accept. So How can I
resolve this problem?????

Cheers.

Manjree

"David Wilkinson" wrote:
Manjree Garg wrote:
Hi David

Thanks for your reply.

First of all I need to know if there is any standard doubles Matrix class
available in VC++ (VS.NET 2005).

If Yes then how to use it (some link?).

How can I find Numerical Recipes matrix class as the code is not available
at www.nr.com?

Manj:

Yes, the Numerical Recipes web site is rather annoying. The utility
vector and matrix classes are actually public domain (I believe) and may
be found at

http://www.nr.com/codefile.php?nr3

Or, you could do what I just did and put "C++ matrix library" into
Google. You will find lots of hits, including the "Matrix Template
Library" which is based on STL.

--
David Wilkinson
Visual C++ MVP
Dec 21 '07 #5
Manjree Garg wrote:
Hello David

Thanks for the reply but my question still remains the same.

I am passing a doubles data matrix to a Matlab function (using Matlab
builder) via MWNumericArray which accepts standard doubles matrix. All the
links on google are for custom matrix which it doesn't accept. So How can I
resolve this problem?????
Manjree:

Well, if you have a custom matrix class that stores its elements in
contiguous memory (as the Numerical Recipes matrix class does by design)
then &a[0][0] is a pointer to the first element of that storage, and you
can pass it to a routine that expects a standard "C matrix".

Numerical Recipes calls this feature "backdoor compatibility".

--
David Wilkinson
Visual C++ MVP
Dec 21 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Erik Borgstr?m | last post by:
Hi, I simply want to use simple matrices of ints or doubles in C++ and I want all the good: 1) be able to use double-index, e.g. m 2) not have to use pointers at all 3) do it fast I know...
3
by: Dave | last post by:
Hi there: i am doing a matrix class for practice. everything is ok except the operator. Basically, i want to achieve the same way as the normal double's, such as: m = 4.0; m = m + m;...
6
by: memocan | last post by:
#include <iostream> using namespace std; int x; //global variable matrix int main() { x= new float ; //initialize the size now }
2
by: 50295 | last post by:
Hi - I program in C++ but I'm not good with VC++ (yet). I will like to create a custom project for which a specific template or wizard does not exist. Because the program is a console...
1
by: Tamas Demjen | last post by:
I started to experiment with VC++ 2005 Beta1. So far everything went fine, and already have a working project, but soon I realized that the compiler was ancient (not supporting half of the C++/CLI...
16
by: Martin Jørgensen | last post by:
Hi, I've made a program from numerical recipes. Looks like I'm not allowed to distribute the source code from numerical recipes but it shouldn't even be necessary to do that. My problem is...
8
by: MVM | last post by:
I am new to VS 2003. I did programming in vb6 and vc6, but not through studio. I am having lot of confusion on how to start, where to start? I like to write a program in vc++ under vs 2003. i...
20
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...
2
by: sarah | last post by:
hi all I'm trying to program a c++ matrix. can anybody help me? how can i attach the file to be programmed with this post? sarah
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.