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

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

?? matrix.inl

?? 圖像分割算法
?? INL
?? 第 1 頁 / 共 3 頁
字號:
template< class T >
Matrix<T>& Matrix<T>::Add(Matrix<T>& m)
{
	if(!Matrix<T>::IsCompatible(*this, m))
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Matrix sizes are not compatible!");
	}

	for(int i=0;i<this->length;i++)
	{
		this->data[i] += m.data[i];
	}
	
	return *this;
}

template< class T >
Matrix<T>& Matrix<T>::Subtract(Matrix<T>& m)
{
	if(!Matrix<T>::IsCompatible(*this, m))
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Matrix sizes are not compatible!");
	}

	for(int i=0;i<this->length;i++)
	{
		this->data[i] -= m.data[i];
	}
	
	return *this;
}

template< class T >
Matrix<T>& Matrix<T>::Multiply(Matrix<T>& m)
{
	if(!Matrix<T>::IsCompatible(*this, m))
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Matrix sizes are not compatible!");
	}

	for(int i=0;i<this->length;i++)
	{
		this->data[i] *= m.data[i];
	}
	
	return *this;
}

template< class T >
Matrix<T>& Matrix<T>::Divide(Matrix<T>& m)
{
	if(!Matrix<T>::IsCompatible(*this, m))
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Matrix sizes are not compatible!");
	}

	for(int i=0;i<this->length;i++)
	{
		if(m.data[i] != 0)
		{
			this->data[i] /= m.data[i];
		}
		else
		{
			cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
			Utility::RunTimeError("Divide by zero in matrix division!");
		}
	}
	
	return *this;
}

// /////////////
// Arithmetic operation between "this" matrix and a value
// /////////////

template< class T >
Matrix<T>& Matrix<T>::Add(T v)
{
	for(int i=0;i<this->length;i++)
	{
		this->data[i] += v;
	}
	return *this;
}

template< class T >
Matrix<T>& Matrix<T>::Subtract(T v)
{
	for(int i=0;i<this->length;i++)
	{
		this->data[i] -= v;
	}
	return *this;
}

template< class T >
Matrix<T>& Matrix<T>::Multiply(T v)
{
	for(int i=0;i<this->length;i++)
	{
		this->data[i] *= v;
	}
	return *this;
}

template< class T >
Matrix<T>& Matrix<T>::Divide(T v)
{
	if(v == 0)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Divide by zero in matrix by value division!");
	}
	
	for(int i=0;i<this->length;i++)
	{
		this->data[i] /= v;
	}
	return *this;
}






// /////////
// OPERATORS
// /////////


template< class T >
Matrix<T>& Matrix<T>::operator= (Matrix<T>& m)
{
	if(&m != this)
	{
		ndims = m.ndims;
		length = m.length;
		xDim = m.xDim;
		yDim = m.yDim;
		data = m.data;
		columns = m.columns;
		
		delete clean;
		clean = new (std::nothrow) Cleaner<T>(data, columns);
		Utility::CheckPointer(clean);
	}	
	
	return *this;
}


//template< class T >
//Matrix<T>& Matrix<T>::operator= (Array<T>& m)
//{
//	ndims = 2;
//	xDim = 0;
//	yDim = 0;
//	data = 0;
//	columns = 0;
//
//	if(m.ndims == 2){
//		length = m.length;
//		data = m.data;
//		xDim = m.xDim;
//		yDim = m.yDim;
//
//		columns = new (std::nothrow) Vector<T>[Columns()];
//		Utility::CheckPointer(columns);
//		for(int i=0; i<Columns(); i++)
//		{
//			columns[i].Set(&(data[i*Rows()]), Rows());
//		}
//
//		delete clean;
//		clean = new (std::nothrow) Cleaner<T>(data, columns);
//		Utility::CheckPointer(clean);
//	}
//	else if(m.ndims > 0) // Convert to row matrux
//	{
//		length = m.length;
//		data = m.data;
//		xDim = length;
//		yDim = 1;
//		
//		columns = new (std::nothrow) Vector<T>[1];
//		Utility::CheckPointer(columns);
//		columns[0].Set(&(data[0]),length);
//
//		delete clean;
//		clean = new (std::nothrow) Cleaner<T>(data, columns);
//		Utility::CheckPointer(clean);
//		
//		Utility::Warning("Array (not of dimension 2) is converted to row Matrix. dimensionality information is lost.");
//	}
//	
//
//	return *this;
//}

