Initializing help system before first use

getqexpnextterm

Purpose
Enumerate the list of terms contained in a quadratic expression.
Synopsis
void *getqexpnextterm(XPRMctx ctx, void *quadctx, mmquad_qexp q, void *prev, XPRMmpvar *v1, XPRMmpvar *v2, double *coeff);
Arguments
ctx 
Mosel's execution context
quadctx 
Context of mmquad
Reference to a quadratic expression
prev 
Last value returned by this function. Should be NULL for the first call
v1,v2 
Pointers to return the decision variable references for the current term
coeff 
Pointer to return the coefficient of the current term
Return value
The value to be used as prev for the next call o NULL when all terms have been returned.
Example
The following displays the terms of a quadratic expression:
void dispqexp(XPRMcontext ctx, mmquad_qexp q)
{
 void *prev;
 XPRMmpvar v1,v2;
 double coeff;
 int nlin,ct;
	
 mq->getqexpstat(ctx, quadctx, q, &nlin, NULL, NULL, NULL);
 ct=0;
 prev=mq->getqexpnextterm(ctx, quadctx, q, NULL, &v1, &v2, &coeff);
 mm->printf(ctx, "%g ", coeff);
 while(prev!=NULL) {
  prev=mq->getqexpnextterm(ctx, quadctx, q, prev, &v1, &v2, &coeff);
  if(ct<nlin) { mm->printf(ctx,"%+g %p", coeff, v2); ct++; }
  else mm->printf(ctx,"%+g %p * %p", coeff, v1, v2);
 }
 mm->printf(ctx,"\n");
} 
Further information
This function can be called repeatedly to enumerate all terms of a quadratic expression. For the first call, the parameter prev must be NULL and the function returns the constant term of the quadratic expression (for v1 and v2 the value NULL is returned and coeff contains the constant term). For the following calls, the value of prev must be the last value returned by the function. The enumeration is completed when the function returns NULL.
If this function is called repeatedly, after the constant term it returns next all linear terms and then the quadratic terms.
Module

© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.