IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 16, 2009, 5:23:09 PM (17 years ago)
Author:
Paul Price
Message:

Add optional output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/psLib/src/math/psMatrix.c

    r25864 r25865  
    10331033}
    10341034
    1035 psVector *psMatrixSolveSVD(const psImage *matrix, const psVector *vector)
    1036 {
    1037     PS_ASSERT_IMAGE_NON_NULL(matrix, NULL);
    1038     PS_CHECK_DIMEN_AND_TYPE(matrix, PS_DIMEN_IMAGE, {return NULL;});
    1039     PS_ASSERT_VECTOR_NON_NULL(vector, NULL);
    1040     PS_CHECK_DIMEN_AND_TYPE(vector, PS_DIMEN_VECTOR, {return NULL;});
     1035psVector *psMatrixSolveSVD(psVector *out, const psImage *matrix, const psVector *vector)
     1036{
     1037    #define psMatrixSolveSVD_EXIT {psFree(out); return NULL; }
     1038    PS_ASSERT_GENERAL_IMAGE_NON_NULL(matrix, psMatrixSolveSVD_EXIT);
     1039    PS_CHECK_DIMEN_AND_TYPE(matrix, PS_DIMEN_IMAGE, psMatrixSolveSVD_EXIT);
     1040    PS_ASSERT_GENERAL_VECTOR_NON_NULL(RHS, psMatrixSolveSVD_EXIT);
     1041    PS_CHECK_DIMEN_AND_TYPE(vector, PS_DIMEN_VECTOR, psMatrixSolveSVD_EXIT);
    10411042
    10421043    int numCols = matrix->numCols, numRows = matrix->numRows; // Size of matrix
     
    10841085    gsl_vector_free(b);
    10851086
    1086     psVector *solution = psVectorAlloc(numCols, PS_TYPE_F64);
     1087    out = psVectorRecycle(out, numCols, PS_TYPE_F64);
    10871088
    10881089    vectorGSLtoPS(solution, x);
Note: See TracChangeset for help on using the changeset viewer.