亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? matrix.cpp

?? 用于聲音圖像的FFC變換源碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
			else if (value > e_max)
				e_max = value ;
			}
		}
	min = e_min ;
	max = e_max ;
}

double CMatrix::SumColumn(int column) const
{
	ASSERT(column >= 0) ;					// bad column
	ASSERT(column < m_NumColumns) ;				// bad column
	double	sum = 0.0 ;

	for (int i = 0 ; i < m_NumRows ; ++i)
		sum += GetElement(column, i) ;
	return sum ;
}

double CMatrix::SumRow(int row) const
{
	ASSERT(row >= 0) ;						// bad row
	ASSERT(row < m_NumRows) ;					// bad row
	double	sum = 0.0 ;

	for (int i = 0 ; i < m_NumColumns ; ++i)
		sum += GetElement(i, row) ;
	return sum ;
}

double CMatrix::SumColumnSquared(int column) const
{
	double value = SumColumn(column) ;
	return (value * value) ;
}

double CMatrix::SumRowSquared(int row) const
{
	double value = SumRow(row) ;
	return (value * value) ;
}

// returns the minimum value in a row of the matrix
double CMatrix::GetRowMin(int row) const
{
	ASSERT(row >= 0) ;
	ASSERT(row < m_NumRows) ;
	double	value = GetElement(0, row) ;
	for (int i = 1 ; i < m_NumColumns ; ++i)
		{
		if (GetElement(i, row) < value)
			value = GetElement(i, row) ;
		}
	return value ;
}

// returns the maximum value in a row of the matrix
double CMatrix::GetRowMax(int row) const
{
	ASSERT(row >= 0) ;
	ASSERT(row < m_NumRows) ;
	double	value = GetElement(0, row) ;
	for (int i = 1 ; i < m_NumColumns ; ++i)
		{
		if (GetElement(i, row) > value)
			value = GetElement(i, row) ;
		}
	return value ;
}

// returns the minimum value in a column of the matrix
double CMatrix::GetColumnMin(int column) const
{
	ASSERT(column >= 0) ;
	ASSERT(column < m_NumColumns) ;
	double	value = GetElement(column, 0) ;
	for (int i = 1 ; i < m_NumRows ; ++i)
		{
		if (GetElement(column, i) < value)
			value = GetElement(column, i) ;
		}
	return value ;
}

// returns the maximum value in a column of the matrix
double CMatrix::GetColumnMax(int column) const
{
	ASSERT(column >= 0) ;
	ASSERT(column < m_NumColumns) ;
	double	value = GetElement(column, 0) ;
	for (int i = 1 ; i < m_NumRows ; ++i)
		{
		if (GetElement(column, i) > value)
			value = GetElement(column, i) ;
		}
	return value ;
}

// returns the matrix in a SafeArray object which can be passed through COM components and used in VB etc
VARIANT CMatrix::GetSafeArray() const
{
	VARIANT		var ;
	// Set up the VARIANT to hold the SAFEARRAY.
	SAFEARRAY*			psa = NULL ;
	SAFEARRAYBOUND		bounds[2] =	{
									{m_NumColumns, 0},
									{m_NumRows, 0}
									};

	VariantClear(&var) ;
	var.vt = VT_ARRAY | VT_R8 ;			// Double array.
	
	psa = SafeArrayCreate(VT_R8, 2, bounds) ;
	if (psa == NULL)					// failed to create the safe array
		{
		TRACE("Failed to create SAFEARRAY[][]\n") ;
		VariantClear(&var) ;
		return var ;
		}	
	double* dummy = NULL ;	
	SafeArrayAccessData(psa, (void**)(&dummy));	
	// Iterate through the array of doubles, placing each value into the dummy variable.
	for (int i = 0; i < m_NumColumns ; ++i)
		{
		for (int j = 0; j < m_NumRows ; ++j)
			dummy[i * m_NumRows + j] = GetElement(i, j) ;
		}
	SafeArrayUnaccessData(psa) ;
	// Set the array member of the VARIANT to be our newly filled SAFEARRAY.
	var.parray = psa;
	// note that to avoid a leak the variant must be cleared using "VariantClear"
	// to properly de-allocate the safe array just created
	return var ;
}

// copies the matrix to the clipboard as text such as:
// 
// 4.0,50.0,60.0
// 3.52,785.0,56.2
//
void CMatrix::CopyToClipboard() const
{
	// create the text to be copied to the clipboard
	CString	text ;

	for (int i = 0 ; i < m_NumRows ; ++i)
		{
		text += GetRowAsText(i) ;
		text += "\r\n" ;
		}
	// now place the text on the clipboard
	if (OpenClipboard(NULL))
		{
		HGLOBAL		handle ;
		char		*pntr ;

		handle = ::GlobalAlloc(GHND, text.GetLength() + 1) ;
		pntr = (char *)::GlobalLock(handle) ;
		strcpy(pntr, text) ;
		::GlobalUnlock(handle) ;
		EmptyClipboard() ;
		SetClipboardData(CF_TEXT, handle);
		CloseClipboard();
		}
}

