本文整理汇总了C++中MyMatrix::at方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMatrix::at方法的具体用法?C++ MyMatrix::at怎么用?C++ MyMatrix::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMatrix
的用法示例。
在下文中一共展示了MyMatrix::at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sqrt
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;
}
示例2: MyVector
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;
}
示例3: MyMatrix
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;
}