question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mv.inv is very slow

See original GitHub issue

Hi,

Here’s another slow snippet (291s) :

from galgebra.ga import Ga
from sympy import Symbol

GA, e_0, e_1, e_2, e_3 = Ga.build("e*0|1|2|3", g='-1 0 0 0, 0 1 0 0, 0 0 1 0, 0 0 0 1')

e_0_inv = e_0.inv()
p = GA.mv((1, Symbol('p1'), Symbol('p2'), Symbol('p3')), 'vector')
q = GA.mv((0, Symbol('q1'), Symbol('q2'), Symbol('q3')), 'vector')
r = GA.mv((0, Symbol('r1'), Symbol('r2'), Symbol('r3')), 'vector')
A = q ^ r
X = (p ^ A)                                 # A plane
d = (e_0_inv < (e_0 ^ X)) / (e_0_inv < X)   # Support vector from plane

Very slow : d_inv = d.inv()

d doesn’t seem to complex : (p1*q2**2*r3**2 - 2*p1*q2*q3*r2*r3 + p1*q3**2*r2**2 - p2*q1*q2*r3**2 + p2*q1*q3*r2*r3 + p2*q2*q3*r1*r3 - p2*q3**2*r1*r2 + p3*q1*q2*r2*r3 - p3*q1*q3*r2**2 - p3*q2**2*r1*r3 + p3*q2*q3*r1*r2)*e_1/(q1**2*r2**2 + q1**2*r3**2 - 2*q1*q2*r1*r2 - 2*q1*q3*r1*r3 + q2**2*r1**2 + q2**2*r3**2 - 2*q2*q3*r2*r3 + q3**2*r1**2 + q3**2*r2**2) + (-p1*q1*q2*r3**2 + p1*q1*q3*r2*r3 + p1*q2*q3*r1*r3 - p1*q3**2*r1*r2 + p2*q1**2*r3**2 - 2*p2*q1*q3*r1*r3 + p2*q3**2*r1**2 - p3*q1**2*r2*r3 + p3*q1*q2*r1*r3 + p3*q1*q3*r1*r2 - p3*q2*q3*r1**2)*e_2/(q1**2*r2**2 + q1**2*r3**2 - 2*q1*q2*r1*r2 - 2*q1*q3*r1*r3 + q2**2*r1**2 + q2**2*r3**2 - 2*q2*q3*r2*r3 + q3**2*r1**2 + q3**2*r2**2) + (p1*q1*q2*r2*r3 - p1*q1*q3*r2**2 - p1*q2**2*r1*r3 + p1*q2*q3*r1*r2 - p2*q1**2*r2*r3 + p2*q1*q2*r1*r3 + p2*q1*q3*r1*r2 - p2*q2*q3*r1**2 + p3*q1**2*r2**2 - 2*p3*q1*q2*r1*r2 + p3*q2**2*r1**2)*e_3/(q1**2*r2**2 + q1**2*r3**2 - 2*q1*q2*r1*r2 - 2*q1*q3*r1*r3 + q2**2*r1**2 + q2**2*r3**2 - 2*q2*q3*r2*r3 + q3**2*r1**2 + q3**2*r2**2)

d_inv will be used later for computing the dual of X. I can provide more information if that matters.

Regards

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Oct 13, 2019

The following is not slow for me - ’ from galgebra.ga import Ga from sympy import Symbol from galgebra.printer import Format, xtex Format() GA, e_0, e_1, e_2, e_3 = Ga.build(“e*0|1|2|3”, g=‘-1 0 0 0, 0 1 0 0, 0 0 1 0, 0 0 0 1’)

e_0_inv = e_0.inv()

print(‘e_0^{-1} =’, e_0_inv)

p = GA.mv((1, Symbol(‘p1’), Symbol(‘p2’), Symbol(‘p3’)), ‘vector’) q = GA.mv((0, Symbol(‘q1’), Symbol(‘q2’), Symbol(‘q3’)), ‘vector’) r = GA.mv((0, Symbol(‘r1’), Symbol(‘r2’), Symbol(‘r3’)), ‘vector’) print(‘p =’,p) print(‘q =’,q) print(‘r =’,r)

A = q ^ r X = (p ^ A) # A plane

print(r’q\W r = A =‘,A) print(r’p\W A = X =’,X)

D = e_0_inv<X

print(r’e_0^{-1}\lfloor X = D =‘, e_0_inv<X) #Dinv = D.rev()/(DD.rev()).scalar() Dinv = D.inv() print(‘D^{-1} =’, Dinv.Fmt(3)) print(‘DD^{-1} =’, DDinv) N = e_0_inv < (e_0 ^ X) print(r’e_0^{-1}\lfloor (e_0\W X) = N’, N)

d = (e_0_inv < (e_0 ^ X)) * Dinv # Support vector from plane

print(r’(e_0^{-1}\lfloor (e_0\W X)) D^{-1} =',d.Fmt(3))

print(‘N/D =’,N/D) xtex()

’ Output is attached - newslow.pdf

0reactions
meunscommented, Dec 2, 2019

We can close this issue. galgebra isn’t designed to make geometric proof but calculus. If I want to achieve some kind of proofs, I need to reduce the expression lenght myself by fixing things, ignoring norms if useless, using the right basis… 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to join our server and MV-Iventories is mentioned in the error ...
Either some corruption or slow I/O performance. While there is mv-inv mentioned, there are also other instance of the lag happening at other...
Read more >
Multiverse/EssentialsSpawn/MultiInv respawn on death trouble
So far so good, but then they use /back to get to their death place in the other world but MultiInv is kinda...
Read more >
20 seconds to load 30k rows from Hibernate, Is it slow?
At first, I have to make a disclaimer that Hibernate performance depends on many different factors and it is hard to give an...
Read more >
Multiverse-Inventories - Bukkit Plugins - Minecraft - CurseForge
Sorry to say this, but for some reason Per World Inventory is clunky and slow and apparently it isn't being tested thoroughly either....
Read more >
MV and LV Residential Grid Impact of Combined Slow ... - MDPI
This article investigates the combined low voltage (LV) and medium voltage (MV) residential grid impact for slow and fast electric vehicle (EV) charging, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found