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

📄 svdrun

📁 求矩阵奇异分解svd算法
💻
📖 第 1 页 / 共 2 页
字号:
#*************************************************************************#                          (c) Copyright 1993#                       University of Tennessee#                         All Rights Reserved#*************************************************************************#!/bin/csh -f #svdrun########################################################################      This script is used to run SVDPACKC codes.  The script takes as# input the parameters described in the sample input file "svdin".  You# should invoke the runs specified by svdin via "svdrun svdin".# The output file from each execution of a SVDPACKC code, will be named# DATA.outN, where##            DATA= name of file containing sparse matrix data structure,#            N   = id of runs with this dataset in svdrun.## This script will compile, link, and execute any SVDPACKC code found# in the subdirectories specified by the following variables:# #         las1files   bls1files   sis1files   tms1files#         las2files   bls1files   sis2files   tms2files## Any changes in the paths of the SVDPACKC source will require# updating these variables.  The user must also specify the "datadir"# path to the compressed Harwell-Boeing input matrices which are# used to test the library.## This current script is designed to compile and run SVDPACKC on# the following architectures:##   rios (IBM RS/6000),  sun4 (Sun SPARC), hp9000 (HP 9000 Series),#   CRAY-YMP (UNICOS)## The script "svdsum" can be used to produce summary tables from the # output files generated by "svdrun".  You may need to modify the# SVDPACKC makefile for compilation on your machine.  This makefile# is invoked by this script.######################################################################## Author: G. O'Brien, Dept. of Computer Science, UTK (May 1993)#########################################################################-----------------------------------------------------------------------# Create environment --------------------------------------------------#-----------------------------------------------------------------------unalias rmunalias cpunalias mvunset noclobberset userdirectory = $cwd#-----------------------------------------------------------------------# Set up paths (Should be modified for all paths to data and executables)#-----------------------------------------------------------------------set datadir   = $cwdset las1files = $cwdset las2files = $cwd set bls1files = $cwdset bls2files = $cwdset sis1files = $cwdset sis2files = $cwdset tms1files = $cwdset tms2files = $cwd#-----------------------------------------------------------------------# Check the list of possible hosts ------------------------------------#-----------------------------------------------------------------------set archtype = `arch`if ($archtype =~ rios || $archtype =~ sun4 || $archtype =~ hp9000) then	echo "Running on $archtype"else if ($archtype =~ CRAY-YMP) then	echo "Running on $archtype"else   echo "${0}: Compilation for rios, sun4, Y-MP, or hp9000 only."   exitendif#-----------------------------------------------------------------------# Check command line arguments ----------------------------------------#-----------------------------------------------------------------------if ($#argv == 0) then	echo "Usage: svdrun <filename>"	exit 1endif    	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 program = (`awk '$0 !~ /^#/ {print $2 } ' $inputfile`)			set dataset = (`awk '$0 !~ /^#/ {print $3 } ' $inputfile`)        else		   echo "Usage: svdrun <filename>"		endif@ c = 1foreach file ($dataset)#-----------------------------------------------------------------------#       Get parameters -------------------------------------------------#-----------------------------------------------------------------------	switch ($program[$c])      	  case las1:	     set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 breaksw	  case las2:	     set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 breaksw      case bls1:		 set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set subspace = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set blocksize = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $8}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $9}' `         breaksw      case bls2:		 set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set subspace = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set blocksize = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $8}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $9}' `         breaksw      case sis1:		 set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set subspace = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $8}' `         breaksw	  case sis2:		 set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set subspace = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $8}' `         breaksw	  case tms1:		 set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set subspace = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set residual = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 set ritz = `grep "^ *$id[$c] " $inputfile | awk '{print $8}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $9}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $10}' `         breaksw	  case tms2:		 set iterations = `grep "^ *$id[$c] " $inputfile | awk '{print $4}' `		 set triplets = `grep "^ *$id[$c] " $inputfile | awk '{print $5}' `		 set subspace = `grep "^ *$id[$c] " $inputfile | awk '{print $6}' `		 set residual = `grep "^ *$id[$c] " $inputfile | awk '{print $7}' `		 set ritz = `grep "^ *$id[$c] " $inputfile | awk '{print $8}' `		 set accuracy = `grep "^ *$id[$c] " $inputfile | awk '{print $9}' `		 set vectors = `grep "^ *$id[$c] " $inputfile | awk '{print $10}' `         breaksw    endsw#-----------------------------------------------------------------------#       Check parameters -----------------------------------------------#-----------------------------------------------------------------------	if ($iterations < $triplets) then       echo "Invalid input in $inputfile."	   echo "   Iterations must be greater than or equal to triplets."    endif	if ($accuracy !~ [-0-9]) then	   set accuracy = 1.0e-6    endif	if ($vectors !~ [T,F,t,f]) then	   set vectors = TRUE    else	   echo "Invalid input in $inputfile."	   echo "   Vectors is either TRUE or FALSE."    endif	if ($program[$c] =~ tms1 || $program[$c] =~ tms2) then	   if ($residual !~ [0-9]*E*[0-9]*) then	      echo "Bad residual value in $inputfile."		  if ($residual !~ [0-9*D*[0-9]*) then             echo "Unable to fix residual."			 exit		  endif		  echo $residual		  echo $residual > temp		  set residual = `sed 's/D/E/g' temp`		  echo $residual       endif    endif#-----------------------------------------------------------------------#     Get Data files ---------------------------------------------------#-----------------------------------------------------------------------	echo " "	echo "Search for $file (if necessary) ..."	echo " "	if (! -e $file) then		if (! -e $file.Z) then		   if (! -e $datadir/$file.Z) then		   	  echo "File does not exist."		      exit 1                   endif                   if( $datadir !~ $cwd) then	   	      ln -s $datadir/$file.Z                   endif		   uncompress $file.Z		endif	endif        set fname = $file#-----------------------------------------------------------------------#         parameters ---------------------------------------------------#-----------------------------------------------------------------------	echo "Reading $file ..."	echo " "	set nrow = `awk '/[Rr][Rr][Aa]/ {print$2}' $file`	set ncol = `awk '/[Rr][Rr][Aa]/ {print$3}' $file`	set nnzero = `awk '/[Rr][Rr][Aa]/ {print$4}' $file`	@ LMTN =  $nrow + $ncol	@ NZMAX = $nnzero + 1	@ NSIG = $triplets	@ LDV = $ncol	@ LDU = $nrow	@ MNCMAX = $nnzero	@ NRMAX = $nrow	@ NCMAX = $ncol + 1	@ IK2 = $triplets	@ N2 = $ncol	@ M2 = $nrow	@ LDT2 = $nrow	@ NCG = $nrow + $ncol	@ LDY = $nrow + $ncol	if ($program[$c] !~ las1 && $program[$c] !~ las2) then	   @ ISMAX = $subspace

⌨️ 快捷键说明

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