[trunk] Run fix_comment on invert.c
This commit is contained in:
parent
76947f0074
commit
a0977266b4
@ -115,85 +115,85 @@ opj_bool opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
|
||||
OPJ_UINT32 offset = 1;
|
||||
OPJ_UINT32 lStride = n-1;
|
||||
|
||||
//initialize permutations
|
||||
/*initialize permutations */
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
*tmpPermutations++ = i;
|
||||
}
|
||||
// now make a pivot with colum switch
|
||||
/* now make a pivot with colum switch */
|
||||
tmpPermutations = permutations;
|
||||
for (k = 0; k < lLastColum; ++k) {
|
||||
p = 0.0;
|
||||
|
||||
// take the middle element
|
||||
/* take the middle element */
|
||||
lColumnMatrix = lTmpMatrix + k;
|
||||
|
||||
// make permutation with the biggest value in the column
|
||||
/* make permutation with the biggest value in the column */
|
||||
for (i = k; i < n; ++i) {
|
||||
temp = ((*lColumnMatrix > 0) ? *lColumnMatrix : -(*lColumnMatrix));
|
||||
if (temp > p) {
|
||||
p = temp;
|
||||
k2 = i;
|
||||
}
|
||||
// next line
|
||||
/* next line */
|
||||
lColumnMatrix += n;
|
||||
}
|
||||
|
||||
// a whole rest of 0 -> non singular
|
||||
/* a whole rest of 0 -> non singular */
|
||||
if (p == 0.0) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
// should we permute ?
|
||||
/* should we permute ? */
|
||||
if (k2 != k) {
|
||||
//exchange of line
|
||||
// k2 > k
|
||||
/*exchange of line */
|
||||
/* k2 > k */
|
||||
dstPermutations = tmpPermutations + k2 - k;
|
||||
// swap indices
|
||||
/* swap indices */
|
||||
t = *tmpPermutations;
|
||||
*tmpPermutations = *dstPermutations;
|
||||
*dstPermutations = t;
|
||||
|
||||
// and swap entire line.
|
||||
/* and swap entire line. */
|
||||
lColumnMatrix = lTmpMatrix + (k2 - k) * n;
|
||||
memcpy(p_swap_area,lColumnMatrix,lSwapSize);
|
||||
memcpy(lColumnMatrix,lTmpMatrix,lSwapSize);
|
||||
memcpy(lTmpMatrix,p_swap_area,lSwapSize);
|
||||
}
|
||||
|
||||
// now update data in the rest of the line and line after
|
||||
/* now update data in the rest of the line and line after */
|
||||
lDestMatrix = lTmpMatrix + k;
|
||||
lColumnMatrix = lDestMatrix + n;
|
||||
// take the middle element
|
||||
/* take the middle element */
|
||||
temp = *(lDestMatrix++);
|
||||
|
||||
// now compute up data (i.e. coeff up of the diagonal).
|
||||
/* now compute up data (i.e. coeff up of the diagonal). */
|
||||
for (i = offset; i < n; ++i) {
|
||||
//lColumnMatrix;
|
||||
// divide the lower column elements by the diagonal value
|
||||
/*lColumnMatrix; */
|
||||
/* divide the lower column elements by the diagonal value */
|
||||
|
||||
// matrix[i][k] /= matrix[k][k];
|
||||
// p = matrix[i][k]
|
||||
/* matrix[i][k] /= matrix[k][k]; */
|
||||
/* p = matrix[i][k] */
|
||||
p = *lColumnMatrix / temp;
|
||||
*(lColumnMatrix++) = p;
|
||||
|
||||
for (j = /* k + 1 */ offset; j < n; ++j) {
|
||||
// matrix[i][j] -= matrix[i][k] * matrix[k][j];
|
||||
/* matrix[i][j] -= matrix[i][k] * matrix[k][j]; */
|
||||
*(lColumnMatrix++) -= p * (*(lDestMatrix++));
|
||||
}
|
||||
// come back to the k+1th element
|
||||
/* come back to the k+1th element */
|
||||
lDestMatrix -= lStride;
|
||||
// go to kth element of the next line
|
||||
/* go to kth element of the next line */
|
||||
lColumnMatrix += k;
|
||||
}
|
||||
|
||||
// offset is now k+2
|
||||
/* offset is now k+2 */
|
||||
++offset;
|
||||
// 1 element less for stride
|
||||
/* 1 element less for stride */
|
||||
--lStride;
|
||||
// next line
|
||||
/* next line */
|
||||
lTmpMatrix+=n;
|
||||
// next permutation element
|
||||
/* next permutation element */
|
||||
++tmpPermutations;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
@ -228,18 +228,18 @@ void opj_lupSolve (OPJ_FLOAT32 * pResult,
|
||||
lTmpMatrix = lLineMatrix;
|
||||
for (j = 1; j <= i; ++j)
|
||||
{
|
||||
// sum += matrix[i][j-1] * y[j-1];
|
||||
/* sum += matrix[i][j-1] * y[j-1]; */
|
||||
sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++));
|
||||
}
|
||||
//y[i] = pVector[pPermutations[i]] - sum;
|
||||
/*y[i] = pVector[pPermutations[i]] - sum; */
|
||||
*(lIntermediatePtr++) = pVector[*(lCurrentPermutationPtr++)] - sum;
|
||||
lLineMatrix += n;
|
||||
}
|
||||
|
||||
// we take the last point of the matrix
|
||||
/* we take the last point of the matrix */
|
||||
lLineMatrix = pMatrix + n*n - 1;
|
||||
|
||||
// and we take after the last point of the destination vector
|
||||
/* and we take after the last point of the destination vector */
|
||||
lDestPtr = pResult + n;
|
||||
|
||||
for (i = n - 1; i != -1 ; --i) {
|
||||
@ -248,10 +248,10 @@ void opj_lupSolve (OPJ_FLOAT32 * pResult,
|
||||
u = *(lTmpMatrix++);
|
||||
lCurrentPtr = lDestPtr--;
|
||||
for (j = i + 1; j < n; ++j) {
|
||||
// sum += matrix[i][j] * x[j]
|
||||
/* sum += matrix[i][j] * x[j] */
|
||||
sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++));
|
||||
}
|
||||
//x[i] = (y[i] - sum) / u;
|
||||
/*x[i] = (y[i] - sum) / u; */
|
||||
*(lBeginPtr--) = (*(lGeneratedData--) - sum) / u;
|
||||
lLineMatrix -= lStride;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user