#! /usr/bin/env python # def r8row_indicator ( m, n ): #*****************************************************************************80 # ## R8ROW_INDICATOR sets up an indicator R8ROW. # # Discussion: # # An R8ROW is an M by N array of R8's, regarded as an array of M rows, # each of length N. # # The value of each entry suggests its location, as in: # # 11 12 13 14 # 21 22 23 24 # 31 32 33 34 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 28 February 2016 # # Author: # # John Burkardt # # Parameters: # # Input, integer M, the number of rows of the matrix. # M must be positive. # # Input, integer N, the number of columns of the matrix. # N must be positive. # # Output, real A(M,N), the indicator table. # import numpy as np from i4_log_10 import i4_log_10 a = np.zeros ( ( m, n ), dtype = np.float64 ) fac = 10 ** ( i4_log_10 ( n ) + 1 ) for i in range ( 0, m ): for j in range ( 0, n ): a[i,j] = fac * ( i + 1 ) + ( j + 1 ) return a def r8row_indicator_test ( ): #*****************************************************************************80 # ## R8ROW_INDICATOR_TEST tests R8ROW_INDICATOR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 28 February 2016 # # Author: # # John Burkardt # from r8row_print import r8row_print print '' print 'R8ROW_INDICATOR_TEST' print ' R8ROW_INDICATOR creates an "indicator" R8ROW.' m = 5 n = 4 a = r8row_indicator ( m, n ) r8row_print ( m, n, a, ' The indicator matrix:' ) # # Terminate. # print '' print 'R8ROW_INDICATOR_TEST' print ' Normal end of execution.' return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) r8row_indicator_test ( ) timestamp ( )