#!/usr/bin/env bash

BASE="ftp://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/"
                
#PWD=`pwd`
#TNL_SPARSE_MATRIX_CHECK="$PWD/tnl-sparse-matrix-check"
#IWD="$PWD"

#source ../tnl-env-variables
source matrix-market
source florida-matrix-market

for link in $MM_MATRICES;
do
   echo "###############################################################################"
   matrix=matrices`echo $link | sed 's/ftp:\/\/math.nist.gov\/pub//'`
   if test ! -e $matrix;
   then
      echo "Getting $matrix ..."      
      wget -x --cut-dirs=1 -P matrices -nH $link
   else
      echo "Matrix $matrix was already downloaded."
   fi
   
done


for link in $FLORIDA_MM_MATRICES;
do
   echo "###############################################################################"
   matrix=matrices`echo $link | sed 's/http:\/\/www.cise.ufl.edu\/research\/sparse//'`
   if test ! -e $matrix;
   then
      echo "Getting $matrix ..."      
      wget -x --cut-dirs=2 -P matrices -nH $link
   else
      echo "Matrix $matrix was already downloaded."   
   fi
done
