Ambiguous call again

G

Giovanni Dicanio

Because some people believe that it makes to code easier to read.

They are wrong. :)

:)

So, I just think that readability is a matter of personal preference... :)

<latin>De gustibus non disputandum est.</latin>

Giovanni
 
G

Giovanni Dicanio

Anna Smidt said:
This doesn't help.

OK, so I think that there is some problem with nelems() return value, as
David W. already pointed out.

You should post the prototype of nelems() method.

Giovanni
 
G

Giovanni Dicanio

Anna Smidt said:
Thank god, the constructor error is gone!! Thanks very much!

I do get the ambiguous call error in the line you suggested:
Error 6 error C2668: 'sqrt' : ambiguous call to overloaded function
cmat.cpp 1101 ASMModel

You may try using ::sqrt() or std::sqrt() instead.

Giovanni
 
A

Anna Smidt

Until I know better, I will use double() to resolve the problem. When I
know more C++, I will find out if that's correct or if I have to use a
different conversion.
 
G

Giovanni Dicanio

I don't know, the code is so huge and I am so newbie to C++ that I have
not yet been able to figure out where nelems originates from.

I would suggest you to use Visual Assist X from Wholetomato:

http://www.wholetomato.com/

There is a trial download available.

Your coding productivity will increase a lot thanks to VAX.

In this particular case, you can put the cursor on nelems() and press
CTRL+G, and you will be sent to the definition of that method.

Giovanni
 
A

Anna Smidt

I am not sure if I have found out correctly:

MatView (double other[], size_t nelems, char *sIsRowVec=NULL): Mat()
{
sIsRowVec? init(other, 0, 0, 1, nelems, 1): init(other, 0, 0, nelems, 1);
}


Does this tell me what type of nelems are?
Anna
 
D

David Wilkinson

Anna said:
Thank god, the constructor error is gone!! Thanks very much!

I do get the ambiguous call error in the line you suggested:
Error 6 error C2668: 'sqrt' : ambiguous call to overloaded
function cmat.cpp 1101 ASMModel

Now this is one of the last bugs remaining.

I don't know, the code is so huge and I am so newbie to C++ that I have
not yet been able to figure out where nelems originates from.

Anna:

1. Clearly nelems() is a method of the class Mat; can you not find it in the
class definition? Do a Visual Studio search for it if you do not see it.

2. However, it seems to me that nelems() must return the number of elements of
the matrix (i.e. nrows*ncols). Taking the square root can only make sense if the
matrix is square (nrows == ncols), in which case why not just use nrows or ncols?

By the way, next time you start a new thread you should use the group

microsoft.public.vc.language

The group you are using (microsoft.public.dotnet.languages.vc) is intended for
the C++/CLI language which targets the .NET platform (and which you are not using).
 
G

Giovanni Dicanio

Anna Smidt said:
I am not sure if I have found out correctly:

MatView (double other[], size_t nelems, char *sIsRowVec=NULL): Mat()
{
sIsRowVec? init(other, 0, 0, 1, nelems, 1): init(other, 0, 0, nelems, 1);
}


Does this tell me what type of nelems are?

No.

You posted this code:
MatView Mat::viewAsSquare ()
{
size_t ncols = size_t(sqrt(this->nelems()));

so: nelems() should be a member function of Mat class or some class from
which Mat class is derived.

Giovanni
 
D

David Wilkinson

Anna said:
I am not sure if I have found out correctly:

MatView (double other[], size_t nelems, char *sIsRowVec=NULL): Mat()
{
sIsRowVec? init(other, 0, 0, 1, nelems, 1): init(other, 0, 0,
nelems, 1);
}


Does this tell me what type of nelems are?

Anna:

No. This nelems is just a dummy variable name. The nelems in your expression is
a method, as you can tell from the parentheses on this->nelems().

Anna, you seem a little out of your depth:

Math-wise
C++-wise
Visual Studio-wise

What are you trying to do exactly? It seems that you are trying to use an
external library that does not appear to be written very well. This is not an
easy thing to do. Maybe you should be tackling something simpler?
 
A

Anna Smidt

I am sorry, but it's overwhelming... my first days at C++.
I want to target .NET after I have resolved my problems, but I see that
I should only post .NET specific questions, ok...
But I still don't know what is .NET and what's not.
1. Clearly nelems() is a method of the class Mat; can you not find it in
the class definition? Do a Visual Studio search for it if you do not see
it.

The problem is that I am not sure if I have found the correct thing.
I do have a Mat.cpp, is that the correct location, or what should I
search for?

Anna
 
D

David Wilkinson

Anna said:
I am sorry, but it's overwhelming... my first days at C++.
I want to target .NET after I have resolved my problems, but I see that
I should only post .NET specific questions, ok...
But I still don't know what is .NET and what's not.


The problem is that I am not sure if I have found the correct thing.
I do have a Mat.cpp, is that the correct location, or what should I
search for?


Anna:

The class definition should be in the header file (Mat.h perhaps, or Mat.hpp).
In it you will find the declaration of the elems() method. You should also find
the implementation Mat::elems() in Mat.cpp (unless the method is defined inline
in the header file).

But you can use Visual Studio to search your entire solution for elems():

Edit Menu->Find and Replace->Find in Files

You might also search for

class Mat (for the class definition)
Mat::nelems() (for the implemtation of elems())

It really seems to me that you should work on your C++ and Visual Studio skills
before tackling some large external library (that does not appear to be written
very well).
 
A

Anna Smidt

"Out of your depth", hahaha, this is very true.
I know VC++ since a few days only.
But I want/ have to get this project done. I learn the most when I do
complicated things.

Anna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top