Commit 57716b90 authored by Tiago Peixoto's avatar Tiago Peixoto

Implement Vector_cdouble

parent c3a5066b
......@@ -480,6 +480,7 @@ BOOST_PYTHON_MODULE(libgraph_tool_core)
boost::mpl::for_each<boost::mpl::push_back<scalar_types,string>::type>(export_vector_types());
export_vector_types()(size_t(), "size_t");
export_vector_types()(std::vector<double>(), "Vector_double");
export_vector_types()(std::complex<double>(), "cdouble");
class_<GraphInterface>("GraphInterface", init<>())
.def(init<GraphInterface,bool,boost::python::object,
......
......@@ -471,6 +471,18 @@ struct hash<std::vector<Value, Allocator>>
}
};
template <class Value>
struct hash<std::complex<Value>>
{
size_t operator()(const std::complex<Value>& v) const
{
size_t seed = hash<Value>()(v.real());
std::_hash_combine(seed, hash<Value>()(v.imag()));
return seed;
}
};
}
#endif // GRAPH_UTIL_HH
......@@ -149,12 +149,14 @@ from inspect import ismethod
__all__ = ["Graph", "GraphView", "Vertex", "Edge", "VertexBase", "EdgeBase",
"Vector_bool", "Vector_int16_t", "Vector_int32_t", "Vector_int64_t",
"Vector_double", "Vector_long_double", "Vector_string",
"Vector_size_t", "value_types", "load_graph", "load_graph_from_csv",
"VertexPropertyMap", "EdgePropertyMap", "GraphPropertyMap", "PropertyMap",
"PropertyArray", "group_vector_property", "ungroup_vector_property",
"map_property_values", "infect_vertex_property", "edge_endpoint_property",
"incident_edges_op", "perfect_prop_hash", "seed_rng", "show_config",
"openmp_enabled", "openmp_get_num_threads", "openmp_set_num_threads",
"Vector_size_t", "Vector_cdouble", "value_types", "load_graph",
"load_graph_from_csv", "VertexPropertyMap", "EdgePropertyMap",
"GraphPropertyMap", "PropertyMap", "PropertyArray",
"group_vector_property", "ungroup_vector_property",
"map_property_values", "infect_vertex_property",
"edge_endpoint_property", "incident_edges_op", "perfect_prop_hash",
"seed_rng", "show_config", "openmp_enabled",
"openmp_get_num_threads", "openmp_set_num_threads",
"openmp_get_schedule", "openmp_set_schedule", "__author__",
"__copyright__", "__URL__", "__version__"]
......@@ -1560,8 +1562,8 @@ class PropertyDict(object):
from .libgraph_tool_core import Vertex, EdgeBase, Vector_bool, Vector_int16_t, \
Vector_int32_t, Vector_int64_t, Vector_double, Vector_long_double, \
Vector_string, Vector_size_t, new_vertex_property, new_edge_property, \
new_graph_property
Vector_string, Vector_size_t, Vector_cdouble, new_vertex_property, \
new_edge_property, new_graph_property
class Graph(object):
......@@ -3744,7 +3746,7 @@ def _vt_init(self, n=None, init=None):
_vt_setstate(self, init)
vector_types = [Vector_bool, Vector_int16_t, Vector_int32_t, Vector_int64_t,
Vector_double, Vector_long_double, Vector_size_t]
Vector_double, Vector_long_double, Vector_size_t, Vector_cdouble]
for vt in vector_types:
if not hasattr(vt, "__base_init__"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment