本文整理汇总了C++中DoubleMatrix::cols方法的典型用法代码示例。如果您正苦于以下问题:C++ DoubleMatrix::cols方法的具体用法?C++ DoubleMatrix::cols怎么用?C++ DoubleMatrix::cols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleMatrix
的用法示例。
在下文中一共展示了DoubleMatrix::cols方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MatrixHeatImaging
void MatrixHeatImaging(const DoubleMatrix &m, double minimum, double maximum, QPixmap &pixmap, int width, int height)
{
pixmap = QPixmap(QSize(width, height));
pixmap.fill(Qt::white);
QPainter painter(&pixmap);
unsigned int rows = m.rows();
unsigned int cols = m.cols();
for (unsigned int j=0; j<rows; j++)
{
for (unsigned int i=0; i<cols; i++)
{
double u = m.at(j,i);
double ratio = 0.0;
if (minimum!=maximum)
ratio = 2.0 * (u-minimum) / (maximum - minimum);
int b = int(MAX(0, 255*(1 - ratio)));
int r = int(MAX(0, 255*(ratio - 1)));
int g = 255 - b - r;
QColor c(r, g, b);
painter.setPen(c);
painter.drawPoint(i,height-j-1);
}
}
}
示例2: fopen
void HeatControl2Delta::write(const char *fileName, const DoubleMatrix& m)
{
FILE* f = fopen(fileName, "w");
for (unsigned int j=0; j<m.rows(); j++)
{
for (unsigned int i=0; i<m.cols(); i++)
{
if (i==0)
fprintf(f, "%.10f", m[j][i]);
else
fprintf(f, " %.10f", m[j][i]);
}
fprintf(f, "\n");
}
fclose(f);
}