void SpiralShape::setSize(const QSizeF &newSize) { QTransform matrix(resizeMatrix(newSize)); m_center = matrix.map(m_center); m_radii = matrix.map(m_radii); KoParameterShape::setSize(newSize); }
ConfusionMatrix::IntPair ConfusionMatrix::lookupPurposes(Purpose actual, Purpose detectionResult) { int newPurposeCount = 0; int actualIdx = purposeIdx(actual); int detectedIdx = purposeIdx(detectionResult); if(NOT_FOUND == actualIdx) { newPurposeCount++; allPurposes.push_back(actual); actualIdx = (allPurposes.size() - 1); // last element } if(NOT_FOUND == detectedIdx) { newPurposeCount++; allPurposes.push_back(detectionResult); detectedIdx = (allPurposes.size() - 1); // last element } if(newPurposeCount > 0) { // Match matrix to new size localAndClientMsg(VLogger::DEBUG_1, NULL, "Purpose type(s) added, resizing (%dx%d) matrix to: (%dx%d)\n", (allPurposes.size() - newPurposeCount), (allPurposes.size() - newPurposeCount), allPurposes.size(), allPurposes.size()); resizeMatrix(newPurposeCount); } IntPair pair; pair.actual = actualIdx; pair.detected = detectedIdx; return(pair); }
int appendMatrix(sparseMatrix *matrix, sparseVector *newVector) { if(matrix->count == matrix->size) resizeMatrix(matrix, matrix->size + 10); matrix->list[matrix->count] = newVector; matrix->count++; putDiagonalIndex(newVector, matrix->count); return(matrix->count); }
void rotateMatrix(Matrix *m) { char *b = m->data; int t = m->height; m->height = m->width; m->width = t; resizeMatrix(m); for (int y = 0; y < m->height; ++y) for (int x = 0; x < m->width; ++x) m->data[x + y * m->width] = b[x * m->height + m->height - 1 - y]; free(b); }
void KoParameterShape::setSize(const QSizeF &newSize) { QMatrix matrix(resizeMatrix(newSize)); for (int i = 0; i < m_handles.size(); ++i) { m_handles[i] = matrix.map(m_handles[i]); } KoPathShape::setSize(newSize); }
void KParameterShape::setSize(const QSizeF &newSize) { Q_D(KParameterShape); QTransform matrix(resizeMatrix(newSize)); for (int i = 0; i < d->handles.size(); ++i) { d->handles[i] = matrix.map(d->handles[i]); } KPathShape::setSize(newSize); }
void StarShape::setSize(const QSizeF &newSize) { QTransform matrix(resizeMatrix(newSize)); m_zoomX *= matrix.m11(); m_zoomY *= matrix.m22(); // this transforms the handles KoParameterShape::setSize(newSize); m_center = computeCenter(); }
void KoEnhancedPathShape::setSize( const QSizeF &newSize ) { QMatrix matrix( resizeMatrix( newSize ) ); KoParameterShape::setSize( newSize ); qreal scaleX = matrix.m11(); qreal scaleY = matrix.m22(); m_viewBoxOffset.rx() *= scaleX; m_viewBoxOffset.ry() *= scaleY; m_viewMatrix.scale( scaleX, scaleY ); }
Matrix loadMatrix(FILE* file) { struct Matrix r; fscanf(file, "%d %d\n", &r.width, &r.height); resizeMatrix(&r); char buf[100]; for (int y = 0; y < r.height; ++y) { fgets(buf, 100, file); for (int x = 0; x < r.width; ++x) { r.data[x+y*r.width] = (buf[x]=='x')?1:0; } } return r; }
bool Foam::seulex::resize() { if (ODESolver::resize()) { table_.shallowResize(kMaxx_, n_); resizeField(dfdx_); resizeMatrix(dfdy_); resizeMatrix(a_); resizeField(pivotIndices_); resizeField(y0_); resizeField(ySequence_); resizeField(scale_); resizeField(dy_); resizeField(yTemp_); resizeField(dydx_); return true; } else { return false; } }
bool Foam::Rosenbrock34::resize() { if (ODESolver::resize()) { adaptiveSolver::resize(n_); resizeField(k1_); resizeField(k2_); resizeField(k3_); resizeField(k4_); resizeField(err_); resizeField(dydx_); resizeField(dfdx_); resizeMatrix(dfdy_); resizeMatrix(a_); resizeField(pivotIndices_); return true; } else { return false; } }
bool Foam::SIBS::resize() { if (ODESolver::resize()) { resizeField(yTemp_); resizeField(ySeq_); resizeField(yErr_); resizeField(dydx0_); resizeField(dfdx_); resizeMatrix(dfdy_); return true; } else { return false; } }
sparseMatrix *createMatrix(int dimLimit, int lenLimit, int initVectors) { int initsize; sparseMatrix *matrix; if(initVectors < 0) initVectors = 0; if(initVectors == 0) initsize = MIN(INITIALSIZE, dimLimit); else initsize = MAX(INITIALSIZE, initVectors); CALLOC(matrix, 1); matrix->limit = dimLimit; matrix->limitVector = lenLimit; resizeMatrix(matrix, initsize); while(initVectors > 0) { initVectors--; appendMatrix(matrix, createVector(lenLimit, 2)); } return(matrix); }
/** * This function returns a resized matrix (10x10) for the cc. * * @param cc Connected component * @param pic Binary image * * @return Matrix 10x10 */ t_matrix *resizeCC(t_cc_elt *cc, t_binary_image *pic) { int i, j, itmp, jtmp; t_matrix *ret; int height_cc, width_cc; /* Initialization */ ret = wmalloc(sizeof(t_matrix)); ret->nbrows = 10; ret->nbcols = 10; ret->data= NULL; ret->data = (int **)wmalloc(10 * sizeof(int *)); for (i=0; i < 10; ++i) ret->data[i] = (int *)wcalloc(10, sizeof(int)); for (i=0; i < 10; ++i) for (j=0; j < 10; ++j) ret->data[i][j] = 0; /* Search of cc informations */ height_cc = cc->coord.ymax - cc->coord.ymin; width_cc = cc->coord.xmax - cc->coord.xmin; if ((height_cc <= 10) && (width_cc <= 10)) { /* Just a rewrite of the cc matrix */ for (i=0; i < height_cc; ++i) for (j=0; j < width_cc; ++j) { itmp = i + cc->coord.ymin; jtmp = j + cc->coord.xmin; ret->data[i][j] = pic->matrix->data[itmp][jtmp]; } } else ret = resizeMatrix(ret, cc, pic); return(ret); }
void freeMatrix(sparseMatrix *matrix) { resizeMatrix(matrix, 0); MEMFREE(matrix); }