Overview
Comment:Removed temporary Matrices from mtt_implicit.cc
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0b9c3c56c16bdf1579f932de15e7ab2676f80af1fcd3d9ecf6e18bbba2c8fe94
User & Date: geraint@users.sourceforge.net on 2001-02-18 09:18:49
Other Links: branch diff | manifest | tags
Context
2001-02-19
06:32:02
Octave path change, remove libblas check-in: cdf1d3ec4d user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-02-18
09:18:49
Removed temporary Matrices from mtt_implicit.cc check-in: 0b9c3c56c1 user: geraint@users.sourceforge.net tags: origin/master, trunk
00:10:30
Print message. check-in: d206e09bb9 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [491cacbcda] to [4e2c06f136].

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.48  2001/02/11 07:08:59  geraint
## Static declarations of octave_value_lists: small .exe speed improvement
##
## 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











>
>
>







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.49  2001/02/14 06:06:34  geraint
## Removed octave_value_list wrappers from standalone.exe - speed improvements
##
## Revision 1.48  2001/02/11 07:08:59  geraint
## Static declarations of octave_value_lists: small .exe speed improvement
##
## 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
284
285
286
287
288
289
290
291

292
293
294
295
296
297

298
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
333
334

335
336

337
338
339
340
341
342
343
344
345
346
#include <octave/${feval_header}>
#endif

#include "${sys}_def.h"
#include "${sys}_sympar.h"

#ifdef STANDALONE
extern ColumnVector Fmtt_euler (	ColumnVector &x,

					const ColumnVector &dx,
					const double &ddt,
					const int &nx,
					const ColumnVector &open_switches);
 
extern ColumnVector Fmtt_implicit (	ColumnVector &x,

				   	const ColumnVector &dx,
				   	const Matrix &AA,
				   	const ColumnVector &AAx,
				   	const double &ddt,
				   	const int &nx,
				   	const ColumnVector &open_switches);

extern ColumnVector F${sys}_${ode} (	ColumnVector &x,

				    	ColumnVector &u,
				    	const double &t,
				    	ColumnVector &par);

extern ColumnVector F${sys}_${odeo} (	ColumnVector &x,

				     	ColumnVector &u,
				     	const double &t,
				     	ColumnVector &par);

extern ColumnVector F${sys}_input (	ColumnVector &x,

					ColumnVector &y,
				   	const double &t,
				   	ColumnVector &par);

extern ColumnVector F${sys}_numpar (	void);




extern Octave_map F${sys}_simpar (     	void);

extern Matrix F${sys}_smxa (		ColumnVector &x,

			    		ColumnVector &u,
			    		const double &t,
			    		ColumnVector &par);

extern ColumnVector F${sys}_smxax (	ColumnVector &x,

				   	ColumnVector &u,
				   	const double &t,
				   	ColumnVector &par);

extern ColumnVector F${sys}_state (	ColumnVector &x);


extern ColumnVector F${sys}_logic (	ColumnVector &x,

				   	ColumnVector &u,
				   	const double &t,
				   	ColumnVector &par);
#endif // STANDALONE


