Re: [sage-support] Circulant matrix
Le vendredi 15 mars 2013 02:15:35 UTC+1, David Joyner a écrit : Is this what you want? http://www.sagemath.org/doc/reference/sage/combinat/matrices/latin.html Not exactly : a call back_circulant(n) returns the circulant matrix associated to the list range(n). I need a more general function. Maple achieves this by passing an option to the Matrix constructor, for instance Matrix(3, shape=Circulant[[42, 20, 13]]) returns the circulant matrix with first line [42, 20, 13]. Circulant matrix is so classic that I'm surprised not to find it in Sage. -- 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.
Re: [sage-support] Circulant matrix
On Mar 15, 2013, at 8:07 AM, pascal wrote: Not exactly : a call back_circulant(n) returns the circulant matrix associated to the list range(n). I need a more general function. Maple achieves this by passing an option to the Matrix constructor, for instance Matrix(3, shape=Circulant[[42, 20, 13]]) returns the circulant matrix with first line [42, 20, 13]. Circulant matrix is so classic that I'm surprised not to find it in Sage. So am I. However, it's in the pipeline (http://trac.sagemath.org/sage_trac/ticket/13703) --- Charles Bouillaguet http://www.lifl.fr/~bouillaguet/ -- 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.
Re: [sage-support] Circulant matrix
Le vendredi 15 mars 2013 08:44:21 UTC+1, Charles Bouillaguet a écrit : So am I. However, it's in the pipeline ( http://trac.sagemath.org/sage_trac/ticket/13703) Thanks for the link. The code for circulant matrix generation : def hankel(R,c,r): entries=c+r[1:]; return matrix(R, len(c), len(r), lambda i,j: entries[i+j]) def circulant(R,E): return hankel(R, E, E[-1:]+E[:-1]) doesn't return the _usual_ circulant matrix (as a result of successive right shifts) but rather a skew-circulant matrix : # --- def hankel(R,c,r): entries=c+r[1:]; return matrix(R, len(c), len(r), lambda i,j: entries[i+j]) def circulant(R,E): return hankel(R, E, E[-1:]+E[:-1]) R=ZZ E=[42, 20, 13, 55] print print circulant(R, E) # --- outputing : [42 20 13 55] [20 13 55 42] [13 55 42 20] [55 42 20 13] In fact, a circulant matrix is a special case of a Toeplitz matrix (not a Hankel Matrix). The correct code should look like this : # --- def toeplitz(R, c,r): return matrix(R,len(c), len(r), lambda i,j: c[i-j] if i=j else r[j-i]) def circulant(R, E): return toeplitz(R, E[0:1]+E[-1:0:-1], E) def hankel(R, c,r): entries=c+r[1:]; return matrix(R,len(c), len(r), lambda i,j: entries[i+j]) def skew_circulant(R,E): return hankel(R, E, E[-1:]+E[:-1]) R=ZZ E=[42, 20, 13, 55] print print circulant(R, E) print print skew_circulant(R, E) # --- # -output -- [42 20 13 55] [55 42 20 13] [13 55 42 20] [20 13 55 42] [42 20 13 55] [20 13 55 42] [13 55 42 20] [55 42 20 13] # --- -- 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.
Re: [sage-support] Circulant matrix
On Thu, Mar 14, 2013 at 9:10 PM, pascal pascal.or...@gmail.com wrote: Does Sage provide support for building the circulant matrix associated to a given list ? Is this what you want? http://www.sagemath.org/doc/reference/sage/combinat/matrices/latin.html -- 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. -- 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.