45 matrix(std::initializer_list<std::initializer_list<ex>> l);
52 size_t nops()
const override;
53 ex op(
size_t i)
const override;
96 unsigned rank()
const;
106 int pivot(
unsigned ro,
unsigned co,
bool symbolic =
true);
108 void print_elements(
const print_context &
c,
const char *row_start,
const char *row_end,
const char *row_sep,
const char *col_sep)
const;
139{
return m.transpose(); }
148{
return m.charpoly(lambda); }
153{
return m.inverse(algo); }
179extern ex
symbolic_matrix(
unsigned r,
unsigned c,
const std::string & base_name,
const std::string & tex_base_name);
186extern ex
sub_matrix(
const matrix&
m,
unsigned r,
unsigned nr,
unsigned c,
unsigned nc);
Archiving of GiNaC expressions.
Interface to GiNaC's ABC.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Wrapper template for making GiNaC classes out of STL containers.
@ automatic
Let the system choose.
Lightweight wrapper for GiNaC's symbolic objects.
matrix inverse() const
Inverse of this matrix, with automatic algorithm selection.
int gauss_elimination(const bool det=false)
Perform the steps of an ordinary Gaussian elimination to bring the m x n matrix into an upper echelon...
ex scalar_mul_indexed(const ex &self, const numeric &other) const override
Product of an indexed matrix with a number.
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of an indexed matrix.
unsigned cols() const
Get number of columns.
ex charpoly(const ex &lambda) const
Characteristic Polynomial.
void do_print_latex(const print_latex &c, unsigned level) const
exvector m
representation (cols indexed first)
ex determinant(unsigned algo=determinant_algo::automatic) const
Determinant of square matrix.
const ex & operator()(unsigned ro, unsigned co) const
operator() to access elements for reading.
void archive(archive_node &n) const override
Save (a.k.a.
ex add_indexed(const ex &self, const ex &other) const override
Sum of two indexed matrices.
bool is_zero_matrix() const
Function to check that all elements of the matrix are zero.
ex trace() const
Trace of a matrix.
bool match_same_type(const basic &other) const override
Returns true if the attributes of two objects are similar enough for a match.
matrix & set(unsigned ro, unsigned co, const ex &value)
matrix add(const matrix &other) const
Sum of matrices.
matrix pow(const ex &expn) const
Power of a matrix.
ex subs(const exmap &m, unsigned options=0) const override
Substitute a set of objects by arbitrary expressions.
matrix(unsigned r, unsigned c)
Very common ctor.
std::vector< unsigned > markowitz_elimination(unsigned n)
matrix solve(const matrix &vars, const matrix &rhs, unsigned algo=solve_algo::automatic) const
Solve a linear system consisting of a m x n matrix and a m x p right hand side by applying an elimina...
void do_print_python_repr(const print_python_repr &c, unsigned level) const
ex imag_part() const override
void read_archive(const archive_node &n, lst &syms) override
Read (a.k.a.
matrix mul_scalar(const ex &other) const
Product of matrix and scalar expression.
void do_print(const print_context &c, unsigned level) const
void print_elements(const print_context &c, const char *row_start, const char *row_end, const char *row_sep, const char *col_sep) const
size_t nops() const override
nops is defined to be rows x columns.
ex real_part() const override
unsigned rank() const
Compute the rank of this matrix.
ex determinant_minor() const
Recursive determinant for small matrices having at least one symbolic entry.
matrix mul(const matrix &other) const
Product of matrices.
ex evalm() const override
Evaluate sums, products and integer powers of matrices.
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed matrix with something else.
unsigned rows() const
Get number of rows.
ex op(size_t i) const override
returns matrix entry at position (i/col, icol).
int division_free_elimination(const bool det=false)
Perform the steps of division free elimination to bring the m x n matrix into an upper echelon form.
unsigned col
number of columns
ex & let_op(size_t i) override
returns writable matrix entry at position (i/col, icol).
matrix transpose() const
Transposed of an m x n matrix, producing a new n x m matrix object that represents the transposed.
matrix sub(const matrix &other) const
Difference of matrices.
std::vector< unsigned > echelon_form(unsigned algo, int n)
unsigned return_type() const override
ex conjugate() const override
Complex conjugate every matrix entry.
int pivot(unsigned ro, unsigned co, bool symbolic=true)
Partial pivoting method for matrix elimination schemes.
int fraction_free_elimination(const bool det=false)
Perform the steps of Bareiss' one-step fraction free elimination to bring the matrix into an upper ec...
unsigned row
number of rows
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Base class for print_contexts.
Context for latex-parsable output.
Context for python-parsable output.
Switch to control algorithm for linear system solving.
@ automatic
Let the system choose.
Definition of optimizing macros.
Interface to GiNaC's light-weight expression handles.
ex symbolic_matrix(unsigned r, unsigned c, const std::string &base_name, const std::string &tex_base_name)
Create an r times c matrix of newly generated symbols consisting of the given base name plus the nume...
ex sub_matrix(const matrix &m, unsigned r, unsigned nr, unsigned c, unsigned nc)
Return the nr times nc submatrix starting at position r, c of matrix m.
container< std::list > lst
unsigned rank(const matrix &m)
std::map< ex, ex, ex_is_less > exmap
matrix inverse(const matrix &m)
GINAC_DECLARE_UNARCHIVER(add)
ex diag_matrix(const lst &l)
Convert list of diagonal elements to matrix.
matrix transpose(const matrix &m)
unsigned rows(const matrix &m)
ex charpoly(const matrix &m, const ex &lambda)
ex evalf(const ex &thisex)
ex trace(const matrix &m)
ex determinant(const matrix &m, unsigned options=determinant_algo::automatic)
unsigned cols(const matrix &m)
ex lst_to_matrix(const lst &l)
Convert list of lists to matrix.
std::vector< ex > exvector
size_t nops(const ex &thisex)
ex unit_matrix(unsigned r, unsigned c)
Create an r times c unit matrix.
ex reduced_matrix(const matrix &m, unsigned r, unsigned c)
Return the reduced matrix that is formed by deleting the rth row and cth column of matrix m.
ex expand(const ex &thisex, unsigned options=0)
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.