void CMatrix::WriteAsCSVFile(const CString& filename) const
{
	// create the file to write to
	CFile	file ;
	
	try {
		if (file.Open(filename, CFile::modeWrite | CFile::modeCreate))
			{
			CString	text ;
			for (int i = 0 ; i < m_NumRows ; ++i)
				{
				text = GetRowAsText(i) ;
				file.Write(text, text.GetLength()) ;
				file.Write("\r\n", 2) ;			// eol
				}
			file.Close() ;
			}
		}
	catch (CFileException &e)
		{
		// we have has a problem, determine what it is
		switch (e.m_cause)
			{
			// errors that should not occur
			case CFileException::none :
			case CFileException::fileNotFound :
			case CFileException::removeCurrentDir :
			case CFileException::endOfFile :
				break ;
			// errors that require us to move the destination file
			case CFileException::badPath :
				AfxMessageBox("Bad file path") ;
				return ;
			case CFileException::directoryFull :
				AfxMessageBox("The destination directory is full") ;
				return ;
			case CFileException::diskFull :
				AfxMessageBox("The destination disk is full") ;
				return ;
			case CFileException::generic :
				AfxMessageBox("Generic (unknown error)") ;
				return ;
			case CFileException::tooManyOpenFiles :
				AfxMessageBox("Too many files are open") ;
				return ;
			case CFileException::accessDenied :
				AfxMessageBox("Access denied") ;
				return ;
			case CFileException::invalidFile :
				AfxMessageBox("Invalid file or name") ;
				return ;
			case CFileException::badSeek :
				AfxMessageBox("Bad seek on file") ;
				return ;
			case CFileException::hardIO :
				AfxMessageBox("Hardware IO error") ;
				return ;
			case CFileException::sharingViolation :
				AfxMessageBox("File sharing violation") ;
				return ;
			case CFileException::lockViolation :
				AfxMessageBox("File locking violation") ;
				return ;
			}
		}
}

// this function reads a file for "," separated values and creates a matrix object from it
CMatrix CMatrix::ReadFromCSVFile(const CString& filename)
{
	int		col_size = 0 ;
	int		row_size = 0 ;
	CFile	file ;

	try {
		if (file.Open(filename, CFile::modeRead))
			{
			CString	text = ReadLine(file) ;				// get a line from the file
			CString	token ;
			// count how many elements across their are
			int pos = 0 ;
			while (pos < text.GetLength())
				{
				pos = GetStringToken(text, token, pos, ',') ;
				col_size++ ;
				}
			// allocate an array to hold the data
			double	*pData = new double[col_size] ;
			CMatrix	m(col_size, 1) ;					// create a 1 row matrix which we will concatinate rows to

			while (text.GetLength() > 0)
				{
				int i = 0 ;
				pos = 0 ;
				while (pos < text.GetLength())
					{
					pos = GetStringToken(text, token, pos, ',') ;
					pData[i++] = atof(token) ;
					}
				ASSERT(i == col_size) ;
				text = ReadLine(file) ;
				if (row_size == 0)
					{
					// need to copy in the first row of data
					for (i = 0 ; i < col_size ; ++i)
						m.SetElement(i, 0, pData[i]) ;
					}
				else
					m.AddRow(pData) ;			// append to end of matrix
				row_size++ ;
				}
			delete []pData ;
			file.Close() ;
			return m ;
			}
		}
	catch (CFileException &e)
		{
		// we have has a problem, determine what it is
		switch (e.m_cause)
			{
			// errors that should not occur
			case CFileException::none :
			case CFileException::fileNotFound :
			case CFileException::removeCurrentDir :
			case CFileException::endOfFile :
				break ;
			// errors that require us to move the destination file
			case CFileException::badPath :
				AfxMessageBox("Bad file path") ;
				break ;
			case CFileException::directoryFull :
				AfxMessageBox("The destination directory is full") ;
				break ;
			case CFileException::diskFull :
				AfxMessageBox("The destination disk is full") ;
				break ;
			case CFileException::generic :
				AfxMessageBox("Generic (unknown error)") ;
				break ;
			case CFileException::tooManyOpenFiles :
				AfxMessageBox("Too many files are open") ;
				break ;
			case CFileException::accessDenied :
				AfxMessageBox("Access denied") ;
				break ;
			case CFileException::invalidFile :
				AfxMessageBox("Invalid file or name") ;
				break ;
			case CFileException::badSeek :
				AfxMessageBox("Bad seek on file") ;
				break ;
			case CFileException::hardIO :
				AfxMessageBox("Hardware IO error") ;
				break ;
			case CFileException::sharingViolation :
				AfxMessageBox("File sharing violation") ;
				break ;
			case CFileException::lockViolation :
				AfxMessageBox("File locking violation") ;
				break ;
			}
		}
	CMatrix problem ;
	return problem ;
}


