Overview
Comment: | Static declarations of octave_value_lists: small .exe speed improvement |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f58032ca4b698c031d4dd126a3bd4442 |
User & Date: | geraint@users.sourceforge.net on 2001-02-11 07:08:59 |
Other Links: | branch diff | manifest | tags |
Context
2001-02-14
| ||
06:06:34 | Removed octave_value_list wrappers from standalone.exe - speed improvements check-in: 2b317a41b7 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2001-02-11
| ||
07:08:59 | Static declarations of octave_value_lists: small .exe speed improvement check-in: f58032ca4b user: geraint@users.sourceforge.net tags: origin/master, trunk | |
05:25:53 | Reduced number of matrix operations during .oct simulation data write check-in: c2e73d2c57 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/make_ode2odes from [741904c6e9] to [8b403736a0].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.46 2001/02/05 08:32:31 geraint ## typo ## ## Revision 1.45 2001/02/05 04:32:35 geraint ## Octave version 2.1.x compatability and #ifdef statements for standalone rep ## ## Revision 1.46 2001/01/08 06:21:59 geraint | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.47 2001/02/11 05:25:52 geraint ## Reduced number of matrix operations during .oct simulation data write ## ## Revision 1.46 2001/02/05 08:32:31 geraint ## typo ## ## Revision 1.45 2001/02/05 04:32:35 geraint ## Octave version 2.1.x compatability and #ifdef statements for standalone rep ## ## Revision 1.46 2001/01/08 06:21:59 geraint |
︙ | ︙ | |||
296 297 298 299 300 301 302 | inline ColumnVector mtt_${ode} (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { | | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | inline ColumnVector mtt_${ode} (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); #ifdef STANDALONE f = F${sys}_${ode} (args, 1); #else f = feval ("${sys}_${ode}", args, 1); #endif return f(0).${vector_value} (); } inline ColumnVector mtt_${odeo} (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); #ifdef STANDALONE f = F${sys}_${odeo} (args, 1); #else |
︙ | ︙ | |||
337 338 339 340 341 342 343 | const ColumnVector &dx, const Matrix &AA, const ColumnVector &AAx, const double &ddt, const int &nx, const ColumnVector &open_switches) { | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | const ColumnVector &dx, const Matrix &AA, const ColumnVector &AAx, const double &ddt, const int &nx, const ColumnVector &open_switches) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (dx); args (2) = octave_value (AA); args (3) = octave_value (AAx); args (4) = octave_value (ddt); args (5) = octave_value ((double)nx); args (6) = octave_value (open_switches); |
︙ | ︙ | |||
360 361 362 363 364 365 366 | inline ColumnVector mtt_euler (const ColumnVector &x, const ColumnVector &dx, const double &ddt, const int &nx, const ColumnVector &open_switches) { | | | < | < | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | inline ColumnVector mtt_euler (const ColumnVector &x, const ColumnVector &dx, const double &ddt, const int &nx, const ColumnVector &open_switches) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (dx); args (2) = octave_value (ddt); args (3) = octave_value ((double)nx); args (4) = octave_value (open_switches); #ifdef STANDALONE f = Fmtt_euler (args, 1); #else f = feval ("mtt_euler", args, 1); #endif return f(0).${vector_value} (); } inline ColumnVector mtt_input (const ColumnVector &x, const ColumnVector &y, const double &t, const ColumnVector &par) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (y); args (2) = octave_value (t); args (3) = octave_value (par); #ifdef STANDALONE f = F${sys}_input (args, 1); #else f = feval ("${sys}_input", args, 1); #endif return f(0).${vector_value} (); } inline ColumnVector mtt_numpar (void) { static octave_value_list args, f; #ifdef STANDALONE f = F${sys}_numpar (args, 1); #else f = feval ("${sys}_numpar", args, 1); #endif return f(0).${vector_value} (); } inline Octave_map mtt_simpar (void) { static octave_value_list args; static Octave_map f; #ifdef STANDALONE f["first"] = F${sys}_simpar (args, 1)(0).map_value ()["first"]; f["dt"] = F${sys}_simpar (args, 1)(0).map_value ()["dt"]; f["last"] = F${sys}_simpar (args, 1)(0).map_value ()["last"]; f["stepfactor"] = F${sys}_simpar (args, 1)(0).map_value ()["stepfactor"]; f["wmin"] = F${sys}_simpar (args, 1)(0).map_value ()["wmin"]; f["wmax"] = F${sys}_simpar (args, 1)(0).map_value ()["wmax"]; |
︙ | ︙ | |||
440 441 442 443 444 445 446 | inline Matrix mtt_smxa (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { | | < | < | < | < | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | inline Matrix mtt_smxa (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); #ifdef STANDALONE f = F${sys}_smxa (args, 1); #else f = feval ("${sys}_smxa", args, 1); #endif return f(0).matrix_value (); } inline ColumnVector mtt_smxax (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); #ifdef STANDALONE f = F${sys}_smxax (args, 1); #else f = feval ("${sys}_smxax", args, 1); #endif return f(0).${vector_value} (); } inline ColumnVector mtt_state (const ColumnVector &x) { static octave_value_list args, f; args (0) = octave_value (x); #ifdef STANDALONE f = F${sys}_state (args, 1); #else f = feval ("${sys}_state", args, 1); #endif return f(0).${vector_value} (); } inline ColumnVector mtt_logic (const ColumnVector &x, const ColumnVector &u, const double &t, const ColumnVector &par) { static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (u); args (2) = octave_value (t); args (3) = octave_value (par); #ifdef STANDALONE f = F${sys}_logic (args, 1); #else f = feval ("${sys}_logic", args, 1); #endif return f(0).${vector_value} (); } |
︙ | ︙ | |||
524 525 526 527 528 529 530 | static int row; const int nx = x.length (), ny = y.length (); register int col = 0; if (0 == row) data = Matrix (nrows, 1+ny+1+nx, 0.0); | | | | | | | | | | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | static int row; const int nx = x.length (), ny = y.length (); register int col = 0; if (0 == row) data = Matrix (nrows, 1+ny+1+nx, 0.0); data.elem (row, col) = t; for (register int i = 0; i < ny; i++) data.elem (row, ++col) = y.elem (i); data.elem (row, ++col) = t; for (register int i = 0; i < nx; i++) data.elem (row, ++col) = x.elem (i); row++; if (nrows == row) #ifdef STANDALONE cout << data << endl; #else // ! STANDALONE set_global_value ("MTT_data", data); #endif } DEFUN_DLD (${sys}_ode2odes, args, , "Octave ode2odes representation of system Usage: ${sys}_ode2odes (x, par, simpar) ") { static octave_value_list retval; static ColumnVector x; static ColumnVector par; static Octave_map simpar; static double first = 0.0, dt = 0.0, last = 0.0, stepfactor = 0.0; int nargin = args.length (); switch (nargin) |
︙ | ︙ | |||
600 601 602 603 604 605 606 | x = mtt_state (par); break; default: usage("${sys}_ode2odes (x par simpar)", nargin); error("aborting."); } | | | | | | | | | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | x = mtt_state (par); break; default: usage("${sys}_ode2odes (x par simpar)", nargin); error("aborting."); } static ColumnVector dx (MTTNX); static ColumnVector u (MTTNU); static ColumnVector y (MTTNY); static Matrix AA (MTTNX, MTTNX); static ColumnVector AAx (MTTNX); static ColumnVector open_switches (MTTNX); register double t = 0.0; const double ddt = dt / stepfactor; const int ilast = static_cast<int> (round ((last - first) / ddt)) + 1; const int nrows = static_cast<int> (round ((last - first) / dt)) + 1; |
︙ | ︙ |
Modified mttroot/mtt/lib/cc/mtt_implicit.cc from [cb13c1e65f] to [38a166bc2b].
︙ | ︙ | |||
57 58 59 60 61 62 63 | return a.lssolve (b, info, rank); } DEFUN_DLD (mtt_implicit, args, , "implicit integration method") { #ifdef OCTAVE_DEV | | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | return a.lssolve (b, info, rank); } DEFUN_DLD (mtt_implicit, args, , "implicit integration method") { #ifdef OCTAVE_DEV static ColumnVector x = args(0).column_vector_value (); const ColumnVector dx = args(1).column_vector_value (); const Matrix AA = args(2).matrix_value (); const ColumnVector AAx = args(3).column_vector_value (); const double t = args(4).double_value (); const int Nx = (int) (args(5).double_value ()); const ColumnVector openx = args(6).column_vector_value (); #else static ColumnVector x = args(0).vector_value (); const ColumnVector dx = args(1).vector_value (); const Matrix AA = args(2).matrix_value (); const ColumnVector AAx = args(3).vector_value (); const double t = args(4).double_value (); const int Nx = (int) (args(5).double_value ()); const ColumnVector openx = args(6).vector_value (); #endif |
︙ | ︙ | |||
87 88 89 90 91 92 93 | { if (0 != openx (i)) { n--; } } | | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | { if (0 != openx (i)) { n--; } } static ColumnVector tmp_dx (n); static ColumnVector tmp_x (n); static ColumnVector tmp_AAx (n); static Matrix tmp_AA (n, n); for (row_new = row_old = 0; row_old < Nx; row_old++) { if (0 == openx (row_old)) { tmp_dx (row_new) = dx (row_old); tmp_AAx (row_new) = AAx (row_old); |
︙ | ︙ |