⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svdsum

📁 求矩阵奇异分解svd算法
💻
📖 第 1 页 / 共 3 页
字号:
#*************************************************************************#                          (c) Copyright 1993#                       University of Tennessee#                         All Rights Reserved#*************************************************************************#!/bin/csh -f # svdsum#########################################################################      This script is used to produce "INPUT.sumN" files from the output# files generated by the script "svdrun", where n=id form the input file# and INPUT= the name of the input filei (i.e. svdin).# input the parameters described in the sample input file "svdin".# Each "INPUT.sumN" file displays output for up to seven runs of SVDPACKC# codes.  These files will normally have record lengths much larger than# 80 characters, and thus should be printed in "landscape" mode (i.e.,# written to 11'' by 8.5 '' paper format versus the normal 8.5'' by 11''# paper format.  Sample svdin.sum1 and svdin.sum2 files are supplied# in this package.  These output files are obtained by issuing # "svdsum svdin" at the prompt.  This script assumes that all the# output files of the form "DATA.outN", where DATA is a dataset and # N an integer, are available in your current working directory.######################################################################## Author: G. O'Brien, Dept. of Computer Science, UTK (May 1993)########################################################################	if ($#argv == 0) then		echo "Usage: svdsum <filename>"		exit 1	endif	if ($#argv == 1) then	   set inputfile = $argv[1]	   if (! -r $inputfile ) then		  echo "$inputfile unreadable."		  exit 1       endif       set id = (`awk '$0 !~ /^#/ {print $1} ' $inputfile`)	   set numberofdatafiles = (`awk '$0 !~ /^#/ {print $3} ' $inputfile`)	   set programs = (`awk '$0 !~ /^#/ {print $2} ' $inputfile`)       set number = $#numberofdatafiles    else	  echo "Usage: svdsum <filename>"	  exit 1    endif#---------------------------------------------------------------# Variables ----------------------------------------------------#---------------------------------------------------------------   set error1 = 0   set error2 = 0   set error3 = 0   set error4 = 0   set error5 = 0   set error6 = 0   set error7 = 0   set error8 = 0   set error9 = 0   set error10 = 0   set error11 = 0   set error12 = 0   set error13 = 0   set error14 = 0   set blockerror = 0   set singularerror = 0   set initblockerror = 0   set matrixtoobig = 0   set suberror = 0   set matrixtoobig = 0   set ncolerror = 0   set toleranceerror = 0   set endlerror = 0   set maxprserror = 0   set nerror = 0   set nw1error = 0   set nw2error = 0#---------------------------------------------------------------# Determine how many files to generate (5 sets of runs per file)#---------------------------------------------------------------   @ count = 0   if ($number > 5) then      @ loop = $number / 5   else        @ loop = 0   endif   echo "Summarizing Results ..."   echo " "   echo "(Please wait...)"   echo " "   echo "Results are written to:"#---------------------------------------------------------------# Get values ----------------------------------------------------#---------------------------------------------------------------while ($count <= $loop)   @ upperbound = ($count + 1) * 5   @ lowerbound = $upperbound - 5   @ incr = $count + 1   set output = $argv[1]:r.sum$incr   @ tmp = $lowerbound + 1   @ first = $tmp   if ($upperbound > $number) then      @ upperbound = $number   endif   while ($tmp <= $upperbound)     if ($tmp == $first) then        set datafiles = (`awk '$0 !~ /^#/ && $1 == "'$id[$tmp]'" + 0 {print $3}' $inputfile`)     else        set datafiles = (`echo $datafiles` `awk '$0 !~ /^#/ && $1 == "'$id[$tmp]'" + 0 {print $3} ' $inputfile`)     endif     @ tmp++   end    echo -n "===========================" > $output     foreach item ($datafiles)       echo -n "================" >> $output    end    echo "=" >> $output    echo -n "|        PROGRAM          |" >> $output	@ tmp = $lowerbound + 1	@ first = $tmp	if ($loop == 0) then	   @ upperbound = $number    endif    while ($tmp <= $upperbound)      awk '$0 !~ /^#/ && $1 == "'$id[$tmp]'" + 0 {printf("| %-13s ", $2) >> "'$output'" }' $inputfile      @ tmp++    end    echo "|" >> $output    echo -n "+--------------------------" >> $output    foreach item ($datafiles)       echo -n "----------------" >> $output    end    echo "+" >> $output    echo -n "|        DATASETS         |" >> $output    @ c = 1 + ($count * 5)    foreach file ($datafiles)       set coutputfile = $file.out$id[$c]       set value = `fgrep "'" $coutputfile | awk '{printf ("%-12s", $1) }'`       if ($value !~ \'[a-z0-9]*\') then	      set matrixtoobig = `grep -c 'SORRY, YOUR MATRIX IS TOO BIG' $coutputfile`		  if ($matrixtoobig == 1) then             echo -n "|   ERROR 5    " >> $output             set error5 = 1             set matrixtoobig = 0          else             echo -n "|      -        " >> $output		  endif       else          grep "'"  $coutputfile | awk '{printf ("| %-13s ", $1) >> "'$output'" }'       endif        @ c++    end    echo "|" >> $output    echo -n "+--------------------------" >> $output    foreach item ($datafiles)       echo -n "----------------" >> $output    end    echo "+" >> $output    echo -n "|        FILENAME         |" >> $output    @ c = 1 + ($count * 5)    foreach file ($datafiles)       set coutputfile = $file.out$id[$c]	   echo $coutputfile | awk '{printf ("| %-13s ", $1) >> "'$output'" }'       @ c++    end    echo "|" >> $output    echo -n "+--------------------------" >> $output    foreach item ($datafiles)       echo -n "----------------" >> $output    end    echo "+" >> $output    echo -n "|          DATE           |" >> $output    @ c = 1 + ($count * 5)    foreach file ($datafiles)       set coutputfile = $file.out$id[$c]	   set value = `grep "DATE:" $coutputfile | awk '{printf ("%.2s", $5)}'`	   if ($value =~ [0-9], ) then          grep "DATE:" $coutputfile | awk '{printf ("| %-3s %-2s %-4s   ", $4, $5, $6) >> "'$output'" }'	   else          grep "DATE:" $coutputfile | awk '{printf ("| %-3s %-2s %-4s   ", $4, $5, $6) >> "'$output'" }'	   endif       @ c++    end    echo "|" >> $output	echo -n "|  MAX. NO. OF ITERATIONS |" >> $output   @ c = 1 + ($count * 5)   @ tmp = $lowerbound + 1   @ first = $tmp   if ($loop == 0) then      @ upperbound = $number   endif   while ($tmp <= $upperbound)      if ($tmp == $first) then         set programfiles = (`awk '$0 !~ /^#/ && $1 == "'$id[$tmp]'" + 0 {print $3 " " $2}' $inputfile`)      else         set programfiles = (`echo $programfiles` `awk '$0 !~ /^#/ && $1 == "'$id[$tmp]'" + 0 {print $3 " " $2}' $inputfile`)      endif      @ tmp++   end   ##########################################   #  save list of programs in $programlist #   ##########################################   set programlist = `echo $programfiles`   while ($#programfiles > 0)	   set coutputfile = $programfiles[1].out$id[$c]	   shift programfiles       if ($programfiles[1] =~ las1 || $programfiles[1] =~ las2) then          set value = `grep "MAX. NO. OF LANCZOS STEPS" $coutputfile | awk '{printf ("%-13s ", $8) }'`       else          set value = `grep "MAX. NO. OF ITERATIONS" $coutputfile | awk '{printf ("%-13s ", $7) }'`       endif       set maxprserror = `grep -c 'MAXPRS CANNOT EXCEED LANMAX' $coutputfile`	   set lanmaxerror = `grep -c 'LANMAX (NUMBER OF LANCZOS STEPS) IS INVALID' $coutputfile`	   if ($value !~ [0-9]*) then          if ($maxprserror == 1) then             echo -n "|    ERROR 9   " >> $output             set error9 = 1             set maxprserror = 0          else             echo -n "|      -        " >> $output          endif	   else if ($programfiles[1] =~ las1 || $programfiles[1] =~ las2) then          set maxprserror = `grep -c 'MAXPRS CANNOT EXCEED LANMAX' $coutputfile`          if ($maxprserror == 1) then             echo -n "|    ERROR 9   " >> $output             set error9 = 1             set maxprserror = 0          else if ($lanmaxerror == 1) then             echo -n "|   ERROR 11   " >> $output             set error11 = 1             set lanmaxerror = 0	      else             grep "MAX. NO. OF LANCZOS STEPS" $coutputfile | awk '{printf ("| %-13s ", $8) >> "'$output'" }'          endif       else          grep "MAX. NO. OF ITERATIONS" $coutputfile | awk '{printf ("| %-13s ", $7) >> "'$output'" }'       endif       @ c++	   shift programfiles    end    echo "|" >> $output    echo -n "|  ORDER  OF EIGENSYSTEM  |" >> $output    @ c = 1 + ($count * 5)	set programfiles = `echo $programlist`    while ($#programfiles > 0)       set coutputfile = $programfiles[1].out$id[$c]	   shift programfiles       set value = `grep "NO. OF EQUATIONS" $coutputfile | awk '{printf ("%-13s ", $6) }'`       if ($value !~ [0-9]*) then          set nerror = `grep -c 'N = NROW + NCOL MUST BE GREATER THAN ZERO' $coutputfile`		  if ($nerror == 1) then             echo -n "|   ERROR 10   " >> $output             set error10 = 1             set nerror = 0          else             echo -n "|      -        " >> $output          endif       else          grep "NO. OF EQUATIONS" $coutputfile | awk '{printf ("| %-13s ", $6) >> "'$output'" }'       endif       @ c++       shift programfiles    end    echo "|" >> $output    echo -n "|  ROW    DIMENSION OF A  |" >> $output    @ c = 1 + ($count * 5)	set programfiles = `echo $programlist`	while ($#programfiles > 0)       set coutputfile = $programfiles[1].out$id[$c]	   shift programfiles       if ($programfiles[1] =~ las1 || $programfiles[1] =~ las2) then          set value = `grep "NO. OF DOC" $coutputfile | awk '{printf ("%-13s ", $7) }'`       else if ($programfiles[1] =~ sis1 || $programfiles[1] =~ sis2) then		  set value = `grep "NO. OF DOC" $coutputfile | awk '{printf ("%-13s ", $7) }'`       else if ($programfiles[1] =~ tms1 || $programfiles[1] =~ tms2) then		  set value = `grep "NO. OF DOC" $coutputfile | awk '{printf ("%-13s ", $7) }'`	   else          set value = `grep "NO. OF DOC" $coutputfile | awk '{printf ("%-13s ", $9) }'`       endif       if ($value !~ [0-9]*) then          echo -n "|      -        " >> $output       else if ($programfiles[1] =~ las1 || $programfiles[1] =~ las2) then          grep "NO. OF DOC" $coutputfile | awk '{printf ("| %-13s ", $7) >> "'$output'" }'       else if ($programfiles[1] =~ sis1 || $programfiles[1] =~ sis2) then		  grep "NO. OF DOC" $coutputfile | awk '{printf ("| %-13s ", $7) >> "'$output'" }'       else if ($programfiles[1] =~ tms1 || $programfiles[1] =~ tms2) then		  grep "NO. OF DOC" $coutputfile | awk '{printf ("| %-13s ", $7) >> "'$output'" }'       else          grep "NO. OF DOC" $coutputfile | awk '{printf ("| %-13s ", $9) >> "'$output'" }'       endif       @ c++

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -