Fuzzy Union in C++

E

Evyn

Hi,

What is the best way to implement a union for fuzzy sets in C++? I have
used the following code for crisp sets, but the trick to converting it
for fuzzy sets eludes me.

std::set_union(vec1.begin(), vec1.end(), vec2.begin(), vec2.end(),
std::back_inserter<std::vector<double> >(vec3));
sort (vec3.begin (), vec3.end (), less <double> ());

TIA
Evyn
 
O

Ondra Holub

Evyn napsal:
Hi,

What is the best way to implement a union for fuzzy sets in C++? I have
used the following code for crisp sets, but the trick to converting it
for fuzzy sets eludes me.

std::set_union(vec1.begin(), vec1.end(), vec2.begin(), vec2.end(),
std::back_inserter<std::vector<double> >(vec3));
sort (vec3.begin (), vec3.end (), less <double> ());

TIA
Evyn

Although I do not know what does mean crisp set, you can simplify your
code a little bit:

std::set_union(
vec1.begin(), vec1.end(),
vec2.begin(), vec2.end(),
back_inserter(vec3)
);
std::sort (vec3.begin (), vec3.end (), std::less<double>());
 
E

Evyn

Thanks for the heads-up...

Ondra said:
Evyn napsal:

Although I do not know what does mean crisp set, you can simplify your
code a little bit:

std::set_union(
vec1.begin(), vec1.end(),
vec2.begin(), vec2.end(),
back_inserter(vec3)
);
std::sort (vec3.begin (), vec3.end (), std::less<double>());
 

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

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top