help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

loading matrix in C/C++ and memory management


From: Hairong Shang
Subject: loading matrix in C/C++ and memory management
Date: Wed, 13 Jul 2005 11:09:53 -0500
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0

We are starting to incorporate octave methods into our software because of its fast speed in numerical calculations, comparable to matlab. I have tested the matrix svd, it works just great! We will be probably free of matlab finally. However, I am new to octave, the help list helped me in learning how to call octave libaries in my C/C++ code. However, I still have some question (will be more in the future)
such as how to load matrix in C/C++,
in my input file, I can easily get the value of each column in double format,
for example
double *c1, *c2, *c3;
int rows=50, cols=3;

How to create the octave matrix with the above data? The memory of c1, c2, and c3 may not be conjugate, however,
the memory of octave matrix is conjugate in column order, right?

Another similar question is:
how to append or insert a vector create by octave_rand::vector(r) into the existing matrix?

The third question is about the memory management of octave? Should I explicitly free the memory in the following loop?

for (i=0;i<10;i++)
   Array a=octave_rand::vector(5);

since the memory is allocate at each iteration.

Thank you.

Hairong



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]