コード例 #1
0
ファイル: MatrixOps.cpp プロジェクト: hihiy/IntelliVoice
Matrix<T> *MatrixOps<T>::GetSubMatrix (const Matrix<T> *const matrix, ssi_size_t start, ssi_size_t stop, MATRIX_DIMENSION dimension) {

	switch (dimension) {
		case MATRIX_DIMENSION_ROW:
			return GetSubMatrix (matrix, start, stop, 0, matrix->cols - 1);
		case MATRIX_DIMENSION_COL:
			return GetSubMatrix (matrix, 0, matrix->rows - 1, start, stop);
	}

	return NULL;
}
コード例 #2
0
GetSubMatrix BaseMatrix::column(int first_col) const
{
   REPORT
   Tracer tr("SubMatrix(column)");
   int c = first_col - 1;
   if (c<0) Throw(SubMatrixDimensionException());
   return GetSubMatrix(this, 0, -1, c, 1, false);
}
コード例 #3
0
GetSubMatrix BaseMatrix::row(int first_row) const
{
   REPORT
   Tracer tr("SubMatrix(row)");
   int a = first_row - 1;
   if (a<0) Throw(SubMatrixDimensionException());
   return GetSubMatrix(this, a, 1, 0, -1, false);
}
コード例 #4
0
GetSubMatrix BaseMatrix::columns(int first_col, int last_col) const
{
   REPORT
   Tracer tr("SubMatrix(columns)");
   int c = first_col - 1; int d = last_col - first_col + 1;
   if (c<0 || d<0) Throw(SubMatrixDimensionException());
                             // allow zero rows or columns
   return GetSubMatrix(this, 0, -1, c, d, false);
}
コード例 #5
0
GetSubMatrix BaseMatrix::rows(int first_row, int last_row) const
{
   REPORT
   Tracer tr("SubMatrix(rows)");
   int a = first_row - 1; int b = last_row - first_row + 1;
   if (a<0 || b<0) Throw(SubMatrixDimensionException());
                             // allow zero rows or columns
   return GetSubMatrix(this, a, b, 0, -1, false);
}
コード例 #6
0
GetSubMatrix BaseMatrix::sym_submatrix(int first_row, int last_row) const
{
   REPORT
   Tracer tr("sym_submatrix");
   int a = first_row - 1; int b = last_row - first_row + 1;
   if (a<0 || b<0) Throw(SubMatrixDimensionException());
                             // allow zero rows or columns
   return GetSubMatrix( this, a, b, a, b, true);
}
コード例 #7
0
ファイル: submat.cpp プロジェクト: 151706061/sofa
GetSubMatrix& BaseMatrix::Row(int first_row) const
#else
GetSubMatrix BaseMatrix::Row(int first_row) const
#endif
{
   REPORT
   Tracer tr("SubMatrix(row)");
   int a = first_row - 1;
   if (a<0) Throw(SubMatrixDimensionException());
#ifdef TEMPS_DESTROYED_QUICKLY
   GetSubMatrix* x = new GetSubMatrix(this, a, 1, 0, -1, false);
   MatrixErrorNoSpace(x);
   return *x;
#else
   return GetSubMatrix(this, a, 1, 0, -1, false);
#endif
}
コード例 #8
0
ファイル: submat.cpp プロジェクト: 151706061/sofa
GetSubMatrix& BaseMatrix::Column(int first_col) const
#else
GetSubMatrix BaseMatrix::Column(int first_col) const
#endif
{
   REPORT
   Tracer tr("SubMatrix(column)");
   int c = first_col - 1;
   if (c<0) Throw(SubMatrixDimensionException());
#ifdef TEMPS_DESTROYED_QUICKLY
   GetSubMatrix* x = new GetSubMatrix(this, 0, -1, c, 1, false);
   MatrixErrorNoSpace(x);
   return *x;
#else
   return GetSubMatrix(this, 0, -1, c, 1, false);
#endif
}
コード例 #9
0
ファイル: submat.cpp プロジェクト: 151706061/sofa
GetSubMatrix& BaseMatrix::Rows(int first_row, int last_row) const
#else
GetSubMatrix BaseMatrix::Rows(int first_row, int last_row) const
#endif
{
   REPORT
   Tracer tr("SubMatrix(rows)");
   int a = first_row - 1; int b = last_row - first_row + 1;
   if (a<0 || b<0) Throw(SubMatrixDimensionException());
                             // allow zero rows or columns
#ifdef TEMPS_DESTROYED_QUICKLY
   GetSubMatrix* x = new GetSubMatrix(this, a, b, 0, -1, false);
   MatrixErrorNoSpace(x);
   return *x;
#else
   return GetSubMatrix(this, a, b, 0, -1, false);
#endif
}
コード例 #10
0
ファイル: submat.cpp プロジェクト: 151706061/sofa
GetSubMatrix& BaseMatrix::Columns(int first_col, int last_col) const
#else
GetSubMatrix BaseMatrix::Columns(int first_col, int last_col) const
#endif
{
   REPORT
   Tracer tr("SubMatrix(columns)");
   int c = first_col - 1; int d = last_col - first_col + 1;
   if (c<0 || d<0) Throw(SubMatrixDimensionException());
                             // allow zero rows or columns
#ifdef TEMPS_DESTROYED_QUICKLY
   GetSubMatrix* x = new GetSubMatrix(this, 0, -1, c, d, false);
   MatrixErrorNoSpace(x);
   return *x;
#else
   return GetSubMatrix(this, 0, -1, c, d, false);
#endif
}
コード例 #11
0
YSRESULT YsMatrix::GetDeterminantMatrix(YsMatrix &m) const
{
	int r,c;
	double detSub;
	YsMatrix sub;
	static const double modulus[2]={1.0,-1.0};

	m.CreateWithoutClear(nRow,nColumn);
	for(r=1; r<=nRow; r++)
	{
		for(c=1; c<=nColumn; c++)
		{
			GetSubMatrix(sub,r,c);
			sub.GetDeterminant(detSub);
			m.Set(r,c,detSub*modulus[(r+c)&1]);
		}
	}
	m.Transpose();

	return YSOK;
}
コード例 #12
0
ファイル: cDMatrix.cpp プロジェクト: cran/RHmm
void GetSubMatrix(cDMatrix& theSrcMatrix, uint theSize, cDMatrix& theDestMatrix)
{
	GetSubMatrix(theSrcMatrix, theSize, theSize, theDestMatrix) ;
}