Regarding Standalone Program

Raghavendra K raghavendra83 at gmail.com
Wed Aug 6 05:29:02 CDT 2008


Hi Jaroslav,
   The expm function is working fine for me. I have also linked up that with
MPI and am able to run my application on 10 processors simultaneously, each
processor invoking its native octave.
I have problem with the xpow function.
Matrix B = xpow(A, 100);
where A is also of type Matrix gives me an error while compilation.

error: no match for 'operator=' in 'B = xpow(const Matrix &,
double)(1.0e+2)'

where each element of the matrix A is initialized with the value 1.1

How do I fix it?

On Wed, Jul 30, 2008 at 6:03 PM, Jaroslav Hajek <highegg at gmail.com> wrote:

> On Wed, Jul 30, 2008 at 2:25 PM, Raghavendra K <raghavendra83 at gmail.com>
> wrote:
> > Hi Jaroslav,
> > Yeah I have been coding C and MPI all my life (never done anything
> regarding
> > C++)
> > Actually I was trying to use Octave with C and then now trying to use
> C++.
> > I have one last query. I have a matrix A
> > Now I want to find the AXAXAXA (i.e A multiplied 100 times byitself).
> > How can I do that in Octave when called by a C++ program?
> > Generally in the Octave prompt I used to give A^100.
> > Is there any multiplication function implemented?
>
> #include <xpow.h> (or octave/xpow.h, depends on configuration, usually
> both works)
>
> ...
>
> Matrix AXAXAXA = xpow (A, 100);
>
>
> > Hoping for a reply again.
> >
> > Will definitely help you if you happen to be on the MPI forums & stuck
> with
> > something :)
> >
>
> Thanks ;)
>
> > On Wed, Jul 30, 2008 at 5:05 PM, Jaroslav Hajek <highegg at gmail.com>
> wrote:
> >>
> >> On Wed, Jul 30, 2008 at 1:28 PM, Raghavendra K <raghavendra83 at gmail.com
> >
> >> wrote:
> >> > Hi,
> >> > Thanks for the reply.
> >> > I am trying to use only expm function. (If I get that working all my
> >> > problems will be resolved).
> >> > When I tried using Matrix:expm(T_a);
> >> > I got this error
> >> >
> >> > test.cc:9: error: no matching function for call to
> >> > `Matrix::expm(Matrix&)'
> >> >
> >> >
> /garl/garl-alpha1/home1/raghu/july1508_matlab/octave/octave-3.0.1/octave/include/octave-3.0.1/octave/dMatrix.h:258:
> >> > error: candidates
> >> >    are: Matrix Matrix::expm() const
> >> >
> >> > What does this mean? ... How can I fix it?
> >> > Please do throw some light.
> >> >
> >>
> >>
> >> Matrix T_a = something;
> >> T_a = T_a.expm ();
> >>
> >> It seems you're not much familiar with C++, right?
> >>
> >> > On Wed, Jul 30, 2008 at 4:43 PM, Jaroslav Hajek <highegg at gmail.com>
> >> > wrote:
> >> >>
> >> >> On Wed, Jul 30, 2008 at 10:11 AM, Raghavendra K
> >> >> <raghavendra83 at gmail.com>
> >> >> wrote:
> >> >> > Hi,
> >> >> >   I am trying to use 2 functions of Octave in my C++ program, they
> >> >> > are
> >> >> > zeros and expm
> >> >> > When I was using MatlabI was able to contact the matlab engine from
> >> >> > the
> >> >> > C
> >> >> > program using this
> >> >> > ep = engOpen("/usr/local/Matlab/bin/matlab
> >> >> > and then execute any function of matlab like this
> >> >> > engEvalString(ep, "T_a = expm(T_a);");
> >> >> >
> >> >> > Is there any equivalent way of doing this in Octave?
> >> >> > If yes can you please provide some pointers as to how to go about
> it.
> >> >> > Thanks a lot for your time.
> >> >> >
> >> >>
> >> >> As David suggested, there's no need to use "zeros" - the Matrix
> >> >> constructor will do the trick.
> >> >> Similarly, the Matrix::expm () method will give you the matrix
> >> >> exponential.
> >> >> You *can* evaluate Octave commands from within C++ using eval_string
> >> >> (declared in parse.h). However, as David noted, to use the parser
> >> >> engine you first need to initialize it, and you'll need to transfer
> >> >> the data to and from the symbol table (if you use normal C++
> >> >> variables). Unless you need to call an m-file function, there is
> >> >> normally a more straightforward way that avoids using the parser.
> >> >>
> >> >> > On Wed, Jul 30, 2008 at 1:32 PM, David Bateman
> >> >> > <David.Bateman at motorola.com>
> >> >> > wrote:
> >> >> >>
> >> >> >> Raghavendra K wrote:
> >> >> >>>
> >> >> >>> Hi,
> >> >> >>>  I am trying to call octave functions from C, but getting an
> error.
> >> >> >>> This is the code that I am using
> >> >> >>>
> >> >> >>>     #include <iostream>
> >> >> >>>     #include <octave/oct.h>
> >> >> >>>     int
> >> >> >>>     main (void)
> >> >> >>>     {
> >> >> >>>       std::cout << "Hello Octave world!\n";
> >> >> >>>       int n = 2;
> >> >> >>>       Matrix a_matrix = Matrix (n, n);
> >> >> >>>       a_matrix = zeros(n, n);
> >> >> >>>       std::cout << a_matrix;
> >> >> >>>       return 0;
> >> >> >>>     }
> >> >> >>>
> >> >> >>
> >> >> >> Try
> >> >> >>
> >> >> >> #include <iostream>
> >> >> >> #include <octave/oct.h>
> >> >> >> int
> >> >> >> main (void)
> >> >> >> {
> >> >> >>  std::cout << "Hello Octave world!\n";
> >> >> >>  int n = 2;
> >> >> >>  Matrix a_matrix = Matrix (n, n, 0.);
> >> >> >>  std::cout << a_matrix;
> >> >> >>  return 0;
> >> >> >> }
> >> >> >>
> >> >> >>
> >> >> >> instead. You can't call zeros like that but must use the feval
> >> >> >> function,
> >> >> >> and if you need feval you have to initialize the parser. There are
> >> >> >> threads
> >> >> >> in the mailing list about this..
> >> >> >>
> >> >> >> Regards
> >> >> >> David
> >> >> >>
> >> >> >> --
> >> >> >> David Bateman
> >> >> >>  David.Bateman at motorola.com
> >> >> >> Motorola Labs - Paris                        +33 1 69 35 48 04
> (Ph)
> >> >> >> Parc
> >> >> >> Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
> >> >> >> 91193
> >> >> >> Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)
> >> >> >> The information contained in this communication has been
> classified
> >> >> >> as:
> >> >> >> [x] General Business Information [ ] Motorola Internal Use Only [
> ]
> >> >> >> Motorola Confidential Proprietary
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Regards,
> >> >> > Raghavendra K
> >> >> >
> >> >> > _______________________________________________
> >> >> > Help-octave mailing list
> >> >> > Help-octave at octave.org
> >> >> > https://www.cae.wisc.edu/mailman/listinfo/help-octave
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> RNDr. Jaroslav Hajek
> >> >> computing expert
> >> >> Aeronautical Research and Test Institute (VZLU)
> >> >> Prague, Czech Republic
> >> >> url: www.highegg.matfyz.cz
> >> >
> >> >
> >> >
> >> > --
> >> > Regards,
> >> > Raghavendra K
> >> >
> >>
> >>
> >>
> >> --
> >> RNDr. Jaroslav Hajek
> >> computing expert
> >> Aeronautical Research and Test Institute (VZLU)
> >> Prague, Czech Republic
> >> url: www.highegg.matfyz.cz
> >
> >
> >
> > --
> > Regards,
> > Raghavendra K
> >
>
>
>
> --
> RNDr. Jaroslav Hajek
> computing expert
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
>



-- 
Regards,
Raghavendra K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080806/dde9e0db/attachment-0001.html 


More information about the Help-octave mailing list