template< class T >
Matrix<T>& Matrix<T>::operator= (Vector<T>& m)
{
	*this = (Matrix<T>)m;
	return *this;
}


template< class T >
Matrix<T>& Matrix<T>::operator= (SubMatrix<T>& m)
{
	if(xDim != m.xDim || yDim != m.yDim)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("All Matrix and SubMatrix dimensions should agree!");
	}
	for(int i=0;i<m.xDim;i++)
	{
		for(int j=0;j<m.yDim;j++)
		{
			columns[i].data[j] = m[i][j];
		}
	}
	
	return *this;
}



template< class T >
Matrix<T>& Matrix<T>::operator= (string str)
{
	Matrix<T> temp(str);
	*this = temp;
	return *this;
}


// ////
//Unary operators
// ////

/// \brief Unary +. Does not have any effect. Returns the same matrix. 
template< class T >
inline Matrix<T> Matrix<T>::operator+ ()
{
	return *this;
}


/// \brief Unary -
template< class T >
inline Matrix<T> Matrix<T>::operator- ()
{
	Matrix<T> temp(yDim, xDim);
	for(int i=0;i<length;i++)
	{
		temp.data[i] = - data[i];
	}
	return temp;
}



template< class T >
inline Matrix<int> Matrix<T>::operator! ()
{
	Matrix<int> temp(yDim, xDim);
	for(int i=0;i<length;i++)
	{
		if(data[i] == 0)
		{
			temp.Data()[i] = 1;
		}
		else
		{
			temp.Data()[i] = 0;
		}
	}
	return temp;
}


/// \brief Transpose ~
template< class T >
inline Matrix<T> Matrix<T>::operator~ ()
{
	return Matrix<T>::Transpose(*this);
}



//---------------

/// \brief Matrix element access (sequential: column scan). Bounds are checked.
template< class T >
inline T& Matrix<T>::Elem(const int i)
{
	if(i<0 || i>=length)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}
	return data[i];
}

/// \brief Matrix element access (sequential: column scan). Bounds are not checked.
template< class T >
inline T& Matrix<T>::ElemNC(const int i)
{
	return data[i];
}


/// \brief Matrix element access (row,col). Bounds are checked.
template< class T >
inline T& Matrix<T>::Elem(const int j, const int i)
{
	if(i<0 || i>=xDim || j<0 || j>=yDim)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}

	return columns[i].data[j];

}


/// \brief Matrix element access (row,col). Bounds are not checked.
template< class T >
inline T& Matrix<T>::ElemNC(const int j, const int i)
{
	return columns[i].data[j];

}


/// \brief Matrix element access using coordinates (x,y). Bounds are checked.
template< class T >
inline T& Matrix<T>::Coor(const int i, const int j)
{
	if(i<0 || i>=dims[0] || j<0 || j>=dims[1])
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}

	return columns[i].data[j];

}


/// \brief Matrix element access using coordinates (x,y). Bounds are not checked.
template< class T >
inline T& Matrix<T>::CoorNC(const int i, const int j)
{
	return columns[i].data[j];

}


//---------------


/// \brief Matrix element access (sequential: column scan). Bounds are checked (See ElemNC() for element access with no bounds check).
template< class T >
inline T& Matrix<T>::operator() (const int i)
{
	if(i<0 || i>=length)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}
	return data[i];
}

/// \brief Matrix element access (row,col). Bounds are checked (See ElemNC() for element access with no bounds check).
template< class T >
inline T& Matrix<T>::operator() (const int j, const int i)
{
#ifdef CIMPL_BOUNDS_CHECK
	if(i<0 || i>=xDim || j<0 || j>=yDim)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}
#endif

	return columns[i].data[j];

}


/// \brief Returns a pointer to the beginning of a column.
template< class T >
inline Vector<T>& Matrix<T>::operator[] (const int i)
{
	return columns[i];
}





