This is used to profile https://github.com/pygae/galgebra/issues/41 .
The following code uses https://github.com/pygae/galgebra/tree/new_printer .
In [1]:
!pip install pyprof2calltree
In [2]:
!brew install qcachegrind
In [3]:
%%writefile test_41.py
from galgebra.ga import Ga
GA = Ga('e*1|2|3')
a = GA.mv('a', 'vector')
b = GA.mv('b', 'vector')
c = GA.mv('c', 'vector')
def cross(x, y):
return (x ^ y).dual()
xx = cross(a, cross(b, c))
In [4]:
!python -m cProfile -o test_41.cprof test_41.py
In [5]:
!python -m pyprof2calltree -i test_41.cprof -k
With View options set to:
The profiling result is like:
In [6]:
%%writefile test_41.py
from galgebra.ga import Ga
GA = Ga('e*1|2|3', norm=False)
a = GA.mv('a', 'vector')
b = GA.mv('b', 'vector')
c = GA.mv('c', 'vector')
def cross(x, y):
return (x ^ y).dual()
xx = cross(a, cross(b, c))
In [7]:
!python -m cProfile -o test_41.cprof test_41.py
In [8]:
!python -m pyprof2calltree -i test_41.cprof -k
In [14]:
from galgebra.ga import Ga
GA = Ga('e*1|2|3')
a = GA.mv('a', 'vector')
b = GA.mv('b', 'vector')
c = GA.mv('c', 'vector')
def cross(x, y):
return (x ^ y).dual()
xx = cross(a, cross(b, c))
xx
Out[14]:
In [15]:
GA.E()
Out[15]:
In [16]:
GA.I()
Out[16]:
In [12]:
from galgebra.ga import Ga
GA = Ga('e*1|2|3', norm=False)
a = GA.mv('a', 'vector')
b = GA.mv('b', 'vector')
c = GA.mv('c', 'vector')
def cross(x, y):
return (x ^ y).dual()
xx = cross(a, cross(b, c))
xx
Out[12]:
In [11]:
GA.E()
Out[11]:
In [17]:
GA.I()
Out[17]:
In [ ]: