Xmipp  v3.23.11-Nereus
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
alglib::ae_matrix_wrapper Class Reference

#include <ap.h>

Inheritance diagram for alglib::ae_matrix_wrapper:
Inheritance graph
[legend]
Collaboration diagram for alglib::ae_matrix_wrapper:
Collaboration graph
[legend]

Public Member Functions

 ae_matrix_wrapper ()
 
virtual ~ae_matrix_wrapper ()
 
const ae_matrix_wrapperoperator= (const ae_matrix_wrapper &rhs)
 
void setlength (ae_int_t rows, ae_int_t cols)
 
ae_int_t rows () const
 
ae_int_t cols () const
 
bool isempty () const
 
ae_int_t getstride () const
 
void attach_to (alglib_impl::ae_matrix *ptr)
 
void allocate_own (ae_int_t rows, ae_int_t cols, alglib_impl::ae_datatype datatype)
 
const alglib_impl::ae_matrixc_ptr () const
 
alglib_impl::ae_matrixc_ptr ()
 

Protected Member Functions

void create (const ae_matrix_wrapper &rhs)
 
void create (const char *s, alglib_impl::ae_datatype datatype)
 
void assign (const ae_matrix_wrapper &rhs)
 

Protected Attributes

alglib_impl::ae_matrixp_mat
 
alglib_impl::ae_matrix mat
 

Detailed Description

Definition at line 1200 of file ap.h.

Constructor & Destructor Documentation

◆ ae_matrix_wrapper()

alglib::ae_matrix_wrapper::ae_matrix_wrapper ( )

Definition at line 6303 of file ap.cpp.

6304 {
6305  p_mat = NULL;
6306 }
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252

◆ ~ae_matrix_wrapper()

alglib::ae_matrix_wrapper::~ae_matrix_wrapper ( )
virtual

Definition at line 6308 of file ap.cpp.

6309 {
6310  if( p_mat==&mat )
6312 }
alglib_impl::ae_matrix mat
Definition: ap.h:1253
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
void ae_matrix_clear(ae_matrix *dst)
Definition: ap.cpp:891

Member Function Documentation

◆ allocate_own()

void alglib::ae_matrix_wrapper::allocate_own ( ae_int_t  rows,
ae_int_t  cols,
alglib_impl::ae_datatype  datatype 
)

Definition at line 6454 of file ap.cpp.

6455 {
6456  if( p_mat==&mat )
6458  p_mat = &mat;
6459  if( !ae_matrix_init(p_mat, rows, cols, datatype, NULL, false) )
6460  throw alglib::ap_error("ALGLIB: malloc error");
6461 }
alglib_impl::ae_matrix mat
Definition: ap.h:1253
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:756
ae_int_t rows() const
Definition: ap.cpp:6419
void ae_matrix_clear(ae_matrix *dst)
Definition: ap.cpp:891
ae_int_t cols() const
Definition: ap.cpp:6426

◆ assign()

void alglib::ae_matrix_wrapper::assign ( const ae_matrix_wrapper rhs)
protected

Definition at line 6371 of file ap.cpp.

6372 {
6373  if( this==&rhs )
6374  return;
6375  if( p_mat==&mat || p_mat==NULL )
6376  {
6377  //
6378  // Assignment to non-proxy object
6379  //
6381  if( rhs.p_mat!=NULL )
6382  {
6383  p_mat = &mat;
6384  if( !ae_matrix_init_copy(p_mat, rhs.p_mat, NULL, ae_false) )
6385  throw alglib::ap_error("ALGLIB: malloc error!");
6386  }
6387  else
6388  p_mat = NULL;
6389  }
6390  else
6391  {
6392  //
6393  // Assignment to proxy object
6394  //
6395  ae_int_t i;
6396  if( rhs.p_mat==NULL )
6397  throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes do not match)");
6398  if( rhs.p_mat->datatype!=p_mat->datatype )
6399  throw alglib::ap_error("ALGLIB: incorrect assignment to array (types do not match)");
6400  if( rhs.p_mat->rows!=p_mat->rows )
6401  throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes do not match)");
6402  if( rhs.p_mat->cols!=p_mat->cols )
6403  throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes do not match)");
6404  for(i=0; i<p_mat->rows; i++)
6405  memcpy(p_mat->ptr.pp_void[i], rhs.p_mat->ptr.pp_void[i], p_mat->cols*alglib_impl::ae_sizeof(p_mat->datatype));
6406  }
6407 }
ae_int_t cols
Definition: ap.h:445
alglib_impl::ae_matrix mat
Definition: ap.h:1253
#define ae_false
Definition: ap.h:196
union alglib_impl::ae_matrix::@12 ptr
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:801
#define i
ae_int_t rows
Definition: ap.h:444
ae_int_t ae_sizeof(ae_datatype datatype)
Definition: ap.cpp:273
ae_datatype datatype
Definition: ap.h:447
void ** pp_void
Definition: ap.h:452
alglib_impl::ae_int_t ae_int_t
Definition: ap.h:889
void ae_matrix_clear(ae_matrix *dst)
Definition: ap.cpp:891

