Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes
MedMat< T > Class Template Reference
Inheritance diagram for MedMat< T >:
SerializableObject

Public Member Functions

unsigned long long size () const
 
vector< T > & get_vec ()
 
void copy_vec (vector< T > &c_vec)
 
operator() (size_t i, size_t j) const
 
T & operator() (size_t i, size_t j)
 
get (size_t i, size_t j) const
 
T & set (size_t i, size_t j)
 
void copy_header (MedMat< T > &other)
 
MedMat< T > & operator= (MedMat< T > &&other) noexcept
 
MedMat< T > & operator= (const MedMat< T > &other) noexcept
 
 MedMat (int n_rows, int n_cols)
 
 MedMat (const MedMat< T > &other)
 
template<class S >
 MedMat (S *x, int n_rows, int n_cols)
 
template<class S >
 MedMat (const vector< S > &x, int n_cols)
 
template<class S >
 MedMat (MedMat< S > &x)
 
template<class S >
void load (S *x, int n_rows, int n_cols)
 
template<class S >
void load_transposed (S *x, int n_rows, int n_cols)
 
template<class S >
void load (const vector< S > &x, int n_cols)
 
template<class S >
void load (MedMat< S > &x)
 
void zero ()
 
void set_val (T val)
 
void clear ()
 
T * data_ptr ()
 
const T * data_ptr () const
 
T * data_ptr (size_t r, size_t c)
 
int get_nrows ()
 
int get_ncols ()
 
void resize (int n_rows, int n_cols)
 
int read_from_bin_file (const string &fname)
 
int write_to_bin_file (const string &fname)
 
int write_to_csv_file (const string &fname)
 
int read_from_csv_file (const string &fname, int titles_line_flag)
 
 ADD_SERIALIZATION_FUNCS (m, nrows, ncols, row_ids, recordsMetadata, signals, avg, std, normalized_flag, transposed_flag, missing_value)
 
void transpose ()
 
void get_sub_mat (vector< int > &rows_to_take, vector< int > &cols_to_take)
 
void get_sub_mat_by_flags (vector< int > &rows_to_take_flag, vector< int > &cols_to_take_flag)
 
void reorder_by_row (vector< int > &row_order)
 
void reorder_by_col (vector< int > &col_order)
 
void random_split_mat_by_ids (MedMat< T > &mat_0, MedMat< T > &mat_1, float p0, vector< int > &inds0, vector< int > &inds1)
 
template<class S >
void add_rows (MedMat< S > &m_add)
 
template<class S >
void add_rows (S *m_add, int nrows_to_add)
 
template<class S >
void add_rows (vector< S > &m_add)
 
template<class S >
void add_cols (MedMat< S > &m_add)
 
template<class S >
void add_cols (S *m_add, int ncols_to_add)
 
template<class S >
void add_cols (vector< S > &m_add)
 
void get_row (int i_row, vector< T > &rowv) const
 
void get_col (int i_col, vector< T > &colv) const
 
void normalize (int norm_type, float *wgts)
 
void normalize (int norm_type, vector< float > &wgts)
 
void normalize (int norm_type=Normalize_Cols)
 
template<class S >
void normalize (const vector< S > &external_avg, const vector< S > &external_std, int norm_type=1)
 
void get_cols_avg_std (vector< T > &_avg, vector< T > &_std)
 
void print_row (FILE *fout, const string &prefix, const string &format, int i_row)
 
void set_signals (vector< string > &sigs)
 
bool is_valid (bool output=false)
 
string my_class_name () const
 For better handling of serializations it is highly recommended that each SerializableObject inheriting class will implement the next method.
 
- Public Member Functions inherited from SerializableObject
virtual int version () const
 Relevant for serializations.
 
virtual void serialized_fields_name (vector< string > &field_names) const
 The names of the serialized fields.
 
virtual void * new_polymorphic (string derived_name)
 for polymorphic classes that want to be able to serialize/deserialize a pointer * to the derived class given its type one needs to implement this function to return a new to the derived class given its type (as in my_type)
 
virtual void pre_serialization ()
 
virtual void post_deserialization ()
 
virtual size_t get_size ()
 Gets bytes sizes for serializations.
 
virtual size_t serialize (unsigned char *blob)
 Serialiazing object to blob memory. return number ob bytes wrote to memory.
 
virtual size_t deserialize (unsigned char *blob)
 Deserialiazing blob to object. returns number of bytes read.
 
size_t serialize_vec (vector< unsigned char > &blob)
 
size_t deserialize_vec (vector< unsigned char > &blob)
 
virtual size_t serialize (vector< unsigned char > &blob)
 
virtual size_t deserialize (vector< unsigned char > &blob)
 
virtual int read_from_file (const string &fname)
 read and deserialize model
 
virtual int write_to_file (const string &fname)
 serialize model and write to file
 
virtual int read_from_file_unsafe (const string &fname)
 read and deserialize model without checking version number - unsafe read
 
int init_from_string (string init_string)
 Init from string.
 
int init_params_from_file (string init_file)
 
int init_param_from_file (string file_str, string &param)
 
virtual int init (map< string, string > &map)
 Virtual to init object from parsed fields.
 
int update_from_string (const string &init_string)
 
virtual int update (map< string, string > &map)
 Virtual to update object from parsed fields.
 
virtual string object_json () const
 

Data Fields

unsigned long long nrows = 0
 
unsigned long long ncols = 0
 
vector< int > row_ids
 
vector< RecordDatarecordsMetadata
 
vector< string > signals
 
vector< T > avg
 
vector< T > std
 
int normalized_flag = 0
 
int transposed_flag = 0
 
missing_value
 

Static Public Attributes

static const int Normalize_Cols = 1
 
static const int Normalize_Rows = 2
 

Member Function Documentation

◆ my_class_name()

template<class T >
string MedMat< T >::my_class_name ( ) const
inlinevirtual

For better handling of serializations it is highly recommended that each SerializableObject inheriting class will implement the next method.

It is a must when one needs to support the new_polymorphic method. One can simply add the macro ADD_CLASS_NAME(class) as a public member in the class.

Reimplemented from SerializableObject.


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