21 #ifndef VECTOR_H_INCLUDED 22 #define VECTOR_H_INCLUDED 38 csl::vector_expr argument;
40 std::vector<int> shape;
48 std::string
const &
getName()
const override;
50 void print(
int mode=0,
51 std::ostream& out=std::cout,
52 bool lib =
false)
const override;
56 std::ostream &out = std::cout
59 std::string
printLaTeX(
int mode=0)
const override;
61 std::vector<Parent> getSubSymbols()
const override;
64 csl::eval::mode user_mode = csl::eval::base
67 unique_Expr copy_unique()
const override;
69 Expr deepCopy()
const override;
71 Expr refresh()
const override;
73 Expr deepRefresh()
const override;
75 int getDim()
const override {
return dim;}
81 int getNArgs(
int axis=0)
const override;
83 size_t size()
const override;
85 csl::vector_expr::iterator
begin()
override;
86 csl::vector_expr::const_iterator
begin()
const override 88 return argument.begin();
91 csl::vector_expr::iterator
end()
override;
92 csl::vector_expr::const_iterator
end()
const override 94 return argument.end();
97 bool isReal()
const override;
99 bool isPurelyImaginary()
const override;
115 Expr const &
getArgument(
const std::vector<int>& indices)
const override;
129 std::vector<int>
getShape()
const override;
136 const std::vector<int>& indices)
override;
142 bool exactMatchShape(
Expr_info expr)
const;
151 const std::vector<std::vector<int>>& keepIndices)
const override;
154 std::vector<std::vector<int>>::const_iterator begin,
155 std::vector<std::vector<int>>::const_iterator end)
const override;
167 Expr trace(
int axis1,
int axis2)
const override;
173 std::optional<Expr>
expand(
bool full =
false,
174 bool inplace =
false)
const override;
177 std::function<
bool(
Expr const&)>
const& f,
179 bool inplace =
false)
const override;
181 std::optional<Expr>
factor(
bool full =
false)
const override;
184 bool full =
false)
const override;
199 explicit Vector(
int t_nElements);
201 Vector(
int t_nElements,
const Expr& expr,
const Expr& index=CSL_0);
203 explicit Vector(
const csl::vector_expr& t_argument);
212 void setElementary(
bool t_elementary)
override;
217 Expr vector_s(
int t_nElements);
219 Expr vector_s(
int t_nElements,
const Expr& expr);
221 Expr vector_s(
int t_nElements,
const Expr& expr,
const Expr& index);
223 Expr vector_s(
const csl::vector_expr& t_argument);
225 Expr vector_s(
const std::initializer_list<Expr>& t_argument);
233 explicit Matrix(
int t_nArgs);
235 Matrix(
int t_x_nArgs,
int t_y_nArgs);
237 Matrix(
int t_x_nArgs,
int t_y_nArgs,
239 const Expr& index_x=CSL_0,
const Expr& index_y=CSL_0);
241 explicit Matrix(
const csl::vector_expr& t_argument);
243 explicit Matrix(
const std::vector<csl::vector_expr>& t_argument);
258 Expr transposedCoMatrix()
const;
260 Expr hermitian()
const override;
274 Expr matrix_s(
int t_nArgs);
276 Expr matrix_s(
int t_x_nArgs,
int t_y_nArgs);
278 Expr matrix_s(
int t_x_nArgs,
int t_y_nArgs,
280 const Expr& index_x,
const Expr& index_y);
282 Expr matrix_s(
int t_x_nArgs,
int t_y_nArgs,
285 Expr matrix_s(
const csl::vector_expr& t_argument);
287 Expr matrix_s(
const std::initializer_list<std::initializer_list<Expr> >&
290 Expr diagonal_s(
const csl::vector_expr& diag);
292 Expr identity_s(
int dim);
300 explicit HighDTensor(
const std::vector<int>& shape);
302 explicit HighDTensor(
const std::vector<int>& shape,
305 explicit HighDTensor(
const csl::vector_expr& t_argument);
314 Expr highdtensor_s(
const std::vector<int>& shape);
316 Expr highdtensor_s(
const std::vector<int>& shape,
const Expr& filler);
318 Expr highdtensor_s(
const std::initializer_list<std::initializer_list<
319 std::initializer_list<Expr> > >& t_tensor);
321 Expr highdtensor_from_args_s(
const std::vector<Expr>& args);
323 Expr vectorialtensor_s(
const std::vector<int>& shape);
325 Expr vectorialtensor_s(
const std::vector<int>& shape,
const Expr& filler);
Expr getSubVectorial(const std::vector< int > &exceptions) const override
Allows to pick a part of a Vectorial expression, excluding the iExcept^{th} element.
Expr const & getArgument(int iArg=0) const override
Definition: vector.cpp:336
Expr symmetrise() const override
Calculates and returns the symmetrization of a 2D matrix.
Definition: vector.cpp:881
virtual bool operator<(Expr_info expr) const =0
Compares the simplicity of the expression to another.
std::optional< Expr > expand(bool full=false, bool inplace=false) const override
Develops the Abstract.
Definition: vector.cpp:950
Namespace for csl library.
Definition: abreviation.h:34
Expr dot(const Expr &expr) const override
Returns the dot product of two Vectorial expressions.
Definition: vector.cpp:627
bool matchShape(Expr_info expr, bool exact=false) const override
In the case of a vectorial-type expression, this function checks if the shape of expr matches itself...
Definition: vector.cpp:487
csl::vector_expr::iterator end() override
Definition: vector.cpp:282
std::optional< Expr > getComplexModulus() const override
Evaluates the modulus in the complex plane of the Abstract and returns it.
Definition: vector.cpp:327
virtual Expr inverseMatrix() const
Calculates and returns the inverse of a 2D square matrix. The applied method is: A^{-1} = 1/det(A)*Co...
Definition: abstract.cpp:1194
Expr tensordot(const Expr &expr) const override
Returns the tensordot of two Vectorial expressions.
Definition: vector.cpp:776
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
virtual Expr transpose() const
Calculates and returns the transpose of a 2D matrix.
Definition: abstract.cpp:1166
bool dependsExplicitlyOn(Expr_info expr) const override
Check recursively if expr is present in the expression.
Definition: vector.cpp:397
std::optional< Expr > expand_if(std::function< bool(Expr const &)> const &f, bool full=false, bool inplace=false) const override
Develops the Abstract.
Definition: vector.cpp:961
std::string const & getName() const override
Returns the Abstract's name.
Definition: vector.cpp:44
virtual Expr trace() const
Definition: abstract.cpp:1152
bool operator==(Expr_info expr) const override
Compares the Abstract with another.
Definition: vector.cpp:995
Expr getProduct() const override
Calculates and returns the product of all elements in the Vectorial object.
Definition: vector.cpp:529
csl::Type getType() const override
Gives the type of Abstract.
Definition: vector.h:309
Expr getVectorialModulus() const override
Returns the Vectorial modulus of the Vectorial object, that is defined here as the squared root of th...
Definition: vector.cpp:610
std::optional< Expr > factor(bool full=false) const override
Factors the Abstract.
Definition: vector.cpp:974
Expr getImaginaryPart() const override
Evaluates the imaginary part of the Abstract and returns it.
Definition: vector.cpp:319
ComplexProperty
Contains all possible complex properties of objects. Real, purely imaginary, or complex.
Definition: enum.h:127
Expr & operator[](int iArg) override
Access operator for multi-argument expressions, returns a reference so this function is not const...
Definition: vector.cpp:1018
csl::Type getType() const override
Gives the type of Abstract.
Definition: vector.h:207
PrimaryType
Stores enumerations of types for Abstract objects.
Definition: enum.h:31
csl::PrimaryType getPrimaryType() const override
Gives the primary type of Abstract.
Definition: vector.h:77
csl::Type getType() const override
Gives the type of Abstract.
Definition: vector.h:247
std::optional< Expr > evaluate(csl::eval::mode user_mode=csl::eval::base) const override
Evaluates the Abstract.
Definition: vector.cpp:157
int getNArgs(int axis=0) const override
Returns the number of arguments of the expression. If the expression is a building block (AbstractBui...
Definition: vector.cpp:258
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
std::optional< Expr > getRealPart() const override
Evaluates the real part of the Abstract and returns it.
Definition: vector.cpp:311
Expr getSum() const override
Calculates and returns the sum of all elements in the Vectorial object.
Definition: vector.cpp:516
const csl::vector_expr & getVectorArgument() const override
Allows to get the entire std::vector of arguments of the expression.
Definition: vector.cpp:431
Expr multiplication_own(const Expr &expr, bool side=1) const override
Contains implementation of special multiplication for Numerical- and Vectorial-types.
Definition: vector.cpp:708
Base class for all parents (indicial, fields etc). All parents derive from this class.
Definition: parent.h:81
Expr addition_own(const Expr &expr) const override
Contains implementation of special addition for Numerical- and Vectorial-types.
Definition: vector.cpp:672
std::string printLaTeX(int mode=0) const override
Creates a LaTeX output for the Abstract.
Definition: vector.cpp:85
virtual Expr determinant() const
Returns the determinant of the object if it corresponds to a square matrix (or a scalar), 0 else.
Definition: abstract.cpp:1145
void print(int mode=0, std::ostream &out=std::cout, bool lib=false) const override
Displays the abstract in standard output.
Definition: vector.cpp:49
Base classes for all exprs in the program.
int getDim() const override
Gives the dimension of the object.
Definition: vector.h:75
void setArgument(const Expr &expr, int iArg=0) override
Sets the argument at position iArg (default=0).
Definition: vector.cpp:447
csl::vector_expr::iterator begin() override
Definition: vector.cpp:277
void setVectorArgument(const csl::vector_expr &t_argument) override
Replaced the entire std::vector of argument.
Definition: vector.cpp:455
Expr antisymmetrise() const override
Calculates and returns the anti-symmetrization of a 2D matrix.
Definition: vector.cpp:923
bool commutesWith(Expr_info expr, int sign=-1) const override
Tells if the object commutes with expr.
Definition: vector.cpp:423
std::vector< int > getShape() const override
Accessor to the shape of the tensor in the form of a std::vector of integers.
Definition: vector.cpp:436
csl::vector_expr::const_iterator end() const override
Definition: vector.h:92
std::optional< Expr > getComplexConjugate() const override
Calculates and returns the complex conjugate of the expression.
Definition: vector.cpp:303
bool dependsOn(Expr_info expr) const override
Check recursively if the expression depends on expr.
Definition: vector.cpp:385
csl::vector_expr::const_iterator begin() const override
Definition: vector.h:86
Expression type/.
Definition: abstract.h:1573