From: <par...@us...> - 2011-12-09 21:28:11
|
Revision: 9348 http://octave.svn.sourceforge.net/octave/?rev=9348&view=rev Author: paramaniac Date: 2011-12-09 21:28:04 +0000 (Fri, 09 Dec 2011) Log Message: ----------- control-devel: convert to new error/warning format Modified Paths: -------------- trunk/octave-forge/extra/control-devel/src/slab09id.cc trunk/octave-forge/extra/control-devel/src/slab09jd.cc Modified: trunk/octave-forge/extra/control-devel/src/slab09id.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slab09id.cc 2011-12-09 20:27:01 UTC (rev 9347) +++ trunk/octave-forge/extra/control-devel/src/slab09id.cc 2011-12-09 21:28:04 UTC (rev 9348) @@ -317,91 +317,65 @@ if (f77_exception_encountered) error ("modred: exception in SLICOT subroutine AB09ID"); - - if (info != 0) - { - if (info < 0) - error ("modred: the %d-th argument had an invalid value", info); - else - { - switch (info) - { - case 1: - error ("modred: 1: the computation of the ordered real Schur form of A " - "failed"); - case 2: - error ("modred: 2: the separation of the ALPHA-stable/unstable " - "diagonal blocks failed because of very close " - "eigenvalues"); - case 3: - error ("modred: 3: the reduction to a real Schur form of the state " - "matrix of a minimal realization of V failed"); - case 4: - error ("modred: 4: a failure was detected during the ordering of the " - "real Schur form of the state matrix of a minimal " - "realization of V or in the iterative process to " - "compute a left coprime factorization with inner " - "denominator"); - case 5: - error ("modred: 5: if DICO = 'C' and the matrix AV has an observable " - "eigenvalue on the imaginary axis, or DICO = 'D' and " - "AV has an observable eigenvalue on the unit circle"); - case 6: - error ("modred: 6: the reduction to a real Schur form of the state " - "matrix of a minimal realization of W failed"); - case 7: - error ("modred: 7: a failure was detected during the ordering of the " - "real Schur form of the state matrix of a minimal " - "realization of W or in the iterative process to " - "compute a right coprime factorization with inner " - "denominator"); - case 8: - error ("modred: 8: if DICO = 'C' and the matrix AW has a controllable " - "eigenvalue on the imaginary axis, or DICO = 'D' and " - "AW has a controllable eigenvalue on the unit circle"); - case 9: - error ("modred: 9: the computation of eigenvalues failed"); - case 10: - error ("modred: 10: the computation of Hankel singular values failed"); - default: - error ("modred: unknown error, info = %d", info); - } - } - } - - if (iwarn != 0) - { - switch (iwarn) - { - case 1: - warning ("modred: 1: with ORDSEL = 'F', the selected order NR is greater " - "than NSMIN, the sum of the order of the " - "ALPHA-unstable part and the order of a minimal " - "realization of the ALPHA-stable part of the given " - "system; in this case, the resulting NR is set equal " - "to NSMIN."); - break; - case 2: - warning ("modred: 2: with ORDSEL = 'F', the selected order NR corresponds " - "to repeated singular values for the ALPHA-stable " - "part, which are neither all included nor all " - "excluded from the reduced model; in this case, the " - "resulting NR is automatically decreased to exclude " - "all repeated singular values."); - break; - case 3: - warning ("modred: 3: with ORDSEL = 'F', the selected order NR is less " - "than the order of the ALPHA-unstable part of the " - "given system; in this case NR is set equal to the " - "order of the ALPHA-unstable part."); - break; - default: - warning ("modred: 10+%d: %d violations of the numerical stability condition " - "occured during the assignment of eigenvalues in the " - "SLICOT Library routines SB08CD and/or SB08DD.", info, info); - } - } + + static const char* err_msg[] = { + "0: OK", + "1: the computation of the ordered real Schur form of A " + "failed", + "2: the separation of the ALPHA-stable/unstable " + "diagonal blocks failed because of very close " + "eigenvalues", + "3: the reduction to a real Schur form of the state " + "matrix of a minimal realization of V failed", + "4: a failure was detected during the ordering of the " + "real Schur form of the state matrix of a minimal " + "realization of V or in the iterative process to " + "compute a left coprime factorization with inner " + "denominator", + "5: if DICO = 'C' and the matrix AV has an observable " + "eigenvalue on the imaginary axis, or DICO = 'D' and " + "AV has an observable eigenvalue on the unit circle", + "6: the reduction to a real Schur form of the state " + "matrix of a minimal realization of W failed", + "7: a failure was detected during the ordering of the " + "real Schur form of the state matrix of a minimal " + "realization of W or in the iterative process to " + "compute a right coprime factorization with inner " + "denominator", + "8: if DICO = 'C' and the matrix AW has a controllable " + "eigenvalue on the imaginary axis, or DICO = 'D' and " + "AW has a controllable eigenvalue on the unit circle", + "9: the computation of eigenvalues failed", + "10: the computation of Hankel singular values failed"}; + + static const char* warn_msg[] = { + "0: OK", + "1: with ORDSEL = 'F', the selected order NR is greater " + "than NSMIN, the sum of the order of the " + "ALPHA-unstable part and the order of a minimal " + "realization of the ALPHA-stable part of the given " + "system; in this case, the resulting NR is set equal " + "to NSMIN.", + "2: with ORDSEL = 'F', the selected order NR corresponds " + "to repeated singular values for the ALPHA-stable " + "part, which are neither all included nor all " + "excluded from the reduced model; in this case, the " + "resulting NR is automatically decreased to exclude " + "all repeated singular values.", + "3: with ORDSEL = 'F', the selected order NR is less " + "than the order of the ALPHA-unstable part of the " + "given system; in this case NR is set equal to the " + "order of the ALPHA-unstable part.", + "10+%d: %d violations of the numerical stability condition " + "occured during the assignment of eigenvalues in the " + "SLICOT Library routines SB08CD and/or SB08DD."};//, info, info); + + // TODO: handle case 10+info + + error_msg ("modred", info, 10, err_msg); + warning_msg ("modred", iwarn, 4, warn_msg); + // resize a.resize (nr, nr); b.resize (nr, m); Modified: trunk/octave-forge/extra/control-devel/src/slab09jd.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slab09jd.cc 2011-12-09 20:27:01 UTC (rev 9347) +++ trunk/octave-forge/extra/control-devel/src/slab09jd.cc 2011-12-09 21:28:04 UTC (rev 9348) @@ -292,116 +292,97 @@ if (f77_exception_encountered) error ("hnamodred: exception in SLICOT subroutine AB09JD"); - - if (info != 0) - { - //error ("hsvd: slab09jd: AB09JD returned info = %d", info); - if (info < 0) - error ("hnamodred: the %d-th argument had an invalid value", info); - else - { - switch (info) - { - case 1: - error ("hnamodred: 1: the computation of the ordered real Schur form of A " - "failed"); - case 2: - error ("hnamodred: 2: the separation of the ALPHA-stable/unstable " - "diagonal blocks failed because of very close eigenvalues"); - case 3: - error ("hnamodred: 3: the reduction of AV to a real Schur form failed"); - case 4: - error ("hnamodred: 4: the reduction of AW to a real Schur form failed"); - case 5: - error ("hnamodred: 5: the reduction to generalized Schur form of the " - "descriptor pair corresponding to the inverse of V " - "failed"); - case 6: - error ("hnamodred: 6: the reduction to generalized Schur form of the " - "descriptor pair corresponding to the inverse of W " - "failed"); - case 7: - error ("hnamodred: 7: the computation of Hankel singular values failed"); - case 8: - error ("hnamodred: 8: the computation of stable projection in the " - "Hankel-norm approximation algorithm failed"); - case 9: - error ("hnamodred: 9: the order of computed stable projection in the " - "Hankel-norm approximation algorithm differs " - "from the order of Hankel-norm approximation"); - case 10: - error ("hnamodred: 10: the reduction of AV-BV*inv(DV)*CV to a " - "real Schur form failed"); - case 11: - error ("hnamodred: 11: the reduction of AW-BW*inv(DW)*CW to a " - "real Schur form failed"); - case 12: - error ("hnamodred: 12: the solution of the Sylvester equation failed " - "because the poles of V (if JOBV = 'V') or of " - "conj(V) (if JOBV = 'C') are not distinct from " - "the poles of G1 (see METHOD)"); - case 13: - error ("hnamodred: 13: the solution of the Sylvester equation failed " - "because the poles of W (if JOBW = 'W') or of " - "conj(W) (if JOBW = 'C') are not distinct from " - "the poles of G1 (see METHOD)"); - case 14: - error ("hnamodred: 14: the solution of the Sylvester equation failed " - "because the zeros of V (if JOBV = 'I') or of " - "conj(V) (if JOBV = 'R') are not distinct from " - "the poles of G1sr (see METHOD)"); - case 15: - error ("hnamodred: 15: the solution of the Sylvester equation failed " - "because the zeros of W (if JOBW = 'I') or of " - "conj(W) (if JOBW = 'R') are not distinct from " - "the poles of G1sr (see METHOD)"); - case 16: - error ("hnamodred: 16: the solution of the generalized Sylvester system " - "failed because the zeros of V (if JOBV = 'I') or " - "of conj(V) (if JOBV = 'R') are not distinct from " - "the poles of G1sr (see METHOD)"); - case 17: - error ("hnamodred: 17: the solution of the generalized Sylvester system " - "failed because the zeros of W (if JOBW = 'I') or " - "of conj(W) (if JOBW = 'R') are not distinct from " - "the poles of G1sr (see METHOD)"); - case 18: - error ("hnamodred: 18: op(V) is not antistable"); - case 19: - error ("hnamodred: 19: op(W) is not antistable"); - case 20: - error ("hnamodred: 20: V is not invertible"); - case 21: - error ("hnamodred: 21: W is not invertible"); - default: - error ("hnamodred: unknown error, info = %d", info); - } - } - } - - if (iwarn != 0) - { - switch (iwarn) - { - case 1: - warning ("hnamodred: 1: with ORDSEL = 'F', the selected order NR is greater " - "than NSMIN, the sum of the order of the " - "ALPHA-unstable part and the order of a minimal " - "realization of the ALPHA-stable part of the given " - "system. In this case, the resulting NR is set equal " - "to NSMIN."); - break; - case 2: - warning ("hnamodred: 2: with ORDSEL = 'F', the selected order NR is less " - "than the order of the ALPHA-unstable part of the " - "given system. In this case NR is set equal to the " - "order of the ALPHA-unstable part."); - break; - default: - warning ("hnamodred: unknown warning, iwarn = %d", info); - } - } + + static const char* err_msg[] = { + "0: OK", + "1: the computation of the ordered real Schur form of A " + "failed", + + "2: the separation of the ALPHA-stable/unstable " + "diagonal blocks failed because of very close eigenvalues", + + "3: the reduction of AV to a real Schur form failed", + + "4: the reduction of AW to a real Schur form failed", + + "5: the reduction to generalized Schur form of the " + "descriptor pair corresponding to the inverse of V " + "failed", + + "6: the reduction to generalized Schur form of the " + "descriptor pair corresponding to the inverse of W " + "failed", + + "7: the computation of Hankel singular values failed", + + "8: the computation of stable projection in the " + "Hankel-norm approximation algorithm failed", + + "9: the order of computed stable projection in the " + "Hankel-norm approximation algorithm differs " + "from the order of Hankel-norm approximation", + + "10: the reduction of AV-BV*inv(DV)*CV to a " + "real Schur form failed", + + "11: the reduction of AW-BW*inv(DW)*CW to a " + "real Schur form failed", + + "12: the solution of the Sylvester equation failed " + "because the poles of V (if JOBV = 'V') or of " + "conj(V) (if JOBV = 'C') are not distinct from " + "the poles of G1 (see METHOD)", + + "13: the solution of the Sylvester equation failed " + "because the poles of W (if JOBW = 'W') or of " + "conj(W) (if JOBW = 'C') are not distinct from " + "the poles of G1 (see METHOD)", + + "14: the solution of the Sylvester equation failed " + "because the zeros of V (if JOBV = 'I') or of " + "conj(V) (if JOBV = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "15: the solution of the Sylvester equation failed " + "because the zeros of W (if JOBW = 'I') or of " + "conj(W) (if JOBW = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "16: the solution of the generalized Sylvester system " + "failed because the zeros of V (if JOBV = 'I') or " + "of conj(V) (if JOBV = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "17: the solution of the generalized Sylvester system " + "failed because the zeros of W (if JOBW = 'I') or " + "of conj(W) (if JOBW = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "18: op(V) is not antistable", + + "19: op(W) is not antistable", + + "20: V is not invertible", + + "21: W is not invertible"}; + + static const char* warn_msg[] = { + "0: OK", + "1: with ORDSEL = 'F', the selected order NR is greater " + "than NSMIN, the sum of the order of the " + "ALPHA-unstable part and the order of a minimal " + "realization of the ALPHA-stable part of the given " + "system. In this case, the resulting NR is set equal " + "to NSMIN.", + "2: with ORDSEL = 'F', the selected order NR is less " + "than the order of the ALPHA-unstable part of the " + "given system. In this case NR is set equal to the " + "order of the ALPHA-unstable part."}; + + error_msg ("hnamodred", info, 21, err_msg); + warning_msg ("hnamodred", iwarn, 2, warn_msg); + // resize a.resize (nr, nr); b.resize (nr, m); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |