⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 octonion.hpp

📁 CGAL is a collaborative effort of several sites in Europe and Israel. The goal is to make the most i
💻 HPP
📖 第 1 页 / 共 5 页
字号:
                e(requested_e),                f(requested_f),                g(requested_g),                h(requested_h)            {                // nothing to do!            }                                    // constructor for H seen as C^4                            explicit                octonion(   ::std::complex<T> const & z0,                                                ::std::complex<T> const & z1 = ::std::complex<T>(),                                                ::std::complex<T> const & z2 = ::std::complex<T>(),                                                ::std::complex<T> const & z3 = ::std::complex<T>())            :   a(z0.real()),                b(z0.imag()),                c(z1.real()),                d(z1.imag()),                e(z2.real()),                f(z2.imag()),                g(z3.real()),                h(z3.imag())            {                // nothing to do!            }                                    // constructor for O seen as H^2                            explicit                octonion(   ::boost::math::quaternion<T> const & q0,                                                ::boost::math::quaternion<T> const & q1 = ::boost::math::quaternion<T>())            :   a(q0.R_component_1()),                b(q0.R_component_2()),                c(q0.R_component_3()),                d(q0.R_component_4()),                e(q1.R_component_1()),                f(q1.R_component_2()),                g(q1.R_component_3()),                h(q1.R_component_4())            {                // nothing to do!            }                                    // UNtemplated copy constructor            // (this is taken care of by the compiler itself)                                    // templated copy constructor                        template<typename X>            explicit                octonion(octonion<X> const & a_recopier)            :   a(static_cast<T>(a_recopier.R_component_1())),                b(static_cast<T>(a_recopier.R_component_2())),                c(static_cast<T>(a_recopier.R_component_3())),                d(static_cast<T>(a_recopier.R_component_4())),                e(static_cast<T>(a_recopier.R_component_5())),                f(static_cast<T>(a_recopier.R_component_6())),                g(static_cast<T>(a_recopier.R_component_7())),                h(static_cast<T>(a_recopier.R_component_8()))            {                // nothing to do!            }                                    // destructor            // (this is taken care of by the compiler itself)                                    // accessors            //            // Note:    Like complex number, octonions do have a meaningful notion of "real part",            //            but unlike them there is no meaningful notion of "imaginary part".            //            Instead there is an "unreal part" which itself is an octonion, and usually            //            nothing simpler (as opposed to the complex number case).            //            However, for practicallity, there are accessors for the other components            //            (these are necessary for the templated copy constructor, for instance).                        BOOST_OCTONION_ACCESSOR_GENERATOR(T)                        // assignment operators                        BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR(T)                        // other assignment-related operators            //            // NOTE:    Octonion multiplication is *NOT* commutative;            //            symbolically, "q *= rhs;" means "q = q * rhs;"            //            and "q /= rhs;" means "q = q * inverse_of(rhs);";            //            octonion multiplication is also *NOT* associative                        octonion<T> &            operator += (T const & rhs)            {                T    at = a + rhs;    // exception guard                                a = at;                                return(*this);            }                                    octonion<T> &            operator += (::std::complex<T> const & rhs)            {                T    at = a + rhs.real();    // exception guard                T    bt = b + rhs.imag();    // exception guard                                a = at;                 b = bt;                                return(*this);            }                                    octonion<T> &            operator += (::boost::math::quaternion<T> const & rhs)            {                T    at = a + rhs.R_component_1();    // exception guard                T    bt = b + rhs.R_component_2();    // exception guard                T    ct = c + rhs.R_component_3();    // exception guard                T    dt = d + rhs.R_component_4();    // exception guard                                a = at;                 b = bt;                c = ct;                d = dt;                                return(*this);            }                                    template<typename X>            octonion<T> &            operator += (octonion<X> const & rhs)            {                T    at = a + static_cast<T>(rhs.R_component_1());    // exception guard                T    bt = b + static_cast<T>(rhs.R_component_2());    // exception guard                T    ct = c + static_cast<T>(rhs.R_component_3());    // exception guard                T    dt = d + static_cast<T>(rhs.R_component_4());    // exception guard                T    et = e + static_cast<T>(rhs.R_component_5());    // exception guard                T    ft = f + static_cast<T>(rhs.R_component_6());    // exception guard                T    gt = g + static_cast<T>(rhs.R_component_7());    // exception guard                T    ht = h + static_cast<T>(rhs.R_component_8());    // exception guard                                a = at;                b = bt;                c = ct;                d = dt;                e = et;                f = ft;                g = gt;                h = ht;                                return(*this);            }                                                octonion<T> &            operator -= (T const & rhs)            {                T    at = a - rhs;    // exception guard                                a = at;                                return(*this);            }                                    octonion<T> &            operator -= (::std::complex<T> const & rhs)            {                T    at = a - rhs.real();    // exception guard                T    bt = b - rhs.imag();    // exception guard                                a = at;                 b = bt;                                return(*this);            }                                    octonion<T> &            operator -= (::boost::math::quaternion<T> const & rhs)            {                T    at = a - rhs.R_component_1();    // exception guard                T    bt = b - rhs.R_component_2();    // exception guard                T    ct = c - rhs.R_component_3();    // exception guard                T    dt = d - rhs.R_component_4();    // exception guard                                a = at;                 b = bt;                c = ct;                d = dt;                                return(*this);            }                                    template<typename X>            octonion<T> &            operator -= (octonion<X> const & rhs)            {                T    at = a - static_cast<T>(rhs.R_component_1());    // exception guard                T    bt = b - static_cast<T>(rhs.R_component_2());    // exception guard                T    ct = c - static_cast<T>(rhs.R_component_3());    // exception guard                T    dt = d - static_cast<T>(rhs.R_component_4());    // exception guard                T    et = e - static_cast<T>(rhs.R_component_5());    // exception guard                T    ft = f - static_cast<T>(rhs.R_component_6());    // exception guard                T    gt = g - static_cast<T>(rhs.R_component_7());    // exception guard                T    ht = h - static_cast<T>(rhs.R_component_8());    // exception guard                                a = at;                b = bt;                c = ct;                d = dt;                e = et;                f = ft;                g = gt;                h = ht;                

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -