Пример #1
0
        /*!
         Applies the inverse.
         */
	void apply_Inverse(MatrixXcd& matrix, int mStart) {
		int n	=	matrix.cols();
		int start	=	nStart-mStart;
		if (isLeaf	==	true) {
			matrix.block(start, 0, nSize, n)	=	Kinverse.solve(matrix.block(start, 0, nSize, n));
		}
		else if (isLeaf	==	false) {
			//	Computes temp		=	Vinverse*matrix

			MatrixXcd temp(nRank[0]+nRank[1], n);

			temp.block(0, 0, nRank[0] , n)		=	Vinverse[1]*matrix.block(start+child[0]->nSize, 0 , child[1]->nSize, n);

			temp.block(nRank[0], 0, nRank[1] , n)	=	Vinverse[0]*matrix.block(start, 0 , child[0]->nSize, n);

			//	Computes tempSolve	=	Kinverse\temp

			MatrixXcd tempSolve	=	Kinverse.solve(temp);

			//	Computes matrix		=	matrix-Uinverse*tempSolve

			matrix.block(start, 0, child[0]->nSize, n)			=	matrix.block(start, 0, child[0]->nSize, n)	-	Uinverse[0]*tempSolve.block(0, 0, nRank[0], n);
			matrix.block(start + child[0]->nSize, 0, child[1]->nSize, n)	=	matrix.block(start + child[0]->nSize, 0, child[1]->nSize, n)	-	Uinverse[1]*tempSolve.block(nRank[0], 0, nRank[1], n);
		}
	};
Пример #2
0
	void compute_K() {
		if (isLeaf	==	false) {
			int m0	=	V[0].rows();
			int m1	=	V[1].rows();
			K	=	MatrixXcd::Identity(m0+m1, m0+m1);

			K.block(0, m1, m1, m0)	=	Vinverse[1]*Uinverse[1];
			K.block(m1, 0, m0, m1)	=	Vinverse[0]*Uinverse[0];
		}
	};
Пример #3
0
        /*!
         Matrix matrix product.
         */
	void matrix_Matrix_Product(MatrixXcd& x, MatrixXcd& b) {
		int n	=	x.cols();

		if (isLeaf	==	true) {
			b.block(nStart, 0, nSize, n)	=	b.block(nStart, 0, nSize, n)	+	K*x.block(nStart, 0, nSize, n);
		}
		else if (isLeaf	==	false) {
			int n0	=	child[0]->nStart;
			int n1	=	child[1]->nStart;
			int m0	=	child[0]->nSize;
			int m1	=	child[1]->nSize;
			b.block(n0, 0, m0, n)	=	b.block(n0, 0, m0, n)	+	U[0]*(V[1]*x.block(n1, 0, m1, n));
			b.block(n1, 0, m1, n)	=	b.block(n1, 0, m1, n)	+	U[1]*(V[0]*x.block(n0, 0, m0, n));
		}
	};