On 3/30/13 6:34 AM, Gary McConnell wrote:
Hi Jason - thanks a lot - I have attached a text file which is just a
cleaned-up version of my code, with some explanations at the top for
functions whose details are not relevant to the question. Apologies -
you'll see it's a "neat mess", so to speak ....
So to summarize your code, you're finding M=3 sets of d=3 mutually
orthogonal vectors so that each pair of sets satisfies some criteria
(your XRY function)? Do the sets have to be mutually exclusive? Your
code doesn't enforce this, but your xRy function may imply it. Also, if
you have an isotropic vector v (orthogonal to itself), then I suppose
your code allows the set [v,v,v]. Is that what you want?
Here's an example of how to rethink at least part of the problem:
finding a set of d distinct mutually orthogonal vectors:
N = set(N1) # copy N so we can modify it
for v in N:
base1 = [v]
N.remove(v) # we already have v
for w in N:
if all(w*vv==0 for vv in set1):
base1.append(w)
N.remove(w)
if len(base1)==d:
break
else:
# we went all the way through N, but didn't find enough vectors
raise ValueError("couldn't find enough mutually orthogonal
vectors")
Thanks,
Jason
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.