c++ - boost matrix with relic -


i'm trying use boost matrix of fb_t, relic object represents element of finite field. here how fb_t defined doc:

typedef uint64_t dig_t typedef align dig_t fb_t[fb_digs+padding(fb_bytes)/(fb_digit/8)] 

and here's code:

#include <iostream> #include <boost/numeric/ublas/matrix.hpp>  extern "c" { #include <relic.h> } #include "relic_test.h"  using namespace std; typedef boost::numeric::ublas::matrix<fb_t> matrix;  int main(void) {     core_init();     fb_param_set_any();     fb_param_print();      matrix mat(2,2);     core_clean();    return 0; } 

i got following error:

compiling: main.cpp in file included /usr/include/boost/numeric/ublas/vector.hpp:19:0,                  /usr/include/boost/numeric/ublas/matrix.hpp:16,                  /home/foo/main.cpp:2: /usr/include/boost/numeric/ublas/storage.hpp: in instantiation of ‘boost::numeric::ublas::unbounded_array<t, alloc>::unbounded_array(boost::numeric::ublas::unbounded_array<t, alloc>::size_type, const alloc&) [with t = unsigned int [4]; alloc = std::allocator<unsigned int [4]>; boost::numeric::ublas::unbounded_array<t, alloc>::size_type = unsigned int]’: /usr/include/boost/numeric/ublas/matrix.hpp:131:92:   required ‘boost::numeric::ublas::matrix<t, l, a>::matrix(boost::numeric::ublas::matrix<t, l, a>::size_type, boost::numeric::ublas::matrix<t, l, a>::size_type) [with t = unsigned int [4]; l = boost::numeric::ublas::basic_row_major<>; = boost::numeric::ublas::unbounded_array<unsigned int [4], std::allocator<unsigned int [4]> >; boost::numeric::ublas::matrix<t, l, a>::size_type = unsigned int]’ /home/foo/main.cpp:21:19:   required here /usr/include/boost/numeric/ublas/storage.hpp:71:23: error: functional cast array type ‘boost::numeric::ublas::unbounded_array<unsigned int [4], std::allocator<unsigned int [4]> >::value_type {aka unsigned int [4]}’ /usr/include/boost/numeric/ublas/storage.hpp: in instantiation of ‘static void boost::numeric::ublas::unbounded_array<t, alloc>::iterator_destroy(t*&) [with t = unsigned int [4]; alloc = std::allocator<unsigned int [4]>; boost::numeric::ublas::unbounded_array<t, alloc>::iterator = unsigned int (*)[4]]’: /usr/include/boost/numeric/ublas/storage.hpp:106:25:   required ‘boost::numeric::ublas::unbounded_array<t, alloc>::~unbounded_array() [with t = unsigned int [4]; alloc = std::allocator<unsigned int [4]>]’ /usr/include/boost/numeric/ublas/matrix.hpp:90:11:   required here /usr/include/boost/numeric/ublas/storage.hpp:290:13: error: request member ‘~boost::numeric::ublas::unbounded_array<unsigned int [4], std::allocator<unsigned int [4]> >::value_type’ in ‘* i’, of non-class type ‘unsigned int [4]’ 

i'm not quite sure error message about. idea?

i don't think boost::ublas supports arrays value types. error message because arrays not copyable. around wrap fb_t in class:

struct fb_t_wrapper {     fb_t value; }; 

or use std::array

using fb_t_array = std::array<dig_t, fb_digs+padding(fb_bytes)/(fb_digit/8)>; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -