微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

d维圆环的实现

如何解决d维圆环的实现

我需要创建一个称为 d 维环面的拓扑对象,d >= 2。例如,对边相等的正方形是一个二维环面。对于维度 3,立方体的对角和对面都是等效的。我请求帮助能够表示 d 维环面,以便使用 GUDHI 包计算同源性。谢谢!

解决方法

取自“持久同源性练习”部分中的 this tutorial 的另一个解决方案:

import gudhi as gd
#Here is our triangulation:
#   0-----3-----4-----0
#   | \   | \   | \   | \   |
#   |   \ |   \ |    \|   \ | 
#   1-----8-----7-----1
#   | \   | \   | \   | \   |
#   |   \ |   \ |   \ |   \ |
#   2-----5-----6-----2
#   | \   | \   | \   | \   |
#   |   \ |   \ |   \ |   \ |
#   0-----3-----4-----0
st = gd.SimplexTree()
st.insert([0,1,8])
st.insert([0,3,8])
st.insert([3,7,4,7])
st.insert([1,7])
st.insert([0,4])
st.insert([1,2,5])
st.insert([1,5,8])
st.insert([5,6,8])
st.insert([6,8])
st.insert([2,3])
st.insert([2,5])
st.insert([3,5])
st.insert([4,6])
st.insert([0,6])
# Compute persistence,then Betti numbers
st.persistence(persistence_dim_max=True)
st.betti_numbers()
# Returns [1,1]

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。