Beispiel #1
0
void * Chi2Lib::computeDifferenceThread( void* ptr){
	PartitionDiff *part = (PartitionDiff*) ptr;
	MyMatrix<double> *img = part->img;
	MyMatrix<double> *grid_x = part->grid_x;
	MyMatrix<double> *grid_y = part->grid_y;
	double d = part->d;
	double w = part->w;
	MyMatrix<double> *diffout = part->diffout;

	MyLogger::log()->debug("[Chi2Lib][computeDifferenceThread] Computing Chi2 Difference");
	double chi2err = 0.0;
	for(unsigned int x=part->x1; x < part->x2; ++x){
		for(unsigned int y=part->y1; y < part->y2; ++y){
			double x2y2 = sqrt(1.0*grid_x->getValue(x,y)*grid_x->getValue(x,y) + 1.0*grid_y->getValue(x,y)*grid_y->getValue(x,y));
			double temp = ((1.0-tanh( (x2y2-d/2.0)/w )) - 2.0*img->getValue(x,y))/2.0;

			diffout->at(x,y) = temp;
			chi2err += temp*temp;
		}
	}
	MyLogger::log()->debug("[Chi2Lib][computeDifferenceThread] Chi2 Error: %f", chi2err);

	part->err = chi2err;
	return 0;
}
Beispiel #2
0
MyVector operator*(const MyMatrix& lhs ,const MyVector& rhs) {
    MyVector y = MyVector(lhs.rows_);
    if (lhs.columns_ == rhs.size()) {
        for(long long int i = 1; i <= lhs.rows_; i++) {
            for(long long int j = 1; j <= lhs.columns_; j++) {
                y[i-1] +=  rhs[j-1] *lhs.at(i,j);
            }
        }
    } else {
        cout << "Matrix-Vektor-Multiplikation nicht möglich  Dimensionen stimmen nicht überein!" << endl;
    }
    return y;
}
Beispiel #3
0
MyMatrix MyMatrix::operator*(const MyMatrix& rhs) {
    MyMatrix lhs = *this;
    auto n=lhs.rows_;
    auto m = lhs.columns_;
    auto p = rhs.columns_;
    MyMatrix y = MyMatrix(n,p);
    if (m == rhs.rows_) {
        for(long long int i = 1; i <= n; i++) {
            for(long long int j = 1; j <= p; j++) {
                y.mval_[(i-1)*(p) + (j-1)]=0;
                for(long long int k = 1; k <= m; k++) {
                    y.mval_[(i-1)*(p) + (j-1)] +=  lhs.at(i,k)*rhs.at(k,j) ;
                }
            }
        }
    }

    else {
        cout << "Dimensionen stimmen nicht überein!" << endl;
    }
    return y;
}