A control system for controlling an operation of a system with continuous-time nonlinear dynamics subject to constraints including equality and inequality constraints on state and control variables of the system, the control system comprising: an estimator to estimate a current state of the system using measurements of the operation of the system; a memory to store intermediate condensing matrices and an approximation of a constraint Jacobian matrix determined for each time interval in a control horizon, such that the intermediate condensing matrices and the approximation of the constraint Jacobian matrix have a block-bidiagonal structure; a processor to iteratively solve, at each control step, an approximation of a constrained nonlinear optimization problem to produce a control solution, wherein the approximation includes a linearization of the nonlinear dynamics of the system discretized by time intervals in the control horizon and represented using the approximation of the constraint Jacobian matrix for each time interval of the control horizon, wherein, at each control step, the processor is configured to retrieve, from the memory, the intermediate condensing matrices and the approximation of the constraint Jacobian matrix determined for each time interval; block-wise update the approximation of the constraint Jacobian matrix and the intermediate condensing matrices using an evaluation of one or combination of the discretized dynamics of the system and a directional derivative of the discretized dynamics of the system, wherein each block in the constraint Jacobian matrix and the intermediate condensing matrices represents one time interval in the control horizon; solve the approximation of the nonlinear optimization problem using the updated approximation of the constraint Jacobian matrix; and update the memory with the updated approximation of the constraint Jacobian matrix and the updated intermediate condensing matrices; and a controller (203, 1202) to control the system using the control solution. an estimator to estimate a current state of the system using measurements of the operation of the system; a memory to store intermediate condensing matrices and an approximation of a constraint Jacobian matrix determined for each time interval in a control horizon, such that the intermediate condensing matrices and the approximation of the constraint Jacobian matrix have a block-bidiagonal structure; a processor to iteratively solve, at each control step, an approximation of a constrained nonlinear optimization problem to produce a control solution, wherein the approximation includes a linearization of the nonlinear dynamics of the system discretized by time intervals in the control horizon and represented using the approximation of the constraint Jacobian matrix for each time interval of the control horizon, wherein, at each control step, the processor is configured to retrieve, from the memory, the intermediate condensing matrices and the approximation of the constraint Jacobian matrix determined for each time interval; block-wise update the approximation of the constraint Jacobian matrix and the intermediate condensing matrices using an evaluation of one or combination of the discretized dynamics of the system and a directional derivative of the discretized dynamics of the system, wherein each block in the constraint Jacobian matrix and the intermediate condensing matrices represents one time interval in the control horizon; solve the approximation of the nonlinear optimization problem using the updated approximation of the constraint Jacobian matrix; and update the memory with the updated approximation of the constraint Jacobian matrix and the updated intermediate condensing matrices; and retrieve, from the memory, the intermediate condensing matrices and the approximation of the constraint Jacobian matrix determined for each time interval; block-wise update the approximation of the constraint Jacobian matrix and the intermediate condensing matrices using an evaluation of one or combination of the discretized dynamics of the system and a directional derivative of the discretized dynamics of the system, wherein each block in the constraint Jacobian matrix and the intermediate condensing matrices represents one time interval in the control horizon; solve the approximation of the nonlinear optimization problem using the updated approximation of the constraint Jacobian matrix; and update the memory with the updated approximation of the constraint Jacobian matrix and the updated intermediate condensing matrices; and a controller (203, 1202) to control the system using the control solution.