Closed wzhy closed 2 months ago
Hi wzhy,
I wrote code like this in a header file: typedef cml::vector<const double *, cml::dynamic<>> vector_pdd;
The first template argument should be a basic numeric type; e.g. double
or float
. So, you will want something like this:
using vector_pdd = cml::vector<double, cml::dynamic<>>;
Alternatively, you can use the matching predefined vector type from cml/vector/types.h; e.g.:
using vector_pdd = cml::vectord;
And [http://cmldev.net/] can not open. So is there any doc about CML?
Unfortunately, I only have the in-source, Doxygen-formatted documentation right now. Apparently, real documentation has been on my list for some time (https://github.com/demianmnave/CML/issues/7)! The tests may also be useful for seeing how things fit together.
Let me know if you have any more trouble with the compiler error.
Thanks for your reply, demianmnave! I knew the /matrix/types.h and /vector/types.h there. Actually, I am immigrating one program(at least over 12 years old) using your CML^^ The version of CML this program used may be 1.0 as the files organization is the same with 1.0~1.0.4 which are downloaded from sourceforge. codes like this work fine in this old program:
typedef cml::vector<const double *, cml::dynamic<>> vector_pdd;
cml::vector_pdd pData;
pData.data()
pData.resize(5)
Now I want to immigrate CML to V2.2.1 release. So problem occurs. Any suggestion is welcomed.
BTW: CML_VERSION and CML_VERSION_STRING in /cml/version.h in the V2.2.1 release may be modified to 2.2.1^^
Actually, I am immigrating one program(at least over 12 years old) ...
Yikes, that sounds like a challenge! I don't know if CML2 will be the right fit since it keeps tighter control over the types it understands (essentially, numeric-like types).
That said, you could try specializing cml::scalar_traits
as unsigned long long
and see if that gets you further along:
namespace cml {
/** Specialization of scalar traits for pointer types. */
template<typename Base> struct scalar_traits<Base*, void>
: detail::default_integral_traits<unsigned long long>
{
static constexpr Scalar sqrt_epsilon() { return 0; }
};
/** Specialization of scalar traits for pointer const types. */
template<typename Base> struct scalar_traits<const Base*, void>
: detail::default_integral_traits<unsigned long long>
{
static constexpr Scalar sqrt_epsilon() { return 0; }
};
}
If the code does not rely on math operators, you might have better luck swapping out cml::vector<...>
with std::vector<const double*>
. If you were able to post a few examples of how the code is using cml::vector<>
, I might be able to give you more specific advice.
Hi Demian,
The method you gave above is not working...
I read the code of my program carefully and found that the author used vector_pdd as a dynamic 2D Array (as C style)^^ So I used cml::vectord *pData
and pData = new cml::vectord[DataNum]
replace it. Maybe ugly and it worked!
Then I immigrated all the other codes using CML from v1.0 to v2.2.1. Only one function should be changed in my code: cml::T
--> cml::transpose
. And then the whole program worked well so far.
Thank you very much again!
Hi Will, glad you figured it out without having to do anything fancy!
Good luck with your project, and feel free to submit another issue if you run into any more problems.
Have a nice weekend^^
Hi! I wrote code like this in a header file:
typedef cml::vector<const double *, cml::dynamic<>> vector_pdd;
Thencml::vector_cpdd pData;
I got some errors when compiling it :
How can I fix this ? I'm new in C++... And [http://cmldev.net/] can not open. So is there any doc about CML? Thank you very much!