def r8col_swap_test ( ): #*****************************************************************************80 # ## R8COL_SWAP_TEST tests R8COL_SWAP; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 19 April 2009 # # Author: # # John Burkardt # from r8mat_indicator import r8mat_indicator from r8mat_print import r8mat_print m = 3; n = 4; print '' print 'R8COL_SWAP_TEST' print ' For an R8COL, an array of column vectors;' print ' R8COL_SWAP swaps two columns;' a = r8mat_indicator ( m, n ) r8mat_print ( m, n, a, ' The array:' ) icol1 = 0 icol2 = 2 print ''; print ' Swap columns %d and %d' % ( icol1, icol2 ) a = r8col_swap ( m, n, a, icol1, icol2 ) r8mat_print ( m, n, a, ' The updated matrix:' ) print '' print 'R8COL_SWAP_TEST' print ' Normal end of execution.' return
def r8col_swap_test(): #*****************************************************************************80 # ## R8COL_SWAP_TEST tests R8COL_SWAP; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 19 April 2009 # # Author: # # John Burkardt # from r8mat_indicator import r8mat_indicator from r8mat_print import r8mat_print m = 3 n = 4 print '' print 'R8COL_SWAP_TEST' print ' For an R8COL, an array of column vectors;' print ' R8COL_SWAP swaps two columns;' a = r8mat_indicator(m, n) r8mat_print(m, n, a, ' The array:') icol1 = 0 icol2 = 2 print '' print ' Swap columns %d and %d' % (icol1, icol2) a = r8col_swap(m, n, a, icol1, icol2) r8mat_print(m, n, a, ' The updated matrix:') print '' print 'R8COL_SWAP_TEST' print ' Normal end of execution.' return
def r8mat_sub_test ( ): #*****************************************************************************80 # ## R8MAT_SUB_TEST tests R8MAT_SUB. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 02 March 2015 # # Author: # # John Burkardt # import numpy as np from r8mat_indicator import r8mat_indicator from r8mat_print import r8mat_print from r8mat_transpose import r8mat_transpose m = 4 n = 4 print '' print 'R8MAT_SUB_TEST' print ' R8MAT_SUB computes C = A - B;' a = r8mat_indicator ( m, n ) b = r8mat_transpose ( m, n, a ) c = r8mat_sub ( m, n, a, b ) r8mat_print ( m, n, a, ' A:' ) r8mat_print ( m, n, b, ' B:' ) r8mat_print ( m, n, c, ' C = A - B:' ) print '' print 'R8MAT_SUB_TEST' print ' Normal end of execution.' return
def r8mat_transpose_test ( ): #*****************************************************************************80 # ## R8MAT_TRANSPOSE_TEST tests R8MAT_TRANSPOSE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 02 March 2015 # # Author: # # John Burkardt # from r8mat_indicator import r8mat_indicator from r8mat_print import r8mat_print m = 5 n = 4 print '' print 'R8MAT_TRANSPOSE_TEST' print ' R8MAT_TRANSPOSE transposes an R8MAT.' a = r8mat_indicator ( m, n ) r8mat_print ( m, n, a, ' Matrix A:' ) at = r8mat_transpose ( m, n, a ) r8mat_print ( n, m, at, ' Transposed matrix At:' ) print '' print 'R8MAT_TRANSPOSE_TEST' print ' Normal end of execution.' return