Skip to content
yantsant edited this page Jul 22, 2022 · 14 revisions

Creation Tensor

For example we have basis handler:

auto* basis = new shared_handler_basis<double, 3>(matrix_base<double, 3>(matrix_generator::generate_rand_ort<double, DIM>()));

and some matrix of components:

auto* comp = new matrix_base<double, 3>(MATRIXINITTYPE::INDENT);

so we can compose them to create an object of Tensor:

auto* t = new Tensor<double, DIM>(comp0, basis);

Creation binded Tensors

For example we have basis handler:

auto* basis = new shared_handler_basis<double, 3>(matrix_base<double, 3>(matrix_generator::generate_rand_ort<double, DIM>()));

and some matrix of components:

auto* comp0 = new matrix_base<double, 3>(MATRIXINITTYPE::INDENT);

auto* comp1 = new matrix_base<double, 3>(MATRIXINITTYPE::INDENT);

and related objects of Tensor:

auto* t0 = new Tensor<double, DIM>(comp0, basis);

auto* t1 = new Tensor<double, DIM>(comp1, basis);

These tensors (t0 and t1) will be binded to the one basis basis. If we change basis components through method basis.as_matrix() objects t0 and t1 will be changed.

Creation not linked Tensors

For this purpose we should create different basis handlers (for example from one matrix m):

auto* m = new matrix_base<double, 3>(matrix_generator::generate_rand_ort<double, DIM>());

auto* basis0 = new shared_handler_basis<double, 3>(m);

auto* basis1 = new shared_handler_basis<double, 3>(m);

and some matrix of components:

auto* comp0 = new matrix_base<double, 3>(MATRIXINITTYPE::INDENT);

auto* comp1 = new matrix_base<double, 3>(MATRIXINITTYPE::INDENT);

and related objects of Tensor:

auto* t0 = new Tensor<double, DIM>(comp0, basis);

auto* t1 = new Tensor<double, DIM>(comp1, basis);

These tensors (t0 and t1) will NOT be binded to the one basis. After creation they will have equal basis's components, but they can change in different ways later and there will no any influence on each other.

Clone this wiki locally