help-octave
[Top][All Lists]
Advanced

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

Re: Accessing Galois field in c++ code


From: Mike Miller
Subject: Re: Accessing Galois field in c++ code
Date: Tue, 12 Apr 2016 16:27:06 -0700
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Apr 12, 2016 at 10:37:33 +0530, Shamika Mohanan wrote:
> Hello,
> 
> I have the following code-
> 
> m = 4;
> x = [3 2 9];
> y = gf(x,m)
> y =
> GF(2^4) array. Primitive Polynomial = D^4+D+1 (decimal 19)
> 
> Array elements =
> 
>    3   2   9
> 
> If I type class(y), I get 'galois'.
> 
> I'm trying to call gf function in C++ code. I use the following code-
> 
> argv(0) = "embedded";
> argv(1) = "-q";
> octave_main (2, argv.c_str_vec (), 1);
> feval ("pkg", ovl ("load", "all"), 0);
> octave_value_list out = feval ("gf", in, o);
> 
> 'in'  octave_value_list contains all the input arguments. 'out' contains
> the output arguments.
> 
> I'm having trouble accessing the GF output. I tried
> out(p).get_class_name="galois" but I get an error.
> 
> How do I identify the output is of type Galois? How do I access GF array
> and primitive polynomial?

A Galois array is stored in an instance of the class "octave_galois".
This type is compiled into the functions that are part of the
communications package and registered with the Octave type system.

The communications package is not currently structured to export its
types as a library that can be used by your code, but if you want you
can try to embed the code in your GPL-compatible project and use the
galois and octave_galois classes.

Or you can use the generic octave_value::subsref function to access the
attributes of the Galois value, for example "x" or "prim_poly".

HTH,

-- 
mike



reply via email to

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