Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-10496 test_chebyMap.py sometimes segfaults #4

Merged
merged 3 commits into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions chebymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,8 +1368,8 @@ static AstPolyMap *PolyTran( AstPolyMap *this_polymap, int forward, double acc,
this_ubnd[ 0 ] = ubnd[ 0 ];
if( nax > 1 ) this_ubnd[ 1 ] = ubnd[ 1 ];
} else if( scale && offset ) {
this_ubnd[ 0 ] = ( -1.0 - offset[ 0 ] )/scale[ 0 ];
if( nax > 1 ) this_ubnd[ 1 ] = ( -1.0 - offset[ 1 ] )/scale[ 1 ];
this_ubnd[ 0 ] = ( 1.0 - offset[ 0 ] )/scale[ 0 ];
if( nax > 1 ) this_ubnd[ 1 ] = ( 1.0 - offset[ 1 ] )/scale[ 1 ];
} else if( astOK ) {
astError( AST__NOBOX, "astPolyTran(%s): The %s transformation is "
"not a Chebyshev polynomial and therefore requires a "
Expand Down
13 changes: 13 additions & 0 deletions polymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ static int Equal( AstObject *this_object, AstObject *that_object, int *status )
int nin;
int nout;
int result;
int tmp;

/* Initialise. */
result = 0;
Expand Down Expand Up @@ -409,8 +410,20 @@ static int Equal( AstObject *this_object, AstObject *that_object, int *status )
must be identical. */
if( astGetInvert( this ) == astGetInvert( that ) ) {

/* Assume they are the same until we find a difference. */
result = 1;

/* The "_f" and "_i" suffixes in the PolyMap structure array names refer
to the forward and inverse transformations of the original uninverted
PolyMap. So we need to ensure the "nout" and "nin" values also refer
to the uninverted values. So if the PolyMaps are inverted, swap nout
and nin. */
if( astGetInvert( this ) ) {
tmp = nin;
nin = nout;
nout = tmp;
}

/* Check properties of the forward transformation. */
if( this->ncoeff_f && that->ncoeff_f ) {
for( i = 0; i < nout && result; i++ ) {
Expand Down