資源簡介
實(shí)現(xiàn)了矩陣中的各種操作, 包括矩陣相加,相減,矩陣乘法,矩陣轉(zhuǎn)秩,余子式,求行列式的值,求矩陣特征值,LU 分解,QR 分解,求現(xiàn)行方程組的解等等。
是任何做科學(xué)計(jì)算工作者必備的類庫。
此類庫也是C++初學(xué)者極好的參考資料。類庫的實(shí)現(xiàn)運(yùn)用了運(yùn)算符重載,友元,異常處理,文件輸入輸出,函數(shù)重載,指針,動態(tài)分配內(nèi)存等一系列C++技術(shù)。
此類庫是我在美國研究生階段的一個Term Project.品質(zhì)保證。

代碼片段和文件信息
#include?“general.h“
//general.cpp
//Dr.?Mengjiao?Yu
//Date:?Dec?2?2004
//
//general?purposed?function
//Please?take?a?look?at?the?input.dat?file
//1.?The?purpose?here?is?to?provide?a?funcition?that?can?bypass?the?white?spaces?and?comments...
//???That?way?it?makes?the?input?file?more?readable.
//2.?Standard?istream?operator?>>?can?NOT?take?care?of?strings?with?whit?spaces
//???ReadAString(istream&?)?is?then?provided?to?read?a?string?in?a?““?pair.?
//
//BypassComment?is?a?function?for?processing?input?file.?It?can?be?used?to?
//skip?the?comments?(start?with?a?‘#‘)?and?white?spaces.
//
void?BypassComment(istream&?ins)
{
ins>>ws;//skip?white?space....
if?(ins.eof())?return;//end?of?file??
//then?skip?comments...
while(?(ins.peek()==‘#‘?||?ins.peek()==‘\n‘)?&&?(!ins.eof())?)
{
string?tmp=““;?//used?only?for?display?purpose..
char?c;
do
{
ins.get(c);//
tmp+=c;//for?display?purpose?only
}while?(c!=‘\n‘?&&?!ins.eof());//repeatedly?
cout<<“Skipped:?“< if?(ins.eof())?return;//end?of?file?
ins>>ws;//skip?white?spaces....
}
};
//Since?the?standard?istream?cannot?take?care?strings?with?whitespace?we?need?something?to?do?this
string?ReadAString(istream&?ins)
{
string?tmp=““;
ins>>ws;//skip?white?space.....
if?(ins.peek()!=‘“‘)?//not?a?string?within?a?““?pair
{
ins>>tmp;
}
else
???{
char?c;
//The?implementation?is?not?quite?efficient.?You?may?use?getline()?with?delim?set?as?‘“‘...
//But?not?a?big?deal?here.
ins>>c;//skip?“
do{
ins>>noskipws>>c;//read?a?char?do?NOT?skip?any?white?spaces!!!
if(c!=‘“‘)?tmp+=c;//add?it?into?the?string?if?it?is?not?the?terminator?“
??}while?(c!=‘“‘?&&?!ins.eof());//
???};
try
{
ins>>ws;//skip?white?spaces
}catch(...)
{
//if?eof?just?return.
}
//cout<<“Read?the?following?string:?“< return?tmp;
}
//launch?an?external?program?
//BOOL?LaunchApplication(LPCTSTR?pCmdLine?PROCESS_INFORMATION?*pProcessInfo)
//{
//???STARTUPINFO?stStartUpInfo;
//????memset(&stStartUpInfo?0?sizeof(STARTUPINFO));
//????stStartUpInfo.cb?=?sizeof(STARTUPINFO);
//????stStartUpInfo.dwFlags?=?STARTF_USESHOWWINDOW;
?//???stStartUpInfo.wShowWindow?=?SW_SHOWDEFAULT;
// stStartUpInfo.wShowWindow?=?SW_SHOW;//SW_HIDE;
// //stStartUpInfo.wShowWindow?=?SW_SHOW;
// /*
//????return?CreateProcess(NULL?(LPTSTR)pCmdLine?NULL?NULL?FALSE
//????????//IDLE_PRIORITY_CLASS??
// NORMAL_PRIORITY_CLASS?
// NULL?
//????????NULL?&stStartUpInfo?pProcessInfo);
// */
// return?CreateProcess(NULL?(LPSTR)pCmdLine?NULL?NULL?FALSE
?//???????//IDLE_PRIORITY_CLASS??
// NORMAL_PRIORITY_CLASS?
// //JobPriority?//priority...
// NULL?
//??????NULL?&stStartUpInfo?pProcessInfo);
//}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????843??2011-02-28?13:20??矩陣操作\.svn\all-wcprops
?????文件???????1522??2011-02-28?13:20??矩陣操作\.svn\entries
?????文件??????????2??2011-02-19?11:27??矩陣操作\.svn\format
?????文件?????????53??2011-02-19?11:27??矩陣操作\.svn\prop-ba
?????文件?????????34??2011-02-27?22:48??矩陣操作\.svn\text-ba
?????文件?????????33??2011-02-21?17:38??矩陣操作\.svn\text-ba
?????文件???????2765??2011-02-19?11:27??矩陣操作\.svn\text-ba
?????文件???????1016??2011-02-19?11:27??矩陣操作\.svn\text-ba
?????文件??????39424??2011-02-19?11:27??矩陣操作\.svn\text-ba
?????文件???????4535??2011-02-19?15:52??矩陣操作\.svn\text-ba
?????文件??????22681??2011-02-28?13:20??矩陣操作\.svn\text-ba
?????文件???????2850??2011-02-27?17:27??矩陣操作\.svn\text-ba
?????文件???????2565??2011-02-28?12:34??矩陣操作\.svn\text-ba
?????文件?????????23??2011-02-27?17:36??矩陣操作\3.data
?????文件?????????33??2011-02-27?17:37??矩陣操作\4.data
?????文件?????????34??2011-02-27?18:16??矩陣操作\a.data
?????文件????????130??2011-02-27?00:00??矩陣操作\aaa.data
?????文件????????130??2011-02-26?23:56??矩陣操作\aRes.data
?????文件?????????33??2011-02-20?12:33??矩陣操作\b.data
?????文件???????2864??2011-02-19?11:27??矩陣操作\general.cpp
?????文件?????????33??2011-02-19?15:28??矩陣操作\general.d
?????文件???????1059??2011-02-19?11:27??矩陣操作\general.h
?????文件???????5448??2011-02-19?15:28??矩陣操作\general.o
?????文件??????39777??2011-02-28?13:20??矩陣操作\hw3
?????文件?????????24??2011-02-27?00:07??矩陣操作\L.output
?????文件?????????22??2011-02-27?14:02??矩陣操作\L.result
?????文件?????????22??2011-02-27?14:03??矩陣操作\LL.result
?????文件?????????16??2011-02-27?13:43??矩陣操作\LU.data
?????文件???????4535??2011-02-19?15:48??矩陣操作\Makefile
?????文件??????23568??2011-02-28?13:20??矩陣操作\Matrix.cpp
............此處省略22個文件信息
評論
共有 條評論