template< class T >
inline SubMatrix<T> Matrix<T>::operator() (const int row1, const int row2, const int col1, const int col2)
{
	if(row1<0 || row1>=YDim() || row2<0 || row2>=YDim())
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}
	if(row1 > row2)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Second slice parameter cannot be less than the first parameter!");
	}


	if(col1<0 || col1>=XDim() || col2<0 || col2>=XDim())
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Index outside bounds!");
	}
	if(col1 > col2)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Second slice parameter cannot be less than the first parameter!");
	}

	
	SubMatrix<T> temp;
	temp.xDim = col2-col1+1;
	temp.yDim = row2-row1+1;
	temp.columns = new (std::nothrow) Vector<T>[temp.xDim];
	Utility::CheckPointer(temp.columns);
	temp.clean = new (std::nothrow) Cleaner<T>(temp.columns);
	Utility::CheckPointer(temp.clean);

	for(int j=col1; j<=col2; j++)
	{
		temp.columns[j-col1].Set(&(columns[j].data[row1]),  row2-row1+1);
	}

	return temp;
}


template< class T >
SubMatrix<T> Matrix<T>::operator() (string str1, string str2)
{
	int row1, row2, col1, col2;
	vector<string> bounds1 = Utility::Split(str1, ":");
	vector<string> bounds2 = Utility::Split(str2, ":");
	
	if(str1 == ":")
	{
		row1 = 0;
		row2 = yDim-1;
	}
	else if(bounds1.size() == 2)
	{
		row1 = Utility::ToInt(bounds1[0]);
		row2 = Utility::ToInt(bounds1[1]);
	}
	else
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Incorrect slice argument. String cannot be parsed!");
	}

	if(str2 == ":")
	{
		col1 = 0;
		col2 = xDim-1;
	}
	else if(bounds2.size() == 2)
	{
		col1 = Utility::ToInt(bounds2[0]);
		col2 = Utility::ToInt(bounds2[1]);
	}
	else
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("Incorrect slice argument. String cannot be parsed!");
	}
	
	return this->operator()(row1, row2, col1, col2);

}


template< class T >
Vector<T> Matrix<T>::operator() (string str)
{
	Vector<T> temp = (Vector<T>)*this;
	return temp(str);
}

// ////
// Arithmetic operators
// ////

template< class T >
Matrix<T>& Matrix<T>::operator+= (Matrix<T>& m)
{
	return this->Add(m);
}

template< class T >
Matrix<T>& Matrix<T>::operator-= (Matrix<T>& m)
{
	return this->Subtract(m);
}

template< class T >
Matrix<T>& Matrix<T>::operator*= (Matrix<T>& m)
{
	return this->Multiply(m);
}

template< class T >
Matrix<T>& Matrix<T>::operator/= (Matrix<T>& m)
{
	return this->Divide(m);
}


template< class T >
Matrix<T>& Matrix<T>::operator+= (T v)
{
	return this->Add(v);
}

template< class T >
Matrix<T>& Matrix<T>::operator-= (T v)
{
	return this->Subtract(v);
}

template< class T >
Matrix<T>& Matrix<T>::operator*= (T v)
{
	return this->Multiply(v);
}

template< class T >
Matrix<T>& Matrix<T>::operator/= (T v)
{
	return this->Divide(v);
}


// TYPE CONVERSIONS

//template< class T >
//Matrix<T>::Matrix(Array<T> &m) 
//{
//	ndims = 2;
//	xDim = 0;
//	yDim = 0;
//	data = 0;
//	columns = 0;
//
//	if(m.ndims == 2){
//		length = m.length;
//		data = m.data;
//		xDim = m.XDim();
//		yDim = m.YDim();
//		
//		columns = new (std::nothrow) Vector<T>[Columns()];
//		Utility::CheckPointer(columns);
//		for(int i=0; i<Columns(); i++)
//		{
//			columns[i].Set(&(data[i*Rows()]), Rows());
//		}
//		clean = new (std::nothrow) Cleaner<T>(data, columns);
//		Utility::CheckPointer(clean);
//
//	}
//	else if(m.ndims > 0)
//	{
//		length = m.length;
//		data = m.data;
//		xDim = 1;
//		yDim = length;
//		
//		columns = new (std::nothrow) Vector<T>[1];
//		Utility::CheckPointer(columns);
//		columns[0].Set(&(data[0]),length);
//		clean = new (std::nothrow) Cleaner<T>(data, columns);
//		Utility::CheckPointer(clean);
//		
//		if(ndims != 1)
//		{
//			Utility::Warning("Array (which was not of dimension 2) is converted to a Nx1 (column) Matrix. Dimensionality information is lost.");
//		}
//	}
//
//}