// returns a row as , separated values
CString CMatrix::GetRowAsText(int row) const
{
	ASSERT(row >= 0) ;						// bad row
	ASSERT(row < m_NumRows) ;					// bad row
	CString	text ;
	CString	token ;

	for (int i = 0 ; i < m_NumColumns ; ++i)
		{
		if (i > 0)
			text += "," ;
		token.Format("%e", GetElement(i, row)) ;
		text += token ;
		}
	return text ;
}

// read a line of text from the current file
CString CMatrix::ReadLine(CFile& file)
{
	CString	line("") ;
	char	ch[3] ;
	DWORD	hBytesRead	= 0 ;

	while (true)
		{
		hBytesRead = file.Read(&ch[0], 2) ;
		if (hBytesRead == 2)
			file.Seek(-1L, CFile::current) ;		
		if (hBytesRead == 0)
			break ;					// end of file
		if (ch[0] == '\n')
			{
			if (ch[1] == '\r')
				file.Seek(1L, CFile::current) ;
			break ;
			}
		if (ch[0] == '\r')
			{
			ch[0] = '\n' ;
			if (ch[1] == '\n')
				file.Seek(1L, CFile::current) ;
			break ;
			}
		if (ch[0] != '\015')
			{
			// ignore LF characters
			ch[1] = '\0' ;
			line += ch ;
			}
		}
	return line ;
}