◆ attach_to()

void alglib::ae_matrix_wrapper::attach_to ( alglib_impl::ae_matrix ptr)

Definition at line 6445 of file ap.cpp.

6446 {
6447  if( ptr==&mat )
6448  throw alglib::ap_error("ALGLIB: attempt to attach matrix to itself");
6449  if( p_mat==&mat )
6451  p_mat = ptr;
6452 }
alglib_impl::ae_matrix mat
Definition: ap.h:1253
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
void ae_matrix_clear(ae_matrix *dst)
Definition: ap.cpp:891

◆ c_ptr() [1/2]

const alglib_impl::ae_matrix * alglib::ae_matrix_wrapper::c_ptr ( ) const

Definition at line 6463 of file ap.cpp.

6464 {
6465  return p_mat;
6466 }
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252

◆ c_ptr() [2/2]

alglib_impl::ae_matrix * alglib::ae_matrix_wrapper::c_ptr ( )

Definition at line 6468 of file ap.cpp.

6469 {
6470  return p_mat;
6471 }
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252

◆ cols()

alglib::ae_int_t alglib::ae_matrix_wrapper::cols ( ) const

Definition at line 6426 of file ap.cpp.

6427 {
6428  if( p_mat==NULL )
6429  return 0;
6430  return p_mat->cols;
6431 }
ae_int_t cols
Definition: ap.h:445
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252

◆ create() [1/2]

void alglib::ae_matrix_wrapper::create ( const ae_matrix_wrapper rhs)
protected

Definition at line 6320 of file ap.cpp.

6321 {
6322  if( rhs.p_mat!=NULL )
6323  {
6324  p_mat = &mat;
6325  if( !ae_matrix_init_copy(p_mat, rhs.p_mat, NULL, ae_false) )
6326  throw alglib::ap_error("ALGLIB: malloc error!");
6327  }
6328  else
6329  p_mat = NULL;
6330 }
alglib_impl::ae_matrix mat
Definition: ap.h:1253
#define ae_false
Definition: ap.h:196
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:801

◆ create() [2/2]

void alglib::ae_matrix_wrapper::create ( const char *  s,
alglib_impl::ae_datatype  datatype 
)
protected

Definition at line 6332 of file ap.cpp.

