#! /usr/bin/env python # def r8col_indicator ( m, n ): #*****************************************************************************80 # ## R8COL_INDICATOR sets up an indicator R8COL. # # Discussion: # # An R8COL is an M by N array of R8's, regarded as an array of N columns, # each of length M. # # 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: # # 24 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 TABLE(M,N), the indicator table. # import numpy as np from i4_log_10 import i4_log_10 table = 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 ): table[i,j] = fac * ( i + 1 ) + ( j + 1 ) return table def r8col_indicator_test ( ): #*****************************************************************************80 # ## R8COL_INDICATOR_TEST tests R8COL_INDICATOR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 February 2016 # # Author: # # John Burkardt # from r8col_print import r8col_print print '' print 'R8COL_INDICATOR_TEST' print ' R8COL_INDICATOR creates an "indicator" R8COL.' m = 5 n = 4 a = r8col_indicator ( m, n ) r8col_print ( m, n, a, ' The indicator matrix:' ) # # Terminate. # print '' print 'R8COL_INDICATOR_TEST' print ' Normal end of execution.' return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) r8col_indicator_test ( ) timestamp ( )