A converter from polynomial optimization problems of either commuting or noncommuting variables to sparse SDPA input format