template< class T >
Matrix<T>::Matrix(Vector<T> &v) 
{
	ndims = 2;

	length = v.length;
	data = v.data;
	xDim = 1;
	yDim = length;
	
	columns = new (std::nothrow) Vector<T>[1];
	Utility::CheckPointer(columns);
	columns[0].Set(&(data[0]),length);
	clean = new (std::nothrow) Cleaner<T>(data, columns);
	Utility::CheckPointer(clean);
	
}


template< class T >
Matrix<T>::Matrix(SubMatrix<T> &m) 
{
	if(m.yDim < 1 || m.xDim < 1)
	{
		cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
		Utility::RunTimeError("All Matrix dimensions should be larger than 0!");
	}

	ndims = 2;
	length = m.yDim*m.xDim;
	xDim = m.xDim;
	yDim = m.yDim;
	data = new (std::nothrow) T[length];
	Utility::CheckPointer(data);

	columns = new (std::nothrow) Vector<T>[xDim];
	Utility::CheckPointer(columns);
	for(int i=0; i<xDim; i++)
	{
		columns[i].Set(&(data[i*yDim]), yDim);
	}
	
	clean = new (std::nothrow) Cleaner<T>(data, columns);
	Utility::CheckPointer(clean);

	for(int i=0;i<m.xDim;i++)
	{
		for(int j=0;j<m.yDim;j++)
		{
			columns[i].data[j] = m[i][j];
		}
	}

}










