News for hackers. Stuff that matters.
Re:Ask HN: Most interesting tech you built for just yourself? by AlexVN on Sunday April 30, 2023 @03:27PM (#35765812)
I came up with a lot of small custom algorithms for my thesis, all based on np.einsum. I had to estimate the assymptotic complexity for them, and every time I would get a different answer than the last. So at some point I built a system to which you give an einsum expression and a mapping between axis and their names and you get the assymptotic complexity (e.g. for MxN times NxM matrix multiplication 'ij,jk->ik' you would use {'i': 'M', 'j': 'N', 'k': 'M'} to get O(M^2 N) complexity). It also supports chains of einsum expressions, summing the complexities together and symbolically simplifying. And it uses opt_einsum to reorder the operations to get the best possible asymptotics for an expression.

There are no comments on this comment yet.