10 #include <ginkgo/config.hpp>
11 #include <ginkgo/core/base/multivector.hpp>
18 template <
typename ValueType>
42 template <
typename ConcreteType>
54 template <
template <
typename...>
typename ConcreteType,
typename ValueType,
57 using value_type = ValueType;
59 using absolute_type = ConcreteType<absolute_value_type, Args...>;
60 using real_type = absolute_type;
62 using complex_type = ConcreteType<complex_value_type, Args...>;
78 template <
typename ValueType>
80 using variant_type = std::variant<const matrix::MultiVector<ValueType>*>;
90 template <
typename ValueType>
93 std::variant<const matrix::MultiVector<ValueType>*,
151 template <
typename ConcreteType>
199 std::shared_ptr<const Executor> exec);
210 std::shared_ptr<const Executor> exec,
const dim<2>& global_size,
211 const dim<2>& local_size);
222 std::shared_ptr<const Executor> exec,
const dim<2>& global_size,
230 [[nodiscard]] std::unique_ptr<ConcreteType>
clone(
231 std::shared_ptr<const Executor> exec)
const;
238 [[nodiscard]] std::unique_ptr<ConcreteType>
clone()
const;
261 [[nodiscard]] std::unique_ptr<ConcreteType>
create_default()
const;
270 std::shared_ptr<const Executor> exec)
const;
341 [[nodiscard]] std::unique_ptr<complex_type>
make_complex()
const;
357 [[nodiscard]] std::unique_ptr<real_type>
get_real()
const;
372 [[nodiscard]] std::unique_ptr<real_type>
get_imag()
const;
432 EnableMultiVector(std::shared_ptr<const Executor> exec, dim<2> size,
437 Cloneable* copy_from_impl(
const Cloneable* other)
override;
439 Cloneable* move_from_impl(Cloneable* other)
override;
441 [[nodiscard]] std::unique_ptr<Cloneable> clone_impl(
442 std::shared_ptr<const Executor> exec)
const override;
444 [[nodiscard]] std::unique_ptr<Cloneable> clone_impl()
const override;
446 [[nodiscard]] std::unique_ptr<Cloneable> create_default_impl()
449 [[nodiscard]] std::unique_ptr<Cloneable> create_default_impl(
450 std::shared_ptr<const Executor> exec)
const override;
460 [[nodiscard]]
virtual std::unique_ptr<ConcreteType>
461 create_with_same_config_impl()
const = 0;
463 [[nodiscard]]
virtual std::unique_ptr<ConcreteType>
464 create_with_type_of_impl(std::shared_ptr<const Executor> exec,
465 const dim<2>& global_size,
466 const dim<2>& local_size,
469 [[nodiscard]]
virtual std::unique_ptr<ConcreteType> create_subview_impl(
470 local_span rows, local_span columns) = 0;
472 [[nodiscard]]
virtual std::unique_ptr<const ConcreteType>
473 create_subview_impl(local_span rows, local_span columns)
const = 0;
475 [[nodiscard]]
virtual std::unique_ptr<ConcreteType> create_subview_impl(
476 local_span rows, local_span columns, dim<2> global_size) = 0;
478 [[nodiscard]]
virtual std::unique_ptr<const ConcreteType>
479 create_subview_impl(local_span rows, local_span columns,
480 dim<2> global_size)
const = 0;
482 [[nodiscard]]
virtual std::unique_ptr<const real_type>
483 create_real_view_impl()
const = 0;
485 [[nodiscard]]
virtual std::unique_ptr<real_type>
486 create_real_view_impl() = 0;
488 [[nodiscard]]
virtual std::unique_ptr<absolute_type> compute_absolute_impl()
491 virtual void compute_absolute_impl(
absolute_type* result)
const = 0;
493 [[nodiscard]]
virtual std::unique_ptr<complex_type> make_complex_impl()
496 [[nodiscard]]
virtual std::unique_ptr<real_type> get_real_impl()
const = 0;
498 [[nodiscard]]
virtual std::unique_ptr<real_type> get_imag_impl()
const = 0;
500 virtual void make_complex_impl(
complex_type* result)
const = 0;
502 virtual void get_real_impl(
real_type* result)
const = 0;
504 virtual void get_imag_impl(
real_type* result)
const = 0;
508 virtual void scale_impl(scaling_param<value_type> alpha) = 0;
510 virtual void inv_scale_impl(scaling_param<value_type> alpha) = 0;
512 virtual void add_scaled_impl(scaling_param<value_type> alpha,
513 const ConcreteType* b) = 0;
515 virtual void sub_scaled_impl(scaling_param<value_type> alpha,
516 const ConcreteType* b) = 0;
518 virtual void compute_dot_impl(
const ConcreteType* b,
519 matrix::MultiVector<value_type>* result,
520 array<char>& tmp)
const = 0;
522 virtual void compute_conj_dot_impl(
const ConcreteType* b,
523 matrix::MultiVector<value_type>* result,
524 array<char>& tmp)
const = 0;
526 virtual void compute_norm2_impl(
norm_type* result,
527 array<char>& tmp)
const = 0;
529 virtual void compute_squared_norm2_impl(
norm_type* result,
530 array<char>& tmp)
const = 0;
532 virtual void compute_norm1_impl(
norm_type* result,
533 array<char>& tmp)
const = 0;
535 [[nodiscard]] temporary_conversion<AbstractMultiVector> as_precision_impl(
538 [[nodiscard]] temporary_conversion<const AbstractMultiVector>
539 as_precision_impl(
precision p)
const override;
541 virtual AbstractMultiVector::device_view<value_type>
542 get_local_device_view_impl() = 0;
544 virtual AbstractMultiVector::device_view<const value_type>
545 get_const_local_device_view_impl()
const = 0;
547 [[nodiscard]] std::variant<
548 #if GINKGO_ENABLE_HALF
549 AbstractMultiVector::device_view<half>,
550 AbstractMultiVector::device_view<std::complex<half>>,
552 #if GINKGO_ENABLE_BFLOAT16
553 AbstractMultiVector::device_view<bfloat16>,
554 AbstractMultiVector::device_view<std::complex<bfloat16>>,
556 AbstractMultiVector::device_view<float>,
557 AbstractMultiVector::device_view<std::complex<float>>,
558 AbstractMultiVector::device_view<double>,
559 AbstractMultiVector::device_view<std::complex<double>>>
560 get_local_device_view_generic_impl()
override;
562 [[nodiscard]] std::variant<
563 #if GINKGO_ENABLE_HALF
564 AbstractMultiVector::device_view<const half>,
565 AbstractMultiVector::device_view<const std::complex<half>>,
567 #if GINKGO_ENABLE_BFLOAT16
568 AbstractMultiVector::device_view<const bfloat16>,
569 AbstractMultiVector::device_view<const std::complex<bfloat16>>,
571 AbstractMultiVector::device_view<const float>,
572 AbstractMultiVector::device_view<const std::complex<float>>,
573 AbstractMultiVector::device_view<const double>,
574 AbstractMultiVector::device_view<const std::complex<double>>>
575 get_const_local_device_view_generic_impl()
const override;
577 GKO_ENABLE_SELF(ConcreteType);
588 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
589 create_generic_with_same_config_impl() const final;
591 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
592 create_generic_with_type_of_impl(std::shared_ptr<const Executor> exec,
593 const dim<2>& global_size,
594 const dim<2>& local_size,
597 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
598 create_subview_generic_impl(local_span rows, local_span columns) final;
600 [[nodiscard]] std::unique_ptr<const AbstractMultiVector>
601 create_subview_generic_impl(local_span rows,
602 local_span columns) const final;
604 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
605 create_subview_generic_impl(local_span rows, local_span columns,
606 dim<2> global_size) final;
608 [[nodiscard]] std::unique_ptr<const AbstractMultiVector>
609 create_subview_generic_impl(local_span rows, local_span columns,
610 dim<2> global_size) const final;
612 [[nodiscard]] std::unique_ptr<const AbstractMultiVector>
613 create_real_view_generic_impl() const final;
615 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
616 create_real_view_generic_impl() final;
618 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
619 compute_absolute_generic_impl() const final;
621 void compute_absolute_generic_impl(AbstractMultiVector* result) const final;
623 [[nodiscard]] std::unique_ptr<AbstractMultiVector>
624 make_complex_generic_impl() const final;
626 void make_complex_generic_impl(AbstractMultiVector* result) const final;
628 [[nodiscard]] std::unique_ptr<AbstractMultiVector> get_real_generic_impl()
631 void get_real_generic_impl(AbstractMultiVector* result) const final;
633 [[nodiscard]] std::unique_ptr<AbstractMultiVector> get_imag_generic_impl()
636 void get_imag_generic_impl(AbstractMultiVector* result) const final;
638 void fill_impl(any_scalar value) final;
640 void scale_impl(const AbstractMultiVector* alpha) final;
642 void inv_scale_impl(const AbstractMultiVector* alpha) final;
644 void add_scaled_impl(const AbstractMultiVector* alpha,
645 const AbstractMultiVector* b) final;
647 void sub_scaled_impl(const AbstractMultiVector* alpha,
648 const AbstractMultiVector* b) final;
650 void compute_dot_impl(const AbstractMultiVector* b,
651 AbstractMultiVector* result,
652 array<
char>& tmp) const final;
654 void compute_conj_dot_impl(const AbstractMultiVector* b,
655 AbstractMultiVector* result,
656 array<
char>& tmp) const final;
658 void compute_norm2_impl(AbstractMultiVector* result,
659 array<
char>& tmp) const final;
661 void compute_squared_norm2_impl(AbstractMultiVector* result,
662 array<
char>& tmp) const final;
664 void compute_norm1_impl(AbstractMultiVector* result,
665 array<
char>& tmp) const final;
669 template <typename ConcreteType>
670 std::unique_ptr<ConcreteType>
674 return static_cast<const EnableMultiVector*>(other.get())
675 ->create_with_same_config_impl();
679 template <
typename ConcreteType>
680 std::unique_ptr<ConcreteType>
684 return static_cast<const EnableMultiVector*>(other.
get())
685 ->create_with_type_of_impl(std::move(exec), {}, {}, 0);
689 template <
typename ConcreteType>
690 std::unique_ptr<ConcreteType>
695 GKO_ASSERT_EQUAL_COLS(global_size, local_size);
696 return static_cast<const EnableMultiVector*>(other.
get())
697 ->create_with_type_of_impl(std::move(exec), global_size, local_size,
702 template <
typename ConcreteType>
703 std::unique_ptr<ConcreteType>
708 return static_cast<const EnableMultiVector*>(other.
get())
709 ->create_with_type_of_impl(std::move(exec), global_size, local_size,
714 template <
typename ConcreteType>
716 std::shared_ptr<const Executor> exec)
const
718 return as<ConcreteType>(this->clone_impl(std::move(exec)));
722 template <
typename ConcreteType>
725 return as<ConcreteType>(this->clone_impl());
729 template <
typename ConcreteType>
733 return as<ConcreteType>(this->copy_from_impl(other.
get()));
737 template <
typename ConcreteType>
741 return as<ConcreteType>(this->move_from_impl(other.
get()));
745 template <
typename ConcreteType>
749 return as<ConcreteType>(this->create_default_impl());
752 template <
typename ConcreteType>
754 std::shared_ptr<const Executor> exec)
const
756 return as<ConcreteType>(this->create_default_impl(std::move(exec)));
760 template <
typename ConcreteType>
764 return this->create_subview_impl(rows, columns);
768 template <
typename ConcreteType>
769 std::unique_ptr<const ConcreteType>
773 return this->create_subview_impl(rows, columns);
777 template <
typename ConcreteType>
781 return this->create_subview_impl(rows, columns, global_size);
785 template <
typename ConcreteType>
786 std::unique_ptr<const ConcreteType>
791 return this->create_subview_impl(rows, columns, global_size);
795 template <
typename ConcreteType>
796 std::unique_ptr<const typename EnableMultiVector<ConcreteType>::real_type>
799 return this->create_real_view_impl();
803 template <
typename ConcreteType>
804 std::unique_ptr<typename EnableMultiVector<ConcreteType>::real_type>
807 return this->create_real_view_impl();
811 template <
typename ConcreteType>
812 std::unique_ptr<typename EnableMultiVector<ConcreteType>::absolute_type>
815 return this->compute_absolute_impl();
819 template <
typename ConcreteType>
823 GKO_ASSERT_EQUAL_DIMENSIONS(
this, output);
825 this->compute_absolute_impl(
830 template <
typename ConcreteType>
831 std::unique_ptr<typename EnableMultiVector<ConcreteType>::complex_type>
834 return this->make_complex_impl();
837 template <
typename ConcreteType>
841 GKO_ASSERT_EQUAL_DIMENSIONS(
this, output);
843 this->make_complex_impl(
848 template <
typename ConcreteType>
849 std::unique_ptr<typename EnableMultiVector<ConcreteType>::real_type>
852 return this->get_real_impl();
856 template <
typename ConcreteType>
860 GKO_ASSERT_EQUAL_DIMENSIONS(
this, output);
866 template <
typename ConcreteType>
867 std::unique_ptr<typename EnableMultiVector<ConcreteType>::real_type>
870 return this->get_imag_impl();
874 template <
typename ConcreteType>
878 GKO_ASSERT_EQUAL_DIMENSIONS(
this, output);
884 template <
typename ConcreteType>
891 template <
typename ConcreteType>
894 *result = std::move(*
self());
898 template <
typename ConcreteType>
902 return this->get_local_device_view_impl();
906 template <
typename ConcreteType>
910 return this->get_const_local_device_view_impl();
914 template <
typename ConcreteType>
918 self()->
template log<log::Logger::polymorphic_object_copy_started>(
919 self()->get_executor().get(),
920 dynamic_cast<const PolymorphicObject*>(other),
921 dynamic_cast<const PolymorphicObject*>(
this));
922 as<ConvertibleTo<ConcreteType>>(other)->
convert_to(
self());
923 self()->
template log<log::Logger::polymorphic_object_copy_completed>(
924 self()->get_executor().get(),
925 dynamic_cast<const PolymorphicObject*>(other),
926 dynamic_cast<const PolymorphicObject*>(
this));
931 template <
typename ConcreteType>
932 Cloneable* EnableMultiVector<ConcreteType>::move_from_impl(Cloneable* other)
934 self()->
template log<log::Logger::polymorphic_object_move_started>(
935 self()->get_executor().get(),
936 dynamic_cast<const PolymorphicObject*>(other),
937 dynamic_cast<const PolymorphicObject*>(
this));
938 as<ConvertibleTo<ConcreteType>>(other)->
move_to(
self());
939 self()->
template log<log::Logger::polymorphic_object_move_completed>(
940 self()->get_executor().get(),
941 dynamic_cast<const PolymorphicObject*>(other),
942 dynamic_cast<const PolymorphicObject*>(
this));
947 template <
typename ConcreteType>
948 std::unique_ptr<Cloneable> EnableMultiVector<ConcreteType>::clone_impl(
949 std::shared_ptr<const Executor> exec)
const
951 auto result = this->create_default_impl(exec);
952 result->copy_from(
this);
957 template <
typename ConcreteType>
958 std::unique_ptr<Cloneable> EnableMultiVector<ConcreteType>::clone_impl()
const
960 auto result = this->create_default_impl();
961 result->copy_from(
this);
966 template <
typename ConcreteType>
967 std::unique_ptr<Cloneable>
968 EnableMultiVector<ConcreteType>::create_default_impl()
const
970 return this->create_with_type_of_impl(this->
get_executor(), {}, {}, 0);
974 template <
typename ConcreteType>
975 std::unique_ptr<Cloneable> EnableMultiVector<ConcreteType>::create_default_impl(
976 std::shared_ptr<const Executor> exec)
const
978 return this->create_with_type_of_impl(exec, {}, {}, 0);
982 template <
typename ConcreteType>
983 std::unique_ptr<AbstractMultiVector>
984 EnableMultiVector<ConcreteType>::create_generic_with_same_config_impl()
const
986 return this->create_with_same_config_impl();
990 template <
typename ConcreteType>
991 std::unique_ptr<AbstractMultiVector>
992 EnableMultiVector<ConcreteType>::create_generic_with_type_of_impl(
993 std::shared_ptr<const Executor> exec,
const dim<2>& global_size,
994 const dim<2>& local_size,
size_type stride)
const
996 return this->create_with_type_of_impl(std::move(exec), global_size,
1001 template <
typename ConcreteType>
1002 std::unique_ptr<AbstractMultiVector>
1003 EnableMultiVector<ConcreteType>::create_subview_generic_impl(local_span rows,
1006 return this->create_subview_impl(rows, columns);
1010 template <
typename ConcreteType>
1011 std::unique_ptr<const AbstractMultiVector>
1012 EnableMultiVector<ConcreteType>::create_subview_generic_impl(
1013 local_span rows, local_span columns)
const
1015 return this->create_subview_impl(rows, columns);
1019 template <
typename ConcreteType>
1020 std::unique_ptr<AbstractMultiVector>
1021 EnableMultiVector<ConcreteType>::create_subview_generic_impl(local_span rows,
1025 return this->create_subview_impl(rows, columns, global_size);
1029 template <
typename ConcreteType>
1030 std::unique_ptr<const AbstractMultiVector>
1031 EnableMultiVector<ConcreteType>::create_subview_generic_impl(
1032 local_span rows, local_span columns, dim<2> global_size)
const
1034 return this->create_subview_impl(rows, columns, global_size);
1038 template <
typename ConcreteType>
1039 std::unique_ptr<const AbstractMultiVector>
1040 EnableMultiVector<ConcreteType>::create_real_view_generic_impl()
const
1042 return this->create_real_view_impl();
1046 template <
typename ConcreteType>
1047 std::unique_ptr<AbstractMultiVector>
1048 EnableMultiVector<ConcreteType>::create_real_view_generic_impl()
1050 return this->create_real_view_impl();
1054 template <
typename ConcreteType>
1055 std::unique_ptr<AbstractMultiVector>
1056 EnableMultiVector<ConcreteType>::compute_absolute_generic_impl()
const
1058 return this->compute_absolute_impl();
1062 template <
typename ConcreteType>
1063 void EnableMultiVector<ConcreteType>::compute_absolute_generic_impl(
1064 AbstractMultiVector* result)
const
1066 this->compute_absolute_impl(as<absolute_type>(result));
1069 template <
typename ConcreteType>
1070 std::unique_ptr<AbstractMultiVector>
1071 EnableMultiVector<ConcreteType>::make_complex_generic_impl()
const
1073 return this->make_complex_impl();
1077 template <
typename ConcreteType>
1078 void EnableMultiVector<ConcreteType>::make_complex_generic_impl(
1079 AbstractMultiVector* result)
const
1081 this->make_complex_impl(as<complex_type>(result));
1085 template <
typename ConcreteType>
1086 std::unique_ptr<AbstractMultiVector>
1087 EnableMultiVector<ConcreteType>::get_real_generic_impl()
const
1089 return this->get_real_impl();
1093 template <
typename ConcreteType>
1094 void EnableMultiVector<ConcreteType>::get_real_generic_impl(
1095 AbstractMultiVector* result)
const
1097 this->get_real_impl(as<absolute_type>(result));
1101 template <
typename ConcreteType>
1102 std::unique_ptr<AbstractMultiVector>
1103 EnableMultiVector<ConcreteType>::get_imag_generic_impl()
const
1105 return this->get_imag_impl();
1109 template <
typename ConcreteType>
1110 void EnableMultiVector<ConcreteType>::get_imag_generic_impl(
1111 AbstractMultiVector* result)
const
1113 this->get_imag_impl(as<absolute_type>(result));
1117 template <
typename ConcreteType>
1118 void EnableMultiVector<ConcreteType>::fill_impl(any_scalar value)
1121 [
this](
auto value_v) {
1122 using snd_value_type = std::decay_t<decltype(value_v)>;
1123 if constexpr (std::is_constructible_v<value_type, snd_value_type>) {
1124 this->fill_impl(static_cast<value_type>(value_v));
1126 GKO_NOT_IMPLEMENTED;
1143 template <
typename ValueType,
typename AlphaValueType>
1144 struct scaling_factor_target {
1145 using type = std::conditional_t<is_complex<ValueType>() &&
1146 !is_complex<AlphaValueType>(),
1147 remove_complex<ValueType>, ValueType>;
1150 template <
typename ValueType,
typename AlphaValueType>
1151 using scaling_factor_target_type =
1152 typename scaling_factor_target<ValueType, AlphaValueType>::type;
1158 template <
typename ConcreteType>
1159 void EnableMultiVector<ConcreteType>::scale_impl(
1160 const AbstractMultiVector* alpha)
1163 [
this, alpha](
auto p) {
1164 using alpha_value_type = std::decay_t<decltype(p)>;
1165 if constexpr (is_complex<alpha_value_type>() &&
1166 !is_complex<value_type>()) {
1168 GKO_NOT_IMPLEMENTED;
1170 auto alpha_v = as<matrix::MultiVector<alpha_value_type>>(alpha);
1171 this->scale_impl(scaling_param<value_type>{
1174 detail::scaling_factor_target_type<
1183 template <
typename ConcreteType>
1184 void EnableMultiVector<ConcreteType>::inv_scale_impl(
1185 const AbstractMultiVector* alpha)
1188 [
this, alpha](
auto p) {
1189 using alpha_value_type = std::decay_t<decltype(p)>;
1190 if constexpr (is_complex<alpha_value_type>() &&
1191 !is_complex<value_type>()) {
1193 GKO_NOT_IMPLEMENTED;
1195 auto alpha_v = as<matrix::MultiVector<alpha_value_type>>(alpha);
1196 this->inv_scale_impl(scaling_param<value_type>{
1199 detail::scaling_factor_target_type<
1207 template <
typename ConcreteType>
1208 void EnableMultiVector<ConcreteType>::add_scaled_impl(
1209 const AbstractMultiVector* alpha,
const AbstractMultiVector* b)
1212 [
this, alpha, b](
auto p) {
1213 using alpha_value_type = std::decay_t<decltype(p)>;
1214 if constexpr (is_complex<alpha_value_type>() &&
1215 !is_complex<value_type>()) {
1217 GKO_NOT_IMPLEMENTED;
1219 auto alpha_v = as<matrix::MultiVector<alpha_value_type>>(alpha);
1220 this->add_scaled_impl(
1221 scaling_param<value_type>{
1224 detail::scaling_factor_target_type<
1227 as<const ConcreteType>(
1228 b->as_precision(this->get_precision()).get()));
1235 template <
typename ConcreteType>
1236 void EnableMultiVector<ConcreteType>::sub_scaled_impl(
1237 const AbstractMultiVector* alpha,
const AbstractMultiVector* b)
1240 [
this, alpha, b](
auto p) {
1241 using alpha_value_type = std::decay_t<decltype(p)>;
1242 if constexpr (is_complex<alpha_value_type>() &&
1243 !is_complex<value_type>()) {
1245 GKO_NOT_IMPLEMENTED;
1247 auto alpha_v = as<matrix::MultiVector<alpha_value_type>>(alpha);
1248 this->sub_scaled_impl(
1249 scaling_param<value_type>{
1252 detail::scaling_factor_target_type<
1255 as<const ConcreteType>(
1256 b->as_precision(this->get_precision()).get()));
1263 template <
typename ConcreteType>
1264 void EnableMultiVector<ConcreteType>::compute_dot_impl(
1265 const AbstractMultiVector* b, AbstractMultiVector* result,
1266 array<char>& tmp)
const
1268 this->compute_dot_impl(
1269 as<const ConcreteType>(b->as_precision(this->get_precision()).get()),
1270 as<matrix::MultiVector<value_type>>(
1271 result->as_precision(this->get_precision()).get()),
1276 template <
typename ConcreteType>
1277 void EnableMultiVector<ConcreteType>::compute_conj_dot_impl(
1278 const AbstractMultiVector* b, AbstractMultiVector* result,
1279 array<char>& tmp)
const
1281 this->compute_conj_dot_impl(
1282 as<const ConcreteType>(b->as_precision(this->get_precision()).get()),
1283 as<matrix::MultiVector<value_type>>(
1284 result->as_precision(this->get_precision()).get()),
1289 template <
typename ConcreteType>
1290 void EnableMultiVector<ConcreteType>::compute_norm2_impl(
1291 AbstractMultiVector* result, array<char>& tmp)
const
1293 this->compute_norm2_impl(
1300 template <
typename ConcreteType>
1301 void EnableMultiVector<ConcreteType>::compute_squared_norm2_impl(
1302 AbstractMultiVector* result, array<char>& tmp)
const
1304 this->compute_squared_norm2_impl(
1311 template <
typename ConcreteType>
1312 void EnableMultiVector<ConcreteType>::compute_norm1_impl(
1313 AbstractMultiVector* result, array<char>& tmp)
const
1315 this->compute_norm1_impl(
1322 template <
typename ConcreteType>
1323 temporary_conversion<AbstractMultiVector>
1324 EnableMultiVector<ConcreteType>::as_precision_impl(
precision p)
1327 [
this](
auto v) -> temporary_conversion<AbstractMultiVector> {
1328 using target_value_type = std::decay_t<decltype(v)>;
1329 if constexpr (is_complex<value_type>() ==
1330 is_complex<target_value_type>()) {
1333 self()->
template as_precision<target_value_type>());
1335 GKO_NOT_IMPLEMENTED;
1342 template <
typename ConcreteType>
1343 temporary_conversion<const AbstractMultiVector>
1344 EnableMultiVector<ConcreteType>::as_precision_impl(
precision p)
const
1347 [
this](
auto v) -> temporary_conversion<const AbstractMultiVector> {
1348 using target_value_type = std::decay_t<decltype(v)>;
1349 if constexpr (is_complex<value_type>() ==
1350 is_complex<target_value_type>()) {
1353 self()->
template as_precision<target_value_type>());
1355 GKO_NOT_IMPLEMENTED;
1362 template <
typename ConcreteType>
1364 #if GINKGO_ENABLE_HALF
1365 AbstractMultiVector::device_view<half>,
1366 AbstractMultiVector::device_view<std::complex<half>>,
1368 #if GINKGO_ENABLE_BFLOAT16
1369 AbstractMultiVector::device_view<bfloat16>,
1370 AbstractMultiVector::device_view<std::complex<bfloat16>>,
1372 AbstractMultiVector::device_view<float>,
1373 AbstractMultiVector::device_view<std::complex<float>>,
1374 AbstractMultiVector::device_view<double>,
1375 AbstractMultiVector::device_view<std::complex<double>>>
1376 EnableMultiVector<ConcreteType>::get_local_device_view_generic_impl()
1378 return this->get_local_device_view_impl();
1382 template <
typename ConcreteType>
1384 #if GINKGO_ENABLE_HALF
1385 AbstractMultiVector::device_view<const half>,
1386 AbstractMultiVector::device_view<const std::complex<half>>,
1388 #if GINKGO_ENABLE_BFLOAT16
1389 AbstractMultiVector::device_view<const bfloat16>,
1390 AbstractMultiVector::device_view<const std::complex<bfloat16>>,
1392 AbstractMultiVector::device_view<const float>,
1393 AbstractMultiVector::device_view<const std::complex<float>>,
1394 AbstractMultiVector::device_view<const double>,
1395 AbstractMultiVector::device_view<const std::complex<double>>>
1396 EnableMultiVector<ConcreteType>::get_const_local_device_view_generic_impl()
1399 return this->get_const_local_device_view_impl();