?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久99| 久久成人免费日本黄色| 国产91精品在线观看| 日本一区免费视频| 成人黄色a**站在线观看| 国产精品久久久久久久蜜臀| 北岛玲一区二区三区四区| 7777精品伊人久久久大香线蕉经典版下载 | 久久精品99国产精品| 欧美顶级少妇做爰| 激情综合五月婷婷| 国产欧美一区二区三区沐欲| 成人午夜av在线| 亚洲毛片av在线| 91精品国产综合久久香蕉麻豆| 综合婷婷亚洲小说| 欧美影院午夜播放| 亚洲国产高清在线| 色94色欧美sute亚洲线路一久 | 亚洲精品国产一区二区三区四区在线| 另类专区欧美蜜桃臀第一页| 26uuuu精品一区二区| av成人老司机| 蜜臀av一区二区在线观看| 国产日韩欧美一区二区三区乱码| 久久超碰97人人做人人爱| 亚洲国产精品99久久久久久久久| 国产一区二区成人久久免费影院| 欧美一区二区美女| 丁香婷婷深情五月亚洲| 午夜精品免费在线观看| 久久综合给合久久狠狠狠97色69| 捆绑调教一区二区三区| 日日夜夜精品视频免费 | 亚洲成av人片在线| 久久影院午夜片一区| 色综合久久久久| 综合久久一区二区三区| 91精品国产一区二区三区| 成人va在线观看| 麻豆国产精品777777在线| 1024亚洲合集| 久久一区二区三区国产精品| 欧美亚洲尤物久久| 懂色av中文一区二区三区| 国产欧美日韩在线视频| 欧美日本在线一区| 99re视频精品| 国产一区二区三区精品视频| 亚洲第一电影网| 亚洲欧洲三级电影| 久久久另类综合| 欧美日韩mp4| 欧美性三三影院| jlzzjlzz欧美大全| 国产一区二区三区不卡在线观看| 26uuu欧美| 成人黄页毛片网站| 国产一区在线观看视频| 视频一区二区三区中文字幕| 国产精品人成在线观看免费| 日韩免费视频一区二区| 欧美日韩视频在线一区二区| 成人精品免费看| 成人免费视频视频在线观看免费| 中文字幕av在线一区二区三区| caoporm超碰国产精品| 国产乱码精品一区二区三区忘忧草 | 粉嫩av一区二区三区| 亚洲欧美日韩国产手机在线| 国产日韩欧美在线一区| 色菇凉天天综合网| 91尤物视频在线观看| 成人免费高清在线观看| 国产精品中文字幕欧美| 精品一区二区在线播放| 蜜臀a∨国产成人精品| 日本不卡一区二区三区高清视频| 久久久久97国产精华液好用吗| 91亚洲国产成人精品一区二三| 天天做天天摸天天爽国产一区| 精品国产精品网麻豆系列| av资源站一区| 91玉足脚交白嫩脚丫在线播放| 秋霞午夜鲁丝一区二区老狼| 欧美激情综合五月色丁香 | 激情综合五月天| 国产原创一区二区| 国产美女娇喘av呻吟久久| 国产精品自拍一区| 成人看片黄a免费看在线| 91丝袜美腿高跟国产极品老师| 奇米精品一区二区三区在线观看一| 国产欧美日韩视频一区二区| 国产日韩欧美综合在线| 国产精品久久久久久久久图文区| 99久精品国产| 欧洲精品视频在线观看| 欧美日韩激情一区二区三区| 成人av在线播放网站| 91蜜桃视频在线| 欧美日韩免费电影| 欧美乱熟臀69xxxxxx| 99久久99久久精品免费看蜜桃 | 免费成人在线观看| 国产精品一区三区| 99久久精品免费| 777亚洲妇女| 欧美综合一区二区三区| 欧美放荡的少妇| 久久久久高清精品| 一区二区三区四区激情| 日韩中文字幕一区二区三区| 国产一区二区三区四区五区美女| 麻豆精品一区二区av白丝在线| 午夜电影网亚洲视频| 国产在线播放一区三区四| 蜜臀av一区二区| 免费观看在线综合色| 国产成人在线色| 欧美日韩一级片网站| 国产网站一区二区| 久久嫩草精品久久久久| 专区另类欧美日韩| 亚洲天天做日日做天天谢日日欢| 国产精品美女视频| 日韩电影免费在线观看网站| 成人免费毛片片v| 日韩欧美国产一区二区三区| 中文字幕一区二区三区蜜月| 麻豆视频一区二区| 欧洲一区二区av| 国产精品免费丝袜| 日本成人中文字幕在线视频| 91色.com| 国产欧美一区二区精品仙草咪| 国产精品美女一区二区在线观看| 中文字幕中文字幕一区| 久久91精品国产91久久小草| 色94色欧美sute亚洲13| 国产亚洲欧美在线| 中文字幕亚洲不卡| 激情综合色播五月| 9191久久久久久久久久久| 亚洲视频在线一区观看| 国产一区二区在线看| 丁香婷婷综合五月| 精品久久久久久久人人人人传媒 | 懂色av中文一区二区三区| 欧美精品乱码久久久久久按摩 | 婷婷夜色潮精品综合在线| 免费不卡在线视频| 欧美日韩精品欧美日韩精品| 亚洲精品免费在线播放| 波多野结衣的一区二区三区| 久久久99精品免费观看不卡| 国产精品久久毛片av大全日韩| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲.国产.中文慕字在线| 精品一区二区三区香蕉蜜桃| 欧美日韩国产综合视频在线观看| 亚洲精品在线观| 久久99热狠狠色一区二区| 欧美一级在线视频| 日韩精品一卡二卡三卡四卡无卡 | 国产精品99久久久久久似苏梦涵| 99久久精品国产毛片| 欧美精品丝袜久久久中文字幕| 国产日韩一级二级三级| 国产美女久久久久| 久久精品视频一区二区三区| 精品综合免费视频观看| 日韩一级免费观看| 久久精品噜噜噜成人av农村| 日韩一区二区电影网| 美国毛片一区二区三区| 久久免费视频一区| 国产精品88av| 国产精品久久久久影视| 99久久婷婷国产综合精品| 1024国产精品| 国产在线国偷精品产拍免费yy| 91免费在线播放| 洋洋成人永久网站入口| 国产精品一区二区你懂的| 国产欧美日本一区二区三区| 国产成人精品亚洲日本在线桃色 | 成人精品在线视频观看| 中文字幕色av一区二区三区| 97久久超碰国产精品电影| 一区二区三区精品视频| 欧美人与z0zoxxxx视频| 久久99精品一区二区三区三区| 91在线观看美女| 亚洲成人精品一区二区| 精品国产亚洲一区二区三区在线观看| 亚洲成人综合在线| 精品第一国产综合精品aⅴ| 日韩精品亚洲一区二区三区免费| 色妹子一区二区|