- #!/bin/bash
- # matrix_multiplication
- (( ${#} != 2 )) && exit 1
- load::matrix()
- {
- while read ary; do
- eval "${1}$((${2}++))=(${ary})"
- done < ${3}
- }
- multiple()
- {
- b=map${i}[j]
- d=maq${j}[p]
- ((q+=${!b}*${!d}))
- }
- loop()
- {
- for((${1}=0; ${1}<${2}; ++${1})); do
- (( ${#} == 6 )) && q=0
- eval eval \\\$\{{3..${#}}\}
- (( ${#} == 9 )) && echo
- (( ${#} == 6 )) && echo -n "${q} "
- done
- }
- load::matrix map m ${1}
- load::matrix maq n ${2}
- loop i m loop p ${#maq0[@]} loop j n multiple