IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 17, 2005, 12:17:29 PM (22 years ago)
Author:
desonia
Message:

changed psMatrixLUD to create the perm parameter according to the machine
size of 'size_t', which is used by GSL.

Location:
trunk/psLib/src/dataManip
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psFunctions.c

    r3002 r3026  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.81 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-01-14 23:40:24 $
     9 *  @version $Revision: 1.82 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-01-17 22:17:29 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    19061906        (tmp->spline)[i] = psPolynomial1DAlloc(order+1, PS_POLYNOMIAL_ORD);
    19071907    }
     1908
     1909    // This should be set by the psVectorFitSpline1D()
     1910    tmp->p_psDeriv2 = NULL;
    19081911
    19091912    tmp->domains = (psF32 *) psAlloc((bounds->n) * sizeof(psF32));
  • trunk/psLib/src/dataManip/psMatrix.c

    r2697 r3026  
    2020 *  @author Ross Harman, MHPCC
    2121 *
    22  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-12-11 00:16:38 $
     22 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     23 *  @date $Date: 2005-01-17 22:17:29 $
    2424 *
    2525 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    175175/*****************************************************************************/
    176176
    177 psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage)
     177psImage* psMatrixLUD(psImage* outImage, psVector** outPerm, psImage* inImage)
    178178{
    179179    psS32 signum = 0;
    … …  
    190190    PS_CHECK_POINTERS(inImage, outImage, outImage);
    191191    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
    192     PS_VECTOR_CHECK_NULL_GENERAL(outPerm, psMatrixLUD_EXIT);
    193     PS_CHECK_DIMEN_AND_TYPE(outPerm, PS_DIMEN_VECTOR, outImage);
     192    PS_PTR_CHECK_NULL_GENERAL(outPerm, psMatrixLUD_EXIT);
    194193    psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
    195     psVectorRecycle(outPerm, inImage->numRows, inImage->type.type);
    196194    PS_CHECK_SQUARE(inImage, outImage);
    197195    PS_CHECK_SQUARE(outImage, outImage);
    … …  
    203201    // Initialize GSL data
    204202    perm.size = numCols;
    205     outPerm->n = numCols;
    206     perm.data = outPerm->data.V;
     203    if (sizeof(size_t) == 4) {
     204        *outPerm = psVectorRecycle(*outPerm, numCols, PS_TYPE_S32);
     205    } else if (sizeof(size_t) == 8) {
     206        *outPerm = psVectorRecycle(*outPerm, numCols, PS_TYPE_S64);
     207    } else {
     208        psError(PS_ERR_UNKNOWN, true,
     209                "Failed to allocate the permutation vector; "
     210                "could not determine the cooresponding data type.");
     211        psMatrixLUD_EXIT;
     212    }
     213
     214    (*outPerm)->n = numCols;
     215    perm.data = (*outPerm)->data.V;
    207216    lu = gsl_matrix_alloc(numRows, numCols);
    208217
    … …  
    244253    PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outVector);
    245254    PS_VECTOR_CHECK_NULL(inPerm, outVector);
    246     PS_CHECK_DIMEN_AND_TYPE(inPerm, PS_DIMEN_VECTOR, outVector);
    247255    psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
    248256
  • trunk/psLib/src/dataManip/psMatrix.h

    r2671 r3026  
    2222 *  @author Ross Harman, MHPCC
    2323 *
    24  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    25  *  @date $Date: 2004-12-09 20:51:22 $
     24 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     25 *  @date $Date: 2005-01-17 22:17:29 $
    2626 *
    2727 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    4545psImage* psMatrixLUD(
    4646    psImage* outImage,                 ///< Image to return, or NULL.
    47     psVector* outPerm,                 ///< Output permutation vector used by psMatrixLUSolve.
     47    psVector** outPerm,                ///< Output permutation vector used by psMatrixLUSolve.
    4848    psImage* inImage                   ///< Image to decompose.
    4949);
  • trunk/psLib/src/dataManip/psMinimize.c

    r3000 r3026  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.99 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-01-14 23:27:56 $
     11 *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-01-17 22:17:29 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    294294        This can not be implemented until SDR states what order spline should be
    295295        created.
    296      
     296
    297297        Should we error if mySPline is not NULL?
    298298    */
    … …  
    616616    psS32 p;
    617617    psVector *beta = psVectorAlloc(numParams, PS_TYPE_F64);
    618     psVector *perm = psVectorAlloc(numParams, PS_TYPE_F64);
     618    psVector *perm = NULL;
    619619
    620620    psVector *paramDeltasF64 = psVectorAlloc(numParams, PS_TYPE_F64);
    … …  
    738738        // XXX: How do we know if these functions were successful?
    739739        //
    740         aOut = psMatrixLUD(aOut, perm, A);
     740        aOut = psMatrixLUD(aOut, &perm, A);
    741741        paramDeltasF64 = psMatrixLUSolve(paramDeltasF64, aOut, beta, perm);
    742742
    … …  
    936936    coeffs = psVectorAlloc(polyOrder, PS_TYPE_F64);
    937937    X = psVectorAlloc(x->n, PS_TYPE_F64);
    938     outPerm = psVectorAlloc(polyOrder, PS_TYPE_F64);
    939938    xSums = psVectorAlloc(1 + 2 * polyOrder, PS_TYPE_F64);
    940939
    … …  
    943942        B->data.F64[i] = 0.0;
    944943        coeffs->data.F64[i] = 0.0;
    945         outPerm->data.F64[i] = 0.0;
    946944        for (j = 0; j < polyOrder; j++) {
    947945            A->data.F64[i][j] = 0.0;
    … …  
    987985
    988986    // XXX: How do we know if these routines were successful?
    989     ALUD = psMatrixLUD(ALUD, outPerm, A);
     987    ALUD = psMatrixLUD(ALUD, &outPerm, A);
    990988    coeffs = psMatrixLUSolve(coeffs, ALUD, B, outPerm);
    991989
    … …  
    11391137Algorithm:
    11401138 
    1141 XXX completely ad hoc: 
     1139XXX completely ad hoc:
    11421140start with the user-supplied starting parameter and
    11431141call that b.  Calculate a/c as a fractional amount smaller/larger than b.
    11441142Repeat this process until a local minimum is found.
    11451143 
    1146 XXX: 
    1147 new algorithm: 
     1144XXX:
     1145new algorithm:
    11481146start at x=0, expand in one direction until the function
    11491147decreases.  Then you have two points in the bracket.  Keep going until it
    … …  
    11511149direction.
    11521150 
    1153 XXX: 
     1151XXX:
    11541152This is F32 only.
    11551153 
    1156 XXX: 
     1154XXX:
    11571155output bracket vector should be an input as well.
    11581156*****************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.