int CMatrix::GetStringToken(CString source, CString &destination, int start, char ch)
{
	ASSERT(start >= 0) ;

	// at the end of the source string ?
	if (start >= source.GetLength())
		{
		destination = "" ;					// no token available
		return source.GetLength() ;			// return @ end of string
		}
	
	// skip past any termination characters at the start position
	while (start < source.GetLength())
		{
		if (ch == source[start])
			start++ ;
		else
			break ;
		}
	// find the next occurance of the terminating character
	int pos = source.Find(ch, start) ;			// find termination character
	if (pos < 0)
		{
		// terminator not found, just return the remainder of the string
		destination = source.Right(source.GetLength() - start) ;
		return source.GetLength() ;
		}
	// found terminator, get sub string
	destination = source.Mid(start, pos - start) ;
	return pos ;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧亚一区二区三区| jlzzjlzz亚洲女人18| 国产精品不卡视频| 91精品国产福利在线观看| 国产suv一区二区三区88区| 亚洲一级二级三级| 中文在线免费一区三区高中清不卡 | 精品国产91久久久久久久妲己| 成人午夜精品在线| 久久精品国产一区二区三区免费看| 亚洲色欲色欲www在线观看| 精品入口麻豆88视频| 欧美日韩国产乱码电影| www.亚洲人| 国产成人免费视频精品含羞草妖精| 天天影视色香欲综合网老头| 中文字幕一区二区三区av| 久久亚区不卡日本| 日韩欧美一区中文| 69堂精品视频| 91国在线观看| 色综合久久久久综合体桃花网| 韩国精品一区二区| 久色婷婷小香蕉久久| 丝袜美腿亚洲一区二区图片| 亚洲人成网站影音先锋播放| 国产精品拍天天在线| 国产亚洲va综合人人澡精品| 久久综合色之久久综合| 欧美xxxxxxxx| 日韩一区二区免费电影| 欧美久久久久中文字幕| 欧美视频三区在线播放| 欧美性生活影院| 在线观看三级视频欧美| 欧洲中文字幕精品| 欧美伊人久久久久久久久影院| 99免费精品在线| 99精品视频一区二区三区| 成人福利在线看| 成人一道本在线| 北条麻妃一区二区三区| 91首页免费视频| 色综合久久久久网| 在线亚洲精品福利网址导航| 欧美中文字幕一二三区视频| 欧美主播一区二区三区| 制服丝袜av成人在线看| 麻豆高清免费国产一区| 亚洲乱码中文字幕| 亚洲国产一区二区三区青草影视| 一区二区三区电影在线播| 一区二区激情小说| 午夜国产精品一区| 麻豆精品视频在线| 国产成人夜色高潮福利影视| 国产一区美女在线| 菠萝蜜视频在线观看一区| 91在线一区二区| 欧美日韩成人综合天天影院| 91精品麻豆日日躁夜夜躁| 精品国产91亚洲一区二区三区婷婷 | 国产精品黄色在线观看| 亚洲精品ww久久久久久p站| 天天色综合成人网| 国内精品伊人久久久久av影院| 韩国一区二区在线观看| av电影在线观看一区| 欧美日韩高清一区二区三区| 日韩欧美不卡一区| 亚洲欧洲另类国产综合| 亚洲一区二区三区四区五区黄 | 久久精品人人做人人综合| 日韩伦理av电影| 日韩精彩视频在线观看| 高清在线不卡av| 欧美三级电影在线观看| 337p日本欧洲亚洲大胆精品 | 亚洲综合自拍偷拍| 麻豆一区二区三| av一区二区三区在线| 91精品国产91综合久久蜜臀| 国产精品久久久久久久久图文区| 亚洲久本草在线中文字幕| 久久国产夜色精品鲁鲁99| 成人激情综合网站| 91麻豆精品国产91久久久久久| 欧美国产日韩亚洲一区| 丝瓜av网站精品一区二区| 国产成人在线观看免费网站| 在线一区二区三区四区五区| 久久久久青草大香线综合精品| 一区二区在线电影| 丁香桃色午夜亚洲一区二区三区| 欧美视频完全免费看| 国产精品网站在线观看| 免费在线观看一区二区三区| 色悠悠久久综合| 久久久精品免费免费| 日韩精品国产欧美| 色视频成人在线观看免| 国产视频在线观看一区二区三区| 丝袜诱惑亚洲看片| 91在线视频播放| 国产日产欧美一区二区视频| 午夜精品福利一区二区蜜股av| 成人免费毛片片v| 欧美成人精精品一区二区频| 亚洲成av人片在线观看| 色又黄又爽网站www久久| 欧美国产日韩精品免费观看| 激情综合网av| 制服丝袜亚洲精品中文字幕| 一区二区三区四区在线| 粉嫩13p一区二区三区| 欧美精品一区二区三区四区| 欧美96一区二区免费视频| 欧美三区在线视频| 夜夜嗨av一区二区三区网页| 91丝袜呻吟高潮美腿白嫩在线观看| 久久奇米777| 美国一区二区三区在线播放| 欧美性猛交xxxx乱大交退制版 | 免费在线看成人av| 欧美高清精品3d| 亚洲成人精品在线观看| 色先锋aa成人| 亚洲激情在线播放| 日本高清不卡视频| 一区二区三区四区中文字幕| 91麻豆国产在线观看| 国产精品成人一区二区三区夜夜夜| 成人综合婷婷国产精品久久 | 亚洲一级不卡视频| 欧美午夜免费电影| 亚洲高清免费在线| 久久 天天综合| 色婷婷综合激情| 一级特黄大欧美久久久| 91免费版pro下载短视频| 一区免费观看视频| 色老综合老女人久久久| 亚洲影视在线播放| 欧美日韩高清不卡| 免费观看30秒视频久久| 久久综合国产精品| 国产成人免费在线视频| 国产三级欧美三级日产三级99 | 成人动漫一区二区| 亚洲色图一区二区| 欧洲中文字幕精品| 石原莉奈一区二区三区在线观看| 欧美老年两性高潮| 久久99精品国产麻豆婷婷| 精品国产乱码久久久久久老虎| 国产在线不卡一区| 国产精品久久久久久久浪潮网站| 色婷婷综合久久久中文字幕| 亚洲高清免费一级二级三级| 日韩三级电影网址| 国产999精品久久久久久绿帽| 亚洲三级电影网站| 7777女厕盗摄久久久| 国产另类ts人妖一区二区| 亚洲视频免费观看| 欧美日韩情趣电影| 国产一区二区三区四| 国产精品久线观看视频| 欧美性大战xxxxx久久久| 九九视频精品免费| 亚洲日本乱码在线观看| 91麻豆精品国产91| 不卡的av在线| 欧美a级一区二区| 国产精品传媒在线| 91精品视频网| 99国产一区二区三精品乱码| 婷婷成人激情在线网| 国产精品天干天干在观线| 欧美午夜视频网站| 成人自拍视频在线| 日本色综合中文字幕| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 精品无人码麻豆乱码1区2区 | 亚洲黄色免费网站| 精品不卡在线视频| 欧美亚州韩日在线看免费版国语版| 另类欧美日韩国产在线| 亚洲男人的天堂在线aⅴ视频| 91精品国产综合久久香蕉麻豆| 国产成人av电影免费在线观看| 亚洲一区二区成人在线观看| 久久精品一区二区三区四区| 欧美婷婷六月丁香综合色| 国产99一区视频免费| 日韩电影在线看| 最近中文字幕一区二区三区| 日韩美女视频一区二区在线观看| 色婷婷久久久亚洲一区二区三区| 精品亚洲国产成人av制服丝袜|