@@ -9,27 +9,66 @@ template class const_nums<std::complex<float>>;
99
1010// Specialize templates to support double types
1111template <>
12- const_nums<double >::const_nums() : zero( 0.0 ), one( 1.0 ), neg_one(- 1.0 )
12+ const_nums<double >::const_nums()
1313{
14+ base_device::memory::resize_memory_op<double , base_device::DEVICE_CPU>()(
15+ this ->cpu_ctx , this ->zero , 1 );
16+ base_device::memory::set_memory_op<double , base_device::DEVICE_CPU>()(
17+ this ->cpu_ctx , this ->zero , 0.0 , 1 );
18+ base_device::memory::resize_memory_op<double , base_device::DEVICE_CPU>()(
19+ this ->cpu_ctx , this ->one , 1 );
20+ base_device::memory::set_memory_op<double , base_device::DEVICE_CPU>()(
21+ this ->cpu_ctx , this ->one , 1.0 , 1 );
22+ base_device::memory::resize_memory_op<double , base_device::DEVICE_CPU>()(
23+ this ->cpu_ctx , this ->neg_one , 1 );
24+ base_device::memory::set_memory_op<double , base_device::DEVICE_CPU>()(
25+ this ->cpu_ctx , this ->neg_one , -1.0 , 1 );
1426}
1527
1628// Specialize templates to support double types
1729template <>
18- const_nums<float >::const_nums() : zero( 0.0 ), one( 1.0 ), neg_one(- 1.0 )
30+ const_nums<float >::const_nums()
1931{
32+ base_device::memory::resize_memory_op<float , base_device::DEVICE_CPU>()(
33+ this ->cpu_ctx , this ->zero , 1 );
34+ base_device::memory::set_memory_op<float , base_device::DEVICE_CPU>()(
35+ this ->cpu_ctx , this ->zero , 0.0 , 1 );
36+ base_device::memory::resize_memory_op<float , base_device::DEVICE_CPU>()(
37+ this ->cpu_ctx , this ->one , 1 );
38+ base_device::memory::set_memory_op<float , base_device::DEVICE_CPU>()(
39+ this ->cpu_ctx , this ->one , 1.0 , 1 );
40+ base_device::memory::resize_memory_op<float , base_device::DEVICE_CPU>()(
41+ this ->cpu_ctx , this ->neg_one , 1 );
42+ base_device::memory::set_memory_op<float , base_device::DEVICE_CPU>()(
43+ this ->cpu_ctx , this ->neg_one , -1.0 , 1 );
2044}
2145
2246// Specialized templates to support std:: complex<double>types
2347template <>
2448const_nums<std::complex <double >>::const_nums()
25- : zero(std::complex <double >(0.0 , 0.0 )), one(std::complex <double >(1.0 , 0.0 )),
26- neg_one (std::complex <double >(-1.0 , 0.0 ))
2749{
50+ base_device::memory::resize_memory_op<std::complex <double >, base_device::DEVICE_CPU>()(
51+ this ->cpu_ctx , this ->zero , 1 );
52+ *this ->zero = std::complex <double >(0.0 , 0.0 );
53+ base_device::memory::resize_memory_op<std::complex <double >, base_device::DEVICE_CPU>()(
54+ this ->cpu_ctx , this ->one , 1 );
55+ *this ->one = std::complex <double >(1.0 , 0.0 );
56+ base_device::memory::resize_memory_op<std::complex <double >, base_device::DEVICE_CPU>()(
57+ this ->cpu_ctx , this ->neg_one , 1 );
58+ *this ->neg_one = std::complex <double >(-1.0 , 0.0 );
2859}
2960
3061// Specialized templates to support std:: complex<float>types
3162template <>
3263const_nums<std::complex <float >>::const_nums()
33- : zero(std::complex <float >(0.0 , 0.0 )), one(std::complex <float >(1.0 , 0.0 )), neg_one(std::complex <float >(-1.0 , 0.0 ))
3464{
35- }
65+ base_device::memory::resize_memory_op<std::complex <float >, base_device::DEVICE_CPU>()(
66+ this ->cpu_ctx , this ->zero , 1 );
67+ *this ->zero = std::complex <float >(0.0 , 0.0 );
68+ base_device::memory::resize_memory_op<std::complex <float >, base_device::DEVICE_CPU>()(
69+ this ->cpu_ctx , this ->one , 1 );
70+ *this ->one = std::complex <float >(1.0 , 0.0 );
71+ base_device::memory::resize_memory_op<std::complex <float >, base_device::DEVICE_CPU>()(
72+ this ->cpu_ctx , this ->neg_one , 1 );
73+ *this ->neg_one = std::complex <float >(-1.0 , 0.0 );
74+ }
0 commit comments