tschijnmo / drudge Goto Github PK
View Code? Open in Web Editor NEWCAS based on sympy focusing on tensor and noncommutative algebras
Home Page: https://tschijnmo.github.io/drudge
License: MIT License
CAS based on sympy focusing on tensor and noncommutative algebras
Home Page: https://tschijnmo.github.io/drudge
License: MIT License
Two tests in nuclear_test.py
and one in spin_one_half_test.py
fail due to updates in the latest version of SymPy.
Searching for drudge
gives results
$ pip search drudge
drudge (0.1.0.dev0) - # drudge
drudge_parser (3.0.2) - Naive parser for the Drudge Report
unfortunately it is not possible to install it
$ pip install drudge
Collecting drudge
Could not find a version that satisfies the requirement drudge (from versions: )
No matching distribution found for drudge
my environment
$ python --version
Python 3.7.0
$ pip --version
pip 19.0.1 from /Users/username/snakepit/virtualenvs/mypy3.7/lib/python3.7/site-packages/pip (python 3.7)
I suspect it's because there's a dev0
in the release name, could that be the case? If yes would you @tschijnmo consider publishing a new release without dev0
in the tag so that pip
can install it?
When a factor of the amplitude of a term is raised to a power, the LaTeX output given by Tensor.display() contains double superscripts, which cannot be properly displayed in a Jupyter notebook. It seems that this could be fixed by modifying the ScalarLatexPrinter class in report.py.
Trying this code:
from sympy import IndexedBase, symbols
from drudge import Range, SpinOneHalfPartHoleDrudge
conf = SparkConf().setAppName('test')
ctx = SparkContext(conf=conf)
dr = SpinOneHalfPartHoleDrudge(ctx)
i,j,k,m = symbols('i j k m')
p = IndexedBase('p')
q = IndexedBase('q')
r = IndexedBase('r')
aux = Range('Aux')
expr = dr.sum((m, aux), p[i,m] * q[j,m] * r[k,m])
expr.diff(p[i,m])
Get:
('Invalid index', i, 'clashing with existing free symbols')
Is it possible to add a behaviour (may be with a parameter and a list of additional externals), so an additional delta will be inserted, and we will get something like
sum((m,aux), delta[i,i0] * delta[m0,m] * q[j,m] * r[k,m])
as a result?
The current version of Drudge uses Spark (PySpark) for parallelism. Despite the computational speed-up it brings, the dependence on Spark adds an extra layer of complexity for developing, maintaining, and using Drudge. Typically encountered during Drudge development is that the program crashes inside some Spark code while throwing some Scala/Java error message, which is hard to understand for a Python developer. Our current workaround is to use dummy_spark
for debugging and pyspark
for production. However, this two-step approach turns out to be difficult for large-scale problems. Moreover, a non-Python library complicates the deployment.
An alternative to Spark is the Dask library. Dask is implemented in pure Python and integrates well with other scientific/numeric/HPC Python libraries. It works on single workstations as well as clusters. Having a Dask backend makes it easier to debug and profile Drudge codes without sacrificing performance. For implementation, Dask collections such as dask.bag
(as a replacement for Spark RDD) or dask.delayed
may be a good place to start.
Gaurav and I have talked about switching from Spark to Dask. We may start experimenting when time allows.
When an instance of GenQuadLatticeDrudge
is initialized with assume_comm=True
, the commutator of two vectors in the order
tuple will fail to simplify if the commutation is not specified in comms
. The program will abort in Line 411 of genquad.py. I think the bug lies in Line 394 of genquad.py, where comm
need to be assigned a list of terms rather than a Sympy integer. I'll try to fix it.
When I tried to run the following simple script by python xxx.py
for sanity check
from pyspark import SparkContext
from drudge import PartHoleDrudge
ctx = SparkContext()
dr = PartHoleDrudge(ctx)
which is taken from the conf_ph.py
from the tutorial. I got error msg:
Traceback (most recent call last):
File "test.py", line 5, in <module>
dr = PartHoleDrudge(ctx)
File "/Users/hzye/local/opt/miniconda/envs/frank/lib/python3.6/site-packages/drudge-0.10.0.dev0-py3.6-macosx-10.7-x86_64.egg/drudge/fock.py", line 816, in __init__
**kwargs)
File "/Users/hzye/local/opt/miniconda/envs/frank/lib/python3.6/site-packages/drudge-0.10.0.dev0-py3.6-macosx-10.7-x86_64.egg/drudge/fock.py", line 750, in __init__
orig_ham = (one_body_ham + two_body_ham).reset_dumms()
File "/Users/hzye/local/opt/miniconda/envs/frank/lib/python3.6/site-packages/drudge-0.10.0.dev0-py3.6-macosx-10.7-x86_64.egg/drudge/drudge.py", line 417, in reset_dumms
free_vars = self.free_vars
File "/Users/hzye/local/opt/miniconda/envs/frank/lib/python3.6/site-packages/drudge-0.10.0.dev0-py3.6-macosx-10.7-x86_64.egg/drudge/drudge.py", line 211, in free_vars
self._free_vars = self._get_free_vars(self._terms)
File "/Users/hzye/local/opt/miniconda/envs/frank/lib/python3.6/site-packages/drudge-0.10.0.dev0-py3.6-macosx-10.7-x86_64.egg/drudge/drudge.py", line 224, in _get_free_vars
).aggregate(set(), _union, _union)
File "/Users/hzye/local/opt/miniconda/envs/frank/lib/python3.6/site-packages/dummy_spark/rdd.py", line 304, in aggregate
raise NotImplementedError
NotImplementedError
I checked the source code rdd.py
from dummy_spark
, and it seems that the function aggregate
is indeed not implemented therein but being called by drudge.py
. Does anyone know how this could be resolved?
Thanks in advance!
It will be great to have a method to extract a list of indexed bases of the hamiltonian
directly without going to it's components or other properties
utils.h loads a sparkcontext which gives an error on systems where pyspark is not installed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.