6333 {
6334  std::vector< std::vector<const char*> > smat;
6335  size_t i, j;
6336  char *p = filter_spaces(s);
6337  try
6338  {
6339  str_matrix_create(p, &smat);
6340  if( smat.size()!=0 )
6341  {
6342  allocate_own((ae_int_t)(smat.size()), (ae_int_t)(smat[0].size()), datatype);
6343  for(i=0; i<smat.size(); i++)
6344  for(j=0; j<smat[0].size(); j++)
6345  {
6346  if( datatype==alglib_impl::DT_BOOL )
6347  p_mat->ptr.pp_bool[i][j] = parse_bool_delim(smat[i][j],",]");
6348  if( datatype==alglib_impl::DT_INT )
6349  p_mat->ptr.pp_int[i][j] = parse_int_delim(smat[i][j],",]");
6350  if( datatype==alglib_impl::DT_REAL )
6351  p_mat->ptr.pp_double[i][j] = parse_real_delim(smat[i][j],",]");
6352  if( datatype==alglib_impl::DT_COMPLEX )
6353  {
6354  alglib::complex t = parse_complex_delim(smat[i][j],",]");
6355  p_mat->ptr.pp_complex[i][j].x = t.x;
6356  p_mat->ptr.pp_complex[i][j].y = t.y;
6357  }
6358  }
6359  }
6360  else
6361  allocate_own(0, 0, datatype);
6363  }
6364  catch(...)
6365  {
6367  throw;
6368  }
6369 }
ae_bool parse_bool_delim(const char *s, const char *delim)
Definition: ap.cpp:6921
union alglib_impl::ae_matrix::@12 ptr
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
alglib::complex parse_complex_delim(const char *s, const char *delim)
Definition: ap.cpp:7086
double parse_real_delim(const char *s, const char *delim)
Definition: ap.cpp:7077
void allocate_own(ae_int_t rows, ae_int_t cols, alglib_impl::ae_datatype datatype)
Definition: ap.cpp:6454
#define i
ae_int_t ** pp_int
Definition: ap.h:454
ae_complex ** pp_complex
Definition: ap.h:456
ae_bool ** pp_bool
Definition: ap.h:453
#define j
double ** pp_double
Definition: ap.h:455
char * filter_spaces(const char *s)
Definition: ap.cpp:6830
alglib_impl::ae_int_t ae_int_t
Definition: ap.h:889
double y
Definition: ap.h:941
double x
Definition: ap.h:941
void str_matrix_create(const char *src, std::vector< std::vector< const char *> > *p_mat)
Definition: ap.cpp:6881
void ae_free(void *p)
Definition: ap.cpp:237
ae_int_t parse_int_delim(const char *s, const char *delim)
Definition: ap.cpp:6952

◆ getstride()

alglib::ae_int_t alglib::ae_matrix_wrapper::getstride ( ) const

Definition at line 6438 of file ap.cpp.

6439 {
6440  if( p_mat==NULL )
6441  return 0;
6442  return p_mat->stride;
6443 }
ae_int_t stride
Definition: ap.h:446
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252

◆ isempty()

bool alglib::ae_matrix_wrapper::isempty ( ) const

Definition at line 6433 of file ap.cpp.

6434 {
6435  return rows()==0 || cols()==0;
6436 }
ae_int_t rows() const
Definition: ap.cpp:6419
ae_int_t cols() const
Definition: ap.cpp:6426

◆ operator=()

const alglib::ae_matrix_wrapper & alglib::ae_matrix_wrapper::operator= ( const ae_matrix_wrapper rhs)

Definition at line 6314 of file ap.cpp.

6315 {
6316  assign(rhs);
6317  return *this;
6318 }
void assign(const ae_matrix_wrapper &rhs)
Definition: ap.cpp:6371

◆ rows()

alglib::ae_int_t alglib::ae_matrix_wrapper::rows ( ) const

Definition at line 6419 of file ap.cpp.

6420 {
6421  if( p_mat==NULL )
6422  return 0;
6423  return p_mat->rows;
6424 }
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
ae_int_t rows
Definition: ap.h:444

◆ setlength()

void alglib::ae_matrix_wrapper::setlength ( ae_int_t  rows,
ae_int_t  cols 
)

Definition at line 6409 of file ap.cpp.

6410 {
6411  if( p_mat==NULL )
6412  throw alglib::ap_error("ALGLIB: setlength() error, p_mat==NULL (array was not correctly initialized)");
6413  if( p_mat!=&mat )
6414  throw alglib::ap_error("ALGLIB: setlength() error, p_mat!=&mat (attempt to resize frozen array)");
6415  if( !ae_matrix_set_length(p_mat, rows, cols, NULL) )
6416  throw alglib::ap_error("ALGLIB: malloc error");
6417 }
alglib_impl::ae_matrix mat
Definition: ap.h:1253
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1252
ae_int_t rows() const
Definition: ap.cpp:6419
ae_int_t cols() const
Definition: ap.cpp:6426
ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state)
Definition: ap.cpp:854

Member Data Documentation

◆ mat

alglib_impl::ae_matrix alglib::ae_matrix_wrapper::mat
protected

Definition at line 1253 of file ap.h.

◆ p_mat

alglib_impl::ae_matrix* alglib::ae_matrix_wrapper::p_mat
protected

Definition at line 1252 of file ap.h.


The documentation for this class was generated from the following files: