# include # include # include # include "r8pbl.h" int main ( ); void r8pbl_dif2_test ( ); void r8pbl_indicator_test ( ); void r8pbl_mv_test ( ); void r8pbl_print_test ( ); void r8pbl_print_some_test ( ); void r8pbl_random_test ( ); void r8pbl_to_r8ge_test ( ); void r8pbl_zeros_test ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: MAIN is the main program for R8PBL_TEST. Discussion: R8PBL_TEST tests R8PBL. Licensing: This code is distributed under the GNU LGPL license. Modified: 23 July 2016 Author: John Burkardt */ { timestamp ( ); printf ( "\n" ); printf ( "R8PBL_TEST\n" ); printf ( " C version\n" ); printf ( " Test the R8PBL library.\n" ); r8pbl_dif2_test ( ); r8pbl_indicator_test ( ); r8pbl_mv_test ( ); r8pbl_print_test ( ); r8pbl_print_some_test ( ); r8pbl_random_test ( ); r8pbl_to_r8ge_test ( ); r8pbl_zeros_test ( ); /* Terminate. */ printf ( "\n" ); printf ( "R8PBL_TEST\n" ); printf ( " Normal end of execution.\n" ); printf ( "\n" ); timestamp ( ); return 0; } /******************************************************************************/ void r8pbl_dif2_test ( ) /******************************************************************************/ /* Purpose: R8PBL_DIF2_TEST tests R8PBL_DIF2. Licensing: This code is distributed under the GNU LGPL license. Modified: 21 July 2016 Author: John Burkardt */ { double *a; int i; int j; int ml = 3; int n = 5; printf ( "\n" ); printf ( "R8PBL_DIF2_TEST\n" ); printf ( " R8PBL_DIF2 sets up an R8PBL second difference matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_dif2 ( n, ml ); r8pbl_print ( n, ml, a, " The R8PBL second difference matrix:" ); free ( a ); return; } /******************************************************************************/ void r8pbl_indicator_test ( ) /******************************************************************************/ /* Purpose: R8PBL_INDICATOR_TEST tests R8PBL_INDICATOR. Licensing: This code is distributed under the GNU LGPL license. Modified: 14 April 2013 Author: John Burkardt */ { double *a; int i; int j; int ml = 3; int n = 9; printf ( "\n" ); printf ( "R8PBL_INDICATOR_TEST\n" ); printf ( " R8PBL_INDICATOR sets up an R8PBL indicator matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_indicator ( n, ml ); r8pbl_print ( n, ml, a, " The R8PBL indicator matrix:" ); free ( a ); return; } /******************************************************************************/ void r8pbl_mv_test ( ) /******************************************************************************/ /* Purpose: R8PBL_MV_TEST tests R8PBL_MV. Licensing: This code is distributed under the GNU LGPL license. Modified: 22 July 2016 Author: John Burkardt */ { double *a; double *b; int ml = 2; int n = 5; int seed = 123456789; double *x; printf ( "\n" ); printf ( "R8PBL_MV_TEST\n" ); printf ( " R8PBL_MV computes A*x, where A is an R8PBL matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Lower bandwidth ML = %d\n", ml ); /* Set the matrix. */ a = r8pbl_random ( n, ml, &seed ); r8pbl_print ( n, ml, a, " Matrix A:" ); /* Set the desired solution. */ x = r8vec_indicator1_new ( n ); r8vec_print ( n, x, " Vector x:" ); /* Compute the corresponding right hand side. */ b = r8pbl_mv ( n, ml, a, x ); r8vec_print ( n, b, " Product b=A*x" ); free ( a ); free ( b ); free ( x ); return; } /******************************************************************************/ void r8pbl_print_test ( ) /******************************************************************************/ /* Purpose: R8PBL_PRINT_TEST tests R8PBL_PRINT. Licensing: This code is distributed under the GNU LGPL license. Modified: 21 July 2016 Author: John Burkardt */ { double *a; int i; int j; int ml = 3; int n = 9; printf ( "\n" ); printf ( "R8PBL_PRINT_TEST\n" ); printf ( " R8PBL_PRINT prints an R8PBL matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_indicator ( n, ml ); r8pbl_print ( n, ml, a, " The R8PBL matrix:" ); free ( a ); return; } /******************************************************************************/ void r8pbl_print_some_test ( ) /******************************************************************************/ /* Purpose: R8PBL_PRINT_SOME_TEST tests R8PBL_PRINT_SOME. Licensing: This code is distributed under the GNU LGPL license. Modified: 22 July 2016 Author: John Burkardt */ { double *a; int i; int j; int ml = 4; int n = 9; printf ( "\n" ); printf ( "R8PBL_PRINT_SOME_TEST\n" ); printf ( " R8PBL_PRINT_SOME prints soem of an R8PBL matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_indicator ( n, ml ); r8pbl_print_some ( n, ml, a, 3, 4, 7, 8, " Row(3:7), Col(4:8):" ); free ( a ); return; } /******************************************************************************/ void r8pbl_random_test ( ) /******************************************************************************/ /* Purpose: R8PBL_RANDOM_TEST tests R8PBL_RANDOM. Licensing: This code is distributed under the GNU LGPL license. Modified: 22 July 2016 Author: John Burkardt */ { double *a; int ml = 3; int n = 9; int seed = 123456789; printf ( "\n" ); printf ( "R8PBL_RANDOM_TEST\n" ); printf ( " R8PBL_RANDOM randomizes an R8PBL matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_random ( n, ml, &seed ); r8pbl_print ( n, ml, a, " The R8PBL random matrix:" ); free ( a ); return; } /******************************************************************************/ void r8pbl_to_r8ge_test ( ) /******************************************************************************/ /* Purpose: R8PBL_TO_R8GE_TEST tests R8PBL_TO_R8GE. Licensing: This code is distributed under the GNU LGPL license. Modified: 22 July 2016 Author: John Burkardt */ { double *a; double *a_r8ge; int ml = 3; int n = 9; printf ( "\n" ); printf ( "R8PBL_TO_R8GE_TEST\n" ); printf ( " R8PBL_TO_R8GE converts an R8PBL matrix to R8GE format.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_indicator ( n, ml ); r8pbl_print ( n, ml, a, " The R8PBL matrix:" ); a_r8ge = r8pbl_to_r8ge ( n, ml, a ); r8ge_print ( n, n, a_r8ge, " The R8GE matrix:" ); free ( a ); free ( a_r8ge ); return; } /******************************************************************************/ void r8pbl_zeros_test ( ) /******************************************************************************/ /* Purpose: R8PBL_ZEROS_TEST tests R8PBL_ZEROS. Licensing: This code is distributed under the GNU LGPL license. Modified: 21 July 2016 Author: John Burkardt */ { double *a; int i; int j; int ml = 3; int n = 5; printf ( "\n" ); printf ( "R8PBL_ZEROS_TEST\n" ); printf ( " R8PBL_ZEROS zeros an R8PBL matrix.\n" ); printf ( "\n" ); printf ( " Matrix order N = %d\n", n ); printf ( " Bandwidth ML = %d\n", ml ); a = r8pbl_zeros ( n, ml ); r8pbl_print ( n, ml, a, " The R8PBL zero matrix:" ); free ( a ); return; }