14 #if defined __cplusplus
29 if( ptwX == NULL )
return( NULL );
68 if( size < length ) size =
length;
69 if( ( ptwX =
ptwX_new( size, status ) ) != NULL ) {
70 for( i1 = 0, p1 = ptwX->
points; i1 < length; i1++, p1++ ) *p1 = slope * i1 +
offset;
103 if( index1 < 0 )
return( NULL );
104 if( index2 < index1 )
return( NULL );
105 if( index2 > ptwX->
length )
return( NULL );
106 length = ( index2 -
index1 );
107 if( ( n =
ptwX_new( length, status ) ) == NULL )
return( n );
123 else if( ( ptwX->
allocatedSize > 2 * size ) || forceSmallerResize ) {
126 if( ptwX->
points == NULL ) {
193 int64_t
n = ptwX->
length - ( i2 - i1 );
209 if( ( index < 0 ) || ( index >= ptwX->
length ) )
return( NULL );
210 return( &(ptwX->
points[index]) );
217 return( ptwX->
points[index] );
241 int64_t i1, i2, n1p, size = n1 + ptwX->
length;
249 for( i1 = ptwX->
length - 1, i2 = size - 1, n1p = ptwX->
length - index + 1; n1p > 0; i1--, i2--, n1p-- ) ptwX->
points[i2] = ptwX->
points[i1];
250 for( i1 = 0, i2 = index; i1 <
n1; i1++, i2++ ) ptwX->
points[i2] = xs[i1];
265 if( ptwX->
length < 2 )
return( 0 );
267 if( ( x1 = ptwX->
points[0] ) < ( x2 = ptwX->
points[1] ) ) {
268 for( i = 2; i < ptwX->
length; i++ ) {
271 if( x2 <= x1 )
return( 0 );
274 if( x1 == x2 )
return( 0 );
276 for( i = 2; i < ptwX->
length; i++ ) {
279 if( x1 <= x2 )
return( 0 );
289 int64_t numberConverted;
294 ptwX =
ptwX_create( numberConverted, numberConverted, doublePtr, status );
306 for( i1 = 0; i1 < ptwX->
length; i1++ ) {
307 if( ptwX->
points[i1] == value ) (*count)++;
319 for( i1 = 0; i1 <
n1; i1++, i2-- ) {
343 double *
d1 = (
double *) p1, *
d2 = (
double *) p2;
345 if( *d1 < *
d2 )
return( -1 );
346 if( *d1 == *
d2 )
return( 0 );
372 *difference = value - ptwX->
points[i1];
373 for( i1++; i1 < i2; i1++ ) {
374 d1 = value - ptwX->
points[i1];
375 if( std::fabs( *difference ) > std::fabs( d1 ) ) {
389 int64_t i1, i2,
n1 = 0;
394 if( ( ptwX2 =
ptwX_new( ptwX->
length, status ) ) == NULL )
return( NULL );
395 for( i1 = 0; i1 < ptwX->
length; i1++ ) {
397 for( i2 = 0, p2 = ptwX2->
points; i2 < ptwX2->
length; i2++, p2++ ) {
398 if( *p2 == x1 )
break;
400 if( i2 == ptwX2->
length ) {
406 if( ( ptwX2 =
ptwX_clone( ptwX, status ) ) == NULL )
return( NULL );
412 for( i1 = 1; i1 < ptwX2->
length; i1++ ) {
413 if( x1 != ptwX2->
points[i1] ) {
440 for( i1 = 0, p1 = ptwX->
points; i1 < ptwX->
length; i1++, p1++ ) *p1 = std::fabs( *p1 );
473 for( i1 = 0, p1 = ptwX->
points; i1 < ptwX->
length; i1++, p1++ ) *p1 = slope * *p1 +
offset;
488 for( i1 = 0; i1 < ptwX1->
length; i1++, p1++, p2++ ) *p1 += *p2;
503 for( i1 = 0; i1 < ptwX1->
length; i1++, p1++, p2++ ) *p1 -= *p2;
513 double *p1 = ptwX->
points;
517 *xMin = *xMax = *(p1++);
518 for( i1 = 1; i1 <
n1; ++i1, ++p1 ) {
519 if( *p1 < *xMin ) *xMin = *p1;
520 if( *p1 > *xMax ) *xMax = *p1;
536 if(
nn > n2 )
nn = n2;
537 for( i1 = 0; i1 <
nn; i1++, p1++, p2++ ) {
538 if( *p1 == *p2 )
continue;
540 if( *p1 < *p2 ) *comparison = -1;
566 if( n1 != ptwX2->
length )
return( -1 );
569 for( i1 = 0; i1 <
n1; i1++, p1++, p2++ ) {
570 larger = std::fabs( *p1 );
571 if( std::fabs( *p2 ) > larger ) larger = std::fabs( *p2 );
572 if( std::fabs( *p2 - *p1 ) > epsilon * larger )
return( (
int) ( i1 + 1 ) );
577 #if defined __cplusplus