Skip to content
Snippets Groups Projects
Commit 79fc83d4 authored by dbulavka's avatar dbulavka
Browse files

Initial commit

parent f86a88a9
No related branches found
No related tags found
No related merge requests found
# volume_rigidity
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.kam.mff.cuni.cz/bulavkad/volume_rigidity.git
git branch -M master
git push -uf origin master
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.kam.mff.cuni.cz/bulavkad/volume_rigidity/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
Volume rigidity matrix:
volume_rigidity_matroid.py:
get_volume_rigidity_matrix(V,H,p,d)
is_volume_rigid(V,H,p,d)
example_1.py verifies if one specific triangulation is volume rigid.
example_2.py verifies if all irreducible triangulations of the torus are volume rigid.
example_3.py verifies if all irreducible triangulations of the projective plane are volume rigid.
example_4.py verifies if all irreducible triangulations of the Klein bottle are volume rigid.
\ No newline at end of file
import volume_rigidity_matroid
import numpy as np
#triangulation
triangulation = [[1,4,6],[1,2,6],[2,6,7],[2,3,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[1,3,8],[1,4,8]]
n = 0
for F in triangulation:
d = len(F) #the vertices are embedded in R^{d-1}, in our case in R^2
n = max(max(F),n)
H = set([tuple([s[0]-1,s[1]-1,s[2]-1]) for s in triangulation]) #we need to shift the vertices by 1
V = range(n) #the set of vertices is 0,...,7
#build the vertex embedding
num_rows = d-1
num_columns = n
low = 1
high = 10000
p = np.random.randint(low, high, (num_rows, num_columns))
p = np.vstack([p, np.ones((1,n), dtype=int)])
#vertify if the triangulation is volume rigid
print(volume_rigidity_matroid.is_volume_rigid(V,H,p,d))
#process if all the minimal triangulations of the torus are volume rigid
import volume_rigidity_matroid
import numpy as np
def is_triangulation_volume_rigid(triangulation):
n=0
for F in triangulation:
d = len(F) #the vertices are embedded in R^{d-1}, in our case in R^2
n = max(max(F),n)
H = set([tuple([s[0]-1,s[1]-1,s[2]-1]) for s in triangulation]) #we need to shift the vertices by 1
V = range(n) #the set of vertices is 0,...,7
#build the vertex embedding
num_rows = d-1
num_columns = n
low = 1
high = 10000
p = np.random.randint(low, high, (num_rows, num_columns))
p = np.vstack([p, np.ones((1,n), dtype=int)])
#vertify if the triangulation is volume rigid
return volume_rigidity_matroid.is_volume_rigid(V,H,p,d)
def main():
triangulations=[
[[1,2,4],[2,3,5],[2,4,5],[1,3,4],[3,4,6],[3,5,6],[4,6,7],[4,5,7],[1,5,7],[1,3,7],[2,3,7],[2,6,7],[1,2,6],[1,5,6]],
[[1,2,4],[2,5,6],[2,4,5],[2,3,6],[1,3,4],[3,4,6],[4,6,8],[4,5,8],[6,7,8],[5,6,7],[1,5,8],[3,7,8],[1,3,8],[2,3,7],[1,2,7],[1,5,7]],
[[1,2,4],[2,4,6],[2,3,6],[1,3,4],[3,6,8],[3,4,8],[4,5,8],[4,6,7],[4,5,7],[6,7,8],[1,5,7],[1,2,7],[2,7,8],[2,5,8],[2,3,5],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[1,3,4],[3,4,8],[3,6,7],[3,7,8],[4,5,6],[5,6,7],[4,5,8],[1,5,7],[1,2,7],[2,7,8],[2,5,8],[1,3,5],[2,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[1,3,4],[3,6,7],[3,4,7],[4,5,6],[5,6,7],[4,7,8],[4,5,8],[1,3,5],[3,5,8],[2,3,8],[2,7,8],[2,5,7],[1,2,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[1,3,7],[1,4,7],[4,5,6],[4,6,8],[6,8,9],[6,7,9],[5,7,9],[4,5,7],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[1,3,7],[1,4,7],[4,5,6],[5,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,9],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,5,9],[1,3,5]],
[[1,2,3],[2,4,6],[2,3,6],[3,6,7],[1,3,4],[3,4,7],[4,6,8],[4,5,8],[6,7,8],[7,8,9],[4,7,9],[4,5,9],[1,5,8],[1,2,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[3,4,7],[1,3,4],[4,5,8],[4,6,8],[6,8,9],[6,7,9],[4,7,9],[4,5,9],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,9],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,8],[4,6,8],[6,8,9],[6,7,9],[5,7,9],[4,5,7],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,8,9],[6,7,9],[4,7,9],[4,5,9],[1,2,5],[2,5,8],[2,8,9],[2,3,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,8,9],[6,7,9],[4,7,9],[4,5,9],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,8,9],[6,7,9],[4,7,9],[4,5,9],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,9],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,7,8],[7,8,9],[5,7,9],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,8,9],[6,7,9],[5,7,9],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[3,4,7],[1,3,4],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,8,9],[4,5,9],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[3,4,7],[1,3,4],[4,5,6],[5,6,7],[5,7,8],[4,7,8],[4,8,9],[4,5,9],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,4,7],[1,3,4],[4,5,6],[5,6,7],[5,7,8],[4,7,8],[4,8,9],[4,5,9],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,5,9],[1,3,5]],
[[1,2,4],[2,4,6],[2,6,10],[2,7,10],[2,3,7],[3,4,7],[1,3,4],[4,5,6],[5,6,10],[4,7,10],[5,9,10],[4,8,10],[4,5,8],[3,8,10],[3,9,10],[3,5,8],[1,3,5],[2,3,9],[2,5,9],[1,2,5]]
]
for triangulation in triangulations:
print(is_triangulation_volume_rigid(triangulation))
if __name__ == "__main__":
main()
#process if all the minimal triangulations of the projective plane are volume rigid
import volume_rigidity_matroid
import numpy as np
def is_triangulation_volume_rigid(triangulation):
n=0
for F in triangulation:
d = len(F) #the vertices are embedded in R^{d-1}, in our case in R^2
n = max(max(F),n)
H = set([tuple([s[0]-1,s[1]-1,s[2]-1]) for s in triangulation]) #we need to shift the vertices by 1
V = range(n) #the set of vertices is 0,...,7
#build the vertex embedding
num_rows = d-1
num_columns = n
low = 1
high = 10000
p = np.random.randint(low, high, (num_rows, num_columns))
p = np.vstack([p, np.ones((1,n), dtype=int)])
#vertify if the triangulation is volume rigid
return volume_rigidity_matroid.is_volume_rigid(V,H,p,d)
def main():
triangulations=[
[[1,2,4],[1,3,4],[2,4,5],[2,3,5],[1,3,5],[1,5,6],[1,2,6],[2,3,6],[3,4,6],[4,5,6]],
[[1,2,4],[1,3,4],[2,4,5],[2,3,5],[1,3,6],[1,2,6],[2,6,7],[2,3,7],[3,4,7],[4,6,7],[4,5,6],[3,5,6]]
]
for triangulation in triangulations:
print(is_triangulation_volume_rigid(triangulation))
if __name__ == "__main__":
main()
#process if all the minimal triangulations of the Klein bottle are volume rigid
import volume_rigidity_matroid
import numpy as np
def is_triangulation_volume_rigid(triangulation):
n=0
for F in triangulation:
d = len(F) #the vertices are embedded in R^{d-1}, in our case in R^2
n = max(max(F),n)
H = set([tuple([s[0]-1,s[1]-1,s[2]-1]) for s in triangulation]) #we need to shift the vertices by 1
V = range(n) #the set of vertices is 0,...,7
#build the vertex embedding
num_rows = d-1
num_columns = n
low = 1
high = 10000
p = np.random.randint(low, high, (num_rows, num_columns))
p = np.vstack([p, np.ones((1,n), dtype=int)])
#vertify if the triangulation is volume rigid
return volume_rigidity_matroid.is_volume_rigid(V,H,p,d)
def main():
triangulations=[
[[1,4,6],[1,2,6],[2,6,7],[2,3,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[1,3,8],[1,4,8]],
[[1,4,6],[1,2,6],[2,3,6],[3,6,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[1,3,8],[1,4,8]],
[[1,2,4],[2,3,4],[3,4,6],[3,6,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[1,3,8],[1,4,8]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[1,3,7],[1,5,7],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,4,8],[1,3,4]],
[[1,4,6],[1,2,6],[2,3,6],[3,6,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,4,8],[1,3,4]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,4,8],[1,3,4]],
[[1,4,6],[1,2,6],[2,3,6],[3,5,6],[1,3,5],[4,5,7],[4,6,7],[6,7,9],[5,7,9],[6,8,9],[5,6,8],[4,5,8],[4,8,9],[1,2,5],[2,5,9],[2,3,9],[1,3,9],[1,4,9]],
[[1,4,6],[1,2,6],[2,3,6],[3,6,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[4,7,8],[4,5,7],[1,2,5],[2,5,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,3,6],[3,5,6],[1,3,5],[4,6,7],[4,5,7],[5,7,9],[6,7,9],[6,8,9],[5,6,8],[4,8,9],[4,5,8],[1,2,5],[2,5,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,4,6],[1,2,6],[2,3,6],[3,5,6],[1,3,5],[4,6,7],[6,7,8],[5,6,8],[4,5,7],[5,7,9],[7,8,9],[4,5,8],[4,8,9],[1,2,5],[2,5,9],[2,3,9],[1,3,9],[1,4,9]],
[[1,2,4],[2,4,6],[2,3,6],[3,5,6],[1,3,5],[4,5,7],[4,6,7],[5,7,9],[6,7,8],[7,8,9],[5,6,8],[4,8,9],[4,5,8],[1,2,5],[2,5,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,3,4],[3,4,6],[3,6,7],[3,5,7],[1,3,5],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,5,8],[1,2,8],[2,3,8],[3,8,9],[1,3,9],[1,4,9]],
[[1,2,4],[2,3,4],[3,4,6],[3,6,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,5,8],[1,2,8],[2,3,8],[3,8,9],[1,3,9],[1,4,9]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[1,3,7],[1,5,7],[4,5,6],[5,6,8],[6,7,8],[7,8,9],[5,7,9],[4,5,9],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,5,7],[1,3,5],[4,5,6],[5,6,8],[6,7,8],[7,8,9],[5,7,9],[4,5,9],[1,2,5],[2,5,8],[2,8,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,5,8],[1,2,8],[2,3,8],[3,8,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[3,5,7],[1,3,5],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[3,5,7],[1,3,5],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,5,8],[1,2,8],[2,3,8],[3,8,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,2,5],[2,5,8],[2,8,9],[2,3,9],[1,3,9],[1,4,9]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,2,5],[2,5,8],[2,8,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,6,7],[2,3,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[1,3,9],[1,4,9]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[3,5,7],[1,3,5],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,2,5],[2,5,8],[2,3,8],[3,8,9],[1,3,9],[1,4,9]],
[[1,2,4],[2,4,6],[2,3,6],[3,6,7],[1,3,7],[1,5,7],[4,5,8],[4,6,8],[6,7,8],[7,8,9],[4,7,9],[4,5,7],[1,5,8],[1,2,8],[2,8,9],[2,3,9],[3,4,9],[1,3,4]],
[[1,2,6],[1,4,6],[2,6,7],[4,6,7],[2,3,7],[1,3,7],[1,5,7],[4,7,8],[4,5,8],[5,8,9],[7,8,9],[7,9,10],[5,7,10],[4,5,10],[4,9,10],[1,5,9],[1,2,9],[2,4,9],[2,3,4],[1,3,4]]
]
for triangulation in triangulations:
print(is_triangulation_volume_rigid(triangulation))
if __name__ == "__main__":
main()
import numpy as np
from itertools import combinations
def get_matrix_minor(M,i,j):
minor = M[:]
minor = np.delete(minor, (i),axis=0) # deletes i-th row
minor = np.delete(minor, (j),axis=1) #deletes j-th column
return minor
#The function volume_rigidity_matrix computes the volume-rigidity matrix as defined in the article arXiv:2211.00574
#input:
# d: cardinality of members of H
# V: set of vertices
# p: vertex embedding of the vertices in R^{d-1} and a final row of 1's
# H: the hypergraph as set of tuples of size d
def get_volume_rigidity_matrix(V,H,p,d):
volume_rigidity_matrix = np.empty(((d-1)*len(V), 0),dtype=int) #create an empty matrix with d*len(V) rows and 0 columns.
for F in H: # we build column vectors
selected_rows = range(d)
selected_columns = F
M_F = p[np.ix_(selected_rows, selected_columns)] #select columns of p corresponding to vertices of F
column_vector_F = np.empty(0, dtype=int)
for v in V: # we build
for i in range(d-1):
if v not in F:
column_vector_F = np.append(column_vector_F,[0]) #add 0 d times for each vector not in F
if v in F:
index_i = i
index_v = F.index(v) #position of v in F
minor_F_i_v = ((-1)**(index_i+index_v))*np.linalg.det(get_matrix_minor(M_F,index_i,index_v))
column_vector_F = np.append(column_vector_F, minor_F_i_v)
volume_rigidity_matrix = np.c_[volume_rigidity_matrix, column_vector_F]
return volume_rigidity_matrix
def is_volume_rigid(V,H,p,d):
volume_rigidity_matrix = get_volume_rigidity_matrix(V,H,p,d)
return np.linalg.matrix_rank(volume_rigidity_matrix) == (d-1)*len(V)-(d*d-d-1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment