function msm_to_hb_test ( )

%*****************************************************************************80
%
%% MSM_TO_HB_TEST tests MSM_TO_HB.
%
%  Licensing:
%
%    I don't care what you do with this code.
%
%  Modified:
%
%    31 December 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../msm_to_hb' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'MSM_TO_HB_TEST\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test MSM_TO_HB.\n' );

  r8mat_to_hb_test ( );
  c8mat_to_hb_test ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'MSM_TO_HB_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../msm_to_hb' );

  return
end
function a = c8mat_indicator ( m, n )

%*****************************************************************************80
%
%% C8MAT_INDICATOR returns the C8MAT indicator matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 November 2008
%
%  Author
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the number of rows and columns.
%
%  Output:
%
%    complex A(M,N), the matrix.
%
  a = zeros ( m, n );

  imaginary = sqrt ( - 1 );

  for j = 1 : n
    for i = 1 : m
      a(i,j) = i + j * imaginary;
    end
  end

  return
end
function c8mat_to_hb_test ( )

%*****************************************************************************80
%
%% C8MAT_TO_HB_TEST tests MSM_TO_HB for a complex matrix.
%
%  Licensing:
%
%    I don't care what you do with this code.
%
%  Modified:
%
%    18 July 2017
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'C8MAT_TO_HB_TEST\n' );
  fprintf ( 1, '  We will create a simple 5 by 5 complex matrix,\n' );
  fprintf ( 1, '  convert it to MATLAB sparse format,\n' );
  fprintf ( 1, '  and then have MSM_TO_HB write the matrix to a file.\n' );
%
%  Create a simple matrix.
%
  a = c8mat_indicator ( 5, 5 );
%
%  Make a sparse version of the matrix.
%
  b = sparse ( a );
%
%  Have MSM_TO_HB write the sparse matrix to a file.
%
  msm_to_hb ( 'c8mat_to_hb.hb', b );

  return
end
function r8mat_to_hb_test ( )

%*****************************************************************************80
%
%% R8MAT_TO_HB_TEST tests MSM_TO_HB.
%
%  Licensing:
%
%    I don't care what you do with this code.
%
%  Modified:
%
%    18 July 2017
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8MAT_TO_HB_TEST\n' );
  fprintf ( 1, '  We will create a simple 5 by 5 matrix,\n' );
  fprintf ( 1, '  convert it to MATLAB sparse format,\n' );
  fprintf ( 1, '  and then have MSM_TO_HB write the matrix to a file.\n' );
%
%  Create a simple matrix.
%
  a = [ 11,  0,  0, 14,  0;
         0, 22,  0,  0,  0;
        31, 32, 33, 34, 35;
         0,  0,  0, 44, 45;
        51, 52,  0,  0, 55 ];
%
%  Make a sparse version of the matrix.
%
  b = sparse ( a );
%
%  Have MSM_TO_HB write the sparse matrix to a file.
%
  msm_to_hb ( 'r8mat_to_hb.hb', b );

  return
end

function timestamp ( )

%*****************************************************************************80
%
%% TIMESTAMP prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    I don't care what you do with this code.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