inline ColumnVector
mtt_${ode} (ColumnVector &x,
	    ColumnVector &u,
	    const double &t,







|
>
|
|
|
|

|
>
|
|
|
|
|
|

|
>
|
|
|

|
>
|
|
|

|
>
|
|
|

|
>
>
>
|
<

|
>
|
|
|

|
>
|
|
|
|
|
>

|
>
|
|
|







287
288
289
290
291
292
293
294
295
296
297
298
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

333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#include <octave/${feval_header}>
#endif

#include "${sys}_def.h"
#include "${sys}_sympar.h"

#ifdef STANDALONE
extern ColumnVector Fmtt_euler (
	ColumnVector &x,
	const ColumnVector &dx,
	const double &ddt,
	const int &nx,
	const ColumnVector &open_switches);
 
extern ColumnVector Fmtt_implicit (
	ColumnVector &x,
	ColumnVector &dx,
	Matrix &AA,
	const ColumnVector &AAx,
	const double &ddt,
	const int &nx,
	const ColumnVector &open_switches);

extern ColumnVector F${sys}_${ode} (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_${odeo} (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_input (
	ColumnVector &x,
	ColumnVector &y,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_numpar (
	void);

extern Octave_map F${sys}_simpar (
     	void);


extern Matrix F${sys}_smxa (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_smxax (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);
 
extern ColumnVector F${sys}_state (
	ColumnVector &x);

extern ColumnVector F${sys}_logic (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);
#endif // STANDALONE


inline ColumnVector
mtt_${ode} (ColumnVector &x,
	    ColumnVector &u,
	    const double &t,
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
  f = feval ("${sys}_${odeo}", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_implicit (ColumnVector &x,
	      const ColumnVector &dx,
	      const Matrix &AA,
	      const ColumnVector &AAx,
	      const double &ddt,
	      const int &nx,
	      const ColumnVector &open_switches)
{
#ifdef STANDALONE
  return Fmtt_implicit (x, dx, AA, AAx, ddt, nx, open_switches);







|
|







390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
  f = feval ("${sys}_${odeo}", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_implicit (ColumnVector &x,
	      ColumnVector &dx,
	      Matrix &AA,
	      const ColumnVector &AAx,
	      const double &ddt,
	      const int &nx,
	      const ColumnVector &open_switches)
{
#ifdef STANDALONE
  return Fmtt_implicit (x, dx, AA, AAx, ddt, nx, open_switches);

Modified mttroot/mtt/lib/cc/mtt_implicit.cc from [039828956b] to [e5b126ad31].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <octave/oct.h>
#include <octave/xdiv.h>

#ifdef STANDALONE
ColumnVector Fmtt_implicit (      ColumnVector	&x,
			    const ColumnVector	&dx,
			    const Matrix	&AA,
			    const ColumnVector	&AAx,
			    const double	&t,
			    const int		&Nx,
			    const ColumnVector	&openx)
{
#else // !STANDALONE
DEFUN_DLD (mtt_implicit, args, ,





|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <octave/oct.h>
#include <octave/xdiv.h>

#ifdef STANDALONE
ColumnVector Fmtt_implicit (      ColumnVector	&x,
				  ColumnVector	&dx,
			          Matrix	&AA,
			    const ColumnVector	&AAx,
			    const double	&t,
			    const int		&Nx,
			    const ColumnVector	&openx)
{
#else // !STANDALONE
DEFUN_DLD (mtt_implicit, args, ,
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  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 // OCTAVE_DEV
#endif // STANDALONE

  register int i, n;
  register int col_old, col_new;
  register int row_old, row_new;

  n = Nx;
  for (i = 0; i < Nx; i++)
    {
      if (0 != openx (i))
	{
	  n--;
	}
    }

  static Matrix	tmp_dx	(n,1);
  static Matrix	tmp_x	(n,1);
  static Matrix	tmp_AAx	(n,1);
  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,0)	= dx  (row_old);
	  tmp_AAx (row_new,0)	= AAx (row_old);
	  for (col_new = col_old = 0; col_old < Nx; col_old++)
	    {
	      if (0 == openx (col_old))
		{
		  // xxx: this can be improved by symmetry
		  tmp_AA (row_new,col_new) = AA (row_old,col_old);
		  col_new++;
		}
	    }
	  row_new++;
	}
    }

  tmp_x = xleftdiv (tmp_AA, (tmp_AAx + tmp_dx * t));
  
  row_new = 0;
  for (row_old = 0; row_old < Nx; row_old++)
    {
      if (0 == openx (row_old))
	{
	  x (row_old) = tmp_x (row_new,0);
	  row_new++;
	}
      else
	{
	  x (row_old) = 0.0;
	}
    }

#ifdef STANDALONE
  return x;
#else // !STANDALONE
  return octave_value (x);
#endif // STANDALONE
}







<
<
|

<
|

|

<
<
<
|
<
<
<
<
|
<
|
<
<
<
<
<
<
<
<
<
|
<
|
|
<
|
|
|
<

|
<

|

<
<
<
<
<
|









29
30
31
32
33
34
35


36
37

38
39
40
41



42




43

44









45

46
47

48
49
50

51
52

53
54
55





56
57
58
59
60
61
62
63
64
65
  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 // OCTAVE_DEV
#endif // STANDALONE



  register int row, col;


  for (row = 0; row < Nx; row++)
    {
      if (0 != openx (row))
	{



          dx (row) = 0.0;




	  for (col = 0; col < Nx; col++)

	    {









	      AA (row,col) = AA (col,row) = 0.0;

	    }
	}

    }

  x = static_cast<ColumnVector> (xleftdiv (AA, static_cast<Matrix>(AAx + dx * t)));

  
  for (row = 0; row < Nx; row++)

    {
      if (0 != openx (row))
	{





	  x (row) = 0.0;
	}
    }

#ifdef STANDALONE
  return x;
#else // !STANDALONE
  return octave_value (x);
#endif // STANDALONE
}


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]