def c8vec_unity_test ( ): #*****************************************************************************80 # ## C8VEC_UNITY_TEST tests C8VEC_UNITY. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # from c8vec_print import c8vec_print print '' print 'C8VEC_UNITY_TEST' print ' C8VEC_UNITY returns the N roots of unity.' n = 12 x = c8vec_unity ( n ) c8vec_print ( n, x, ' The N roots of unity:' ) print '' print 'C8VEC_UNITY_TEST:' print ' Normal end of execution.' return
def c8vec_sort_a_l2_test(): #*****************************************************************************80 # ## C8VEC_SORT_A_L2_TEST tests C8VEC_SORT_A_L2; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 28 March 2015 # # Author: # # John Burkardt # from c8_norm_l2 import c8_norm_l2 from c8vec_print import c8vec_print from c8vec_uniform_01 import c8vec_uniform_01 print '' print 'C8VEC_SORT_A_L2_TEST' print ' C8VEC_SORT_A_L2 sorts a C8VEC by L2 norm.' n = 10 seed = 123456789 a, seed = c8vec_uniform_01(n, seed) c8vec_print(n, a, ' The unsorted vector:') a = c8vec_sort_a_l2(n, a) print '' print ' I A(I) ||A(I)||' print '' for i in range(0, n): print ' %2d (%14.6g,%14.6g) %14.6g' \ % ( i, a.real[i], a.imag[i], c8_norm_l2 ( a[i] ) ) print '' print 'C8VEC_SORT_A_L2_TEST:' print ' Normal end of execution.' return
def c8vec_sort_a_li_test ( ): #*****************************************************************************80 # ## C8VEC_SORT_A_LI_TEST tests C8VEC_SORT_A_LI; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 28 March 2015 # # Author: # # John Burkardt # from c8_norm_li import c8_norm_li from c8vec_print import c8vec_print from c8vec_uniform_01 import c8vec_uniform_01 print '' print 'C8VEC_SORT_A_LI_TEST' print ' C8VEC_SORT_A_LI sorts a C8VEC by Loo norm.' n = 10 seed = 123456789 a, seed = c8vec_uniform_01 ( n, seed ) c8vec_print ( n, a, ' The unsorted vector:' ) a = c8vec_sort_a_li ( n, a ) print '' print ' I A(I) ||A(I)||' print '' for i in range ( 0, n ): print ' %2d (%14.6g,%14.6g) %14.6g' \ % ( i, a.real[i], a.imag[i], c8_norm_li ( a[i] ) ) print '' print 'C8VEC_SORT_A_LI_TEST:' print ' Normal end of execution.' return
def c8vec_nint_test ( ): #*****************************************************************************80 # ## C8VEC_NINT_TEST tests C8VEC_NINT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 28 February 2015 # # Author: # # John Burkardt # from c8vec_print import c8vec_print from c8vec_uniform_01 import c8vec_uniform_01 print '' print 'C8VEC_NINT_TEST' print ' C8VEC_NINT rounds a C8VEC.' n = 5 seed = 123456789 [ c, seed ] = c8vec_uniform_01 ( n, seed ) s = 5.0 + 3.0j for i in range ( 0, n ): c[i] = s * c[i] c8vec_print ( n, c, ' The initial vector:' ) a = c8vec_nint ( n, c ) c8vec_print ( n, c, ' The rounded vector:' ) print '' print 'C8VEC_NINT_TEST:' print ' Normal end of execution.' return
def c8vec_nint_test(): # *****************************************************************************80 # ## C8VEC_NINT_TEST tests C8VEC_NINT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 28 February 2015 # # Author: # # John Burkardt # from c8vec_print import c8vec_print from c8vec_uniform_01 import c8vec_uniform_01 print "" print "C8VEC_NINT_TEST" print " C8VEC_NINT rounds a C8VEC." n = 5 seed = 123456789 [c, seed] = c8vec_uniform_01(n, seed) s = 5.0 + 3.0j for i in range(0, n): c[i] = s * c[i] c8vec_print(n, c, " The initial vector:") a = c8vec_nint(n, c) c8vec_print(n, c, " The rounded vector:") print "" print "C8VEC_NINT_TEST:" print " Normal end of execution." return
def c8vec_norm_l1_test ( ): #*****************************************************************************80 # ## C8VEC_NORM_L1_TEST tests C8VEC_NORM_L1. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 01 March 2015 # # Author: # # John Burkardt # from c8vec_indicator import c8vec_indicator from c8vec_print import c8vec_print print '' print 'C8VEC_NORM_L1_TEST' print ' C8VEC_NORM_L1 computes the L1 norm of a C8VEC.' n = 5 c = c8vec_indicator ( n ) c8vec_print ( n, c, ' The indicator vector:' ) value = c8vec_norm_l1 ( n, c ) print '' print ' L1 norm = %g' % ( value ) print '' print 'C8VEC_NORM_L1_TEST:' print ' Normal end of execution.' return