IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 29, 2004, 3:31:15 PM (22 years ago)
Author:
harman
Message:

Added more error checks

File:
1 edited

Legend:

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

    r1125 r1139  
    2929 *  @author Ross Harman, MHPCC
    3030 *
    31  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    32  *  @date $Date: 2004-06-29 20:28:47 $
     31 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     32 *  @date $Date: 2004-06-30 01:31:15 $
    3333 *
    3434 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7878
    7979// Conversion for degrees to radians
    80 #define D2R M_PI/360.0
     80#define D2R M_PI/180.0
    8181
    8282// Conversion for radians to degrees
    83 #define R2D 360.0/M_PI
     83#define R2D 180.0/M_PI
    8484
    8585// Division with NAN checking
     
    444444    }
    445445
     446    if(dim1 == PS_DIMEN_VECTOR) {
     447        if(((psVector*)in1)->n == 0) {
     448            psError(__func__, ": Line %d - Vector contains zero elements");
     449        }
     450    } else if(dim1 == PS_DIMEN_IMAGE) {
     451        if(((psImage*)in1)->numCols==0 || ((psImage*)in1)->numRows==0) {
     452            psError(__func__, ": Line %d - Image contains zero length row or cols");
     453        }
     454    }
     455
     456    if(dim2 == PS_DIMEN_VECTOR) {
     457        if(((psVector*)in2)->n == 0) {
     458            psError(__func__, ": Line %d - Vector contains zero elements");
     459        }
     460    } else if(dim2 == PS_DIMEN_IMAGE) {
     461        if(((psImage*)in2)->numCols==0 || ((psImage*)in2)->numRows==0) {
     462            psError(__func__, ": Line %d - Image contains zero length row or cols");
     463        }
     464    }
     465
    446466    if(dim1 == PS_DIMEN_SCALAR) {
    447467        if(dim2 == PS_DIMEN_SCALAR) {
     
    592612} else if(!strncmp(OP, "ten", 3)) {                                                                          \
    593613    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    594         UNARY_TYPE(DIM,OUT,IN,cpow(*i1,10.0));                                                               \
     614        UNARY_TYPE(DIM,OUT,IN,cpow(10.0,*i1));                                                               \
    595615    } else {                                                                                                 \
    596616        UNARY_TYPE(DIM,OUT,IN,exp10(*i1));                                                                   \
     
    721741    }
    722742
     743    if(dimIn == PS_DIMEN_VECTOR) {
     744        if(((psVector*)in)->n == 0) {
     745            psError(__func__, ": Line %d - Vector contains zero elements");
     746        }
     747    } else if(dimIn == PS_DIMEN_IMAGE) {
     748        if(((psImage*)in)->numCols==0 || ((psImage*)in)->numRows==0) {
     749            psError(__func__, ": Line %d - Image contains zero length row or cols");
     750        }
     751    }
     752
     753    if(dimOut == PS_DIMEN_VECTOR) {
     754        if(((psVector*)out)->n == 0) {
     755            psError(__func__, ": Line %d - Vector contains zero elements");
     756        }
     757    } else if(dimOut == PS_DIMEN_IMAGE) {
     758        if(((psImage*)out)->numCols==0 || ((psImage*)out)->numRows==0) {
     759            psError(__func__, ": Line %d - Image contains zero length row or cols");
     760        }
     761    }
     762
    723763    if(dimIn == PS_DIMEN_SCALAR) {
    724764        UNARY_OP(SCALAR,out,psTypeIn,op);                                 // scalar
Note: See TracChangeset for help on using the changeset viewer.