IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 22, 2006, 2:48:04 PM (20 years ago)
Author:
Paul Price
Message:

Adding GPL stuff, for distribution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisAddPenalty.c

    r3792 r8480  
     1// Copyright (C) 2006  Paul A. Price (price@ifa.hawaii.edu)
     2//
     3// This program is free software; you can redistribute it and/or modify
     4// it under the terms of the GNU General Public License as published by
     5// the Free Software Foundation; either version 2 of the License, or
     6// (at your option) any later version.
     7//
     8// This program is distributed in the hope that it will be useful,
     9// but WITHOUT ANY WARRANTY; without even the implied warranty of
     10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11// GNU General Public License for more details.
     12//
     13// You should have received a copy of the GNU General Public License
     14// along with this program; if not, write to the Free Software
     15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     16
    117#include <stdio.h>
    218#include <assert.h>
     
    420#include "pois.h"
    521
    6 void poisAddPenalty(psImage *matrix,    // The matrix
    7                     psVector *vector,   // The vector
    8                     float penalty,      // Penalty value
    9                     const psArray *kernels, // Kernel basis functions
    10                     const poisConfig *config // Configuration
     22void poisAddPenalty(psImage *matrix,    // The matrix
     23                    psVector *vector,   // The vector
     24                    float penalty,      // Penalty value
     25                    const psArray *kernels, // Kernel basis functions
     26                    const poisConfig *config // Configuration
    1127    )
    1228{
     
    2541
    2642    for (int j = 0; j < numKernels; j++) {
    27         poisKernelBasis *kernel = kernels->data[j];
    28         if (kernel->xOrder == 0 && kernel->yOrder == 0) {
    29             for (int k = j + 1; k < numKernels; k++) {
    30                 poisKernelBasis *compare = kernels->data[k];
    31                 if (compare->xOrder == 0 && compare->yOrder == 0 &&
    32                     (compare->u == kernel->u + 1 || compare->u == kernel->u - 1 ||
    33                      compare->v == kernel->v + 1 || compare->v == kernel->v - 1)) {
    34                     matrix->data.F64[j][k] -= penalty;
    35                     matrix->data.F64[k][j] -= penalty;
    36                 }
    37             }
    38         }
    39            
    40         if (abs(kernel->u) == config->xKernel) {
    41             if (abs(kernel->v) == config->yKernel) {
    42                 vector->data.F64[j] -= 3.0 * penalty;
    43             } else {
    44                 vector->data.F64[j] -= 5.0 * penalty;
    45             }
    46         } else {
    47             if (abs(kernel->v) == config->yKernel) {
    48                 vector->data.F64[j] -= 5.0 * penalty;
    49             } else {
    50                 vector->data.F64[j] -= 8.0 * penalty;
    51             }
    52         }
    53        
     43        poisKernelBasis *kernel = kernels->data[j];
     44        if (kernel->xOrder == 0 && kernel->yOrder == 0) {
     45            for (int k = j + 1; k < numKernels; k++) {
     46                poisKernelBasis *compare = kernels->data[k];
     47                if (compare->xOrder == 0 && compare->yOrder == 0 &&
     48                    (compare->u == kernel->u + 1 || compare->u == kernel->u - 1 ||
     49                     compare->v == kernel->v + 1 || compare->v == kernel->v - 1)) {
     50                    matrix->data.F64[j][k] -= penalty;
     51                    matrix->data.F64[k][j] -= penalty;
     52                }
     53            }
     54        }
     55
     56        if (abs(kernel->u) == config->xKernel) {
     57            if (abs(kernel->v) == config->yKernel) {
     58                vector->data.F64[j] -= 3.0 * penalty;
     59            } else {
     60                vector->data.F64[j] -= 5.0 * penalty;
     61            }
     62        } else {
     63            if (abs(kernel->v) == config->yKernel) {
     64                vector->data.F64[j] -= 5.0 * penalty;
     65            } else {
     66                vector->data.F64[j] -= 8.0 * penalty;
     67            }
     68        }
     69
    5470    }
    5571
Note: See TracChangeset for help on using the changeset viewer.