[SciPy-user] howto dot(a, b.T), some a or b coords are zeros
Alan G Isaac
aisaac at american.edu
Thu Jan 3 09:36:13 EST 2008
On Thu, 03 Jan 2008, dmitrey apparently wrote:
> here's a part of ralg code:
> B is n x n matrix, g, g1, g2 are n x 1 vectors, w is real number
> ###################
> for i in xrange(p.maxIter):
> ...
> g2 = dot(B, g)
> g1 = dot(B, g2)
> ...
> g2 = <getting vector with possible lots of zeros>
> g1 = <some func from g2, with possible lots of zeros>
> g = dot(B, g1)
> B += dot(dot(B,g), g*w) <- here I intend to get some economy
> g = g2.copy()
> ###################
> For some initial iterations, when initial point is infeasible and max
> constraint derivative depends on some coords only (or feasible + objfun
> depends on some coords only), dot(B, g1) has lots of zeros (for example,
> n-1 zeros for box-bound constraints), as well as dot(B, g) or g*w.
> This cases are especially important to ralg-based solver nssolve.
Well when g1 has lots of zeros, you can index the nonzeros
to shorten the computation, as I showed you last time.
In the case you mention, this would be huge.
You have in effect
B = B + w*(B*(B*g1))*(g1.T *B.T)
so exploiting the symmetry of g*g.T would imply other costs.
Cheers,
Alan Isaac
More information about the SciPy-User
mailing list