示例#1
0
        /// <summary>
        /// SPACETIME.Dual : res = !a
        /// Poincare duality operator.
        /// </summary>
        public static SPACETIME operator !(SPACETIME a)
        {
            SPACETIME res = new SPACETIME();

            res[0]  = -a[15];
            res[1]  = a[14];
            res[2]  = -a[13];
            res[3]  = a[12];
            res[4]  = a[11];
            res[5]  = a[10];
            res[6]  = -a[9];
            res[7]  = -a[8];
            res[8]  = a[7];
            res[9]  = a[6];
            res[10] = -a[5];
            res[11] = -a[4];
            res[12] = -a[3];
            res[13] = a[2];
            res[14] = -a[1];
            res[15] = a[0];
            return(res);
        }
示例#2
0
        /// <summary>
        /// SPACETIME.Conjugate : res = a.Conjugate()
        /// Clifford Conjugation
        /// </summary>
        public SPACETIME Conjugate()
        {
            SPACETIME res = new SPACETIME();

            res[0]  = this[0];
            res[1]  = -this[1];
            res[2]  = -this[2];
            res[3]  = -this[3];
            res[4]  = -this[4];
            res[5]  = -this[5];
            res[6]  = -this[6];
            res[7]  = -this[7];
            res[8]  = -this[8];
            res[9]  = -this[9];
            res[10] = -this[10];
            res[11] = this[11];
            res[12] = this[12];
            res[13] = this[13];
            res[14] = this[14];
            res[15] = this[15];
            return(res);
        }
示例#3
0
        /// <summary>
        /// SPACETIME.sadd : res = a + b
        /// scalar/multivector addition
        /// </summary>
        public static SPACETIME operator +(float a, SPACETIME b)
        {
            SPACETIME res = new SPACETIME();

            res[0]  = a + b[0];
            res[1]  = b[1];
            res[2]  = b[2];
            res[3]  = b[3];
            res[4]  = b[4];
            res[5]  = b[5];
            res[6]  = b[6];
            res[7]  = b[7];
            res[8]  = b[8];
            res[9]  = b[9];
            res[10] = b[10];
            res[11] = b[11];
            res[12] = b[12];
            res[13] = b[13];
            res[14] = b[14];
            res[15] = b[15];
            return(res);
        }
示例#4
0
        /// <summary>
        /// SPACETIME.muls : res = a * b
        /// multivector/scalar multiplication
        /// </summary>
        public static SPACETIME operator *(SPACETIME a, float b)
        {
            SPACETIME res = new SPACETIME();

            res[0]  = a[0] * b;
            res[1]  = a[1] * b;
            res[2]  = a[2] * b;
            res[3]  = a[3] * b;
            res[4]  = a[4] * b;
            res[5]  = a[5] * b;
            res[6]  = a[6] * b;
            res[7]  = a[7] * b;
            res[8]  = a[8] * b;
            res[9]  = a[9] * b;
            res[10] = a[10] * b;
            res[11] = a[11] * b;
            res[12] = a[12] * b;
            res[13] = a[13] * b;
            res[14] = a[14] * b;
            res[15] = a[15] * b;
            return(res);
        }
示例#5
0
        /// <summary>
        /// SPACETIME.Sub : res = a - b
        /// Multivector subtraction
        /// </summary>
        public static SPACETIME operator -(SPACETIME a, SPACETIME b)
        {
            SPACETIME res = new SPACETIME();

            res[0]  = a[0] - b[0];
            res[1]  = a[1] - b[1];
            res[2]  = a[2] - b[2];
            res[3]  = a[3] - b[3];
            res[4]  = a[4] - b[4];
            res[5]  = a[5] - b[5];
            res[6]  = a[6] - b[6];
            res[7]  = a[7] - b[7];
            res[8]  = a[8] - b[8];
            res[9]  = a[9] - b[9];
            res[10] = a[10] - b[10];
            res[11] = a[11] - b[11];
            res[12] = a[12] - b[12];
            res[13] = a[13] - b[13];
            res[14] = a[14] - b[14];
            res[15] = a[15] - b[15];
            return(res);
        }
示例#6
0
        /// <summary>
        /// SPACETIME.Dot : res = a | b
        /// The inner product.
        /// </summary>
        public static SPACETIME operator |(SPACETIME a, SPACETIME b)
        {
            SPACETIME res = new SPACETIME();

            res[0]  = b[0] * a[0] + b[1] * a[1] + b[2] * a[2] + b[3] * a[3] - b[4] * a[4] - b[5] * a[5] - b[6] * a[6] + b[7] * a[7] - b[8] * a[8] + b[9] * a[9] + b[10] * a[10] - b[11] * a[11] + b[12] * a[12] + b[13] * a[13] + b[14] * a[14] - b[15] * a[15];
            res[1]  = b[1] * a[0] + b[0] * a[1] - b[5] * a[2] - b[6] * a[3] + b[7] * a[4] + b[2] * a[5] + b[3] * a[6] - b[4] * a[7] - b[11] * a[8] + b[12] * a[9] + b[13] * a[10] - b[8] * a[11] + b[9] * a[12] + b[10] * a[13] - b[15] * a[14] + b[14] * a[15];
            res[2]  = b[2] * a[0] + b[5] * a[1] + b[0] * a[2] - b[8] * a[3] + b[9] * a[4] - b[1] * a[5] + b[11] * a[6] - b[12] * a[7] + b[3] * a[8] - b[4] * a[9] + b[14] * a[10] + b[6] * a[11] - b[7] * a[12] + b[15] * a[13] + b[10] * a[14] - b[13] * a[15];
            res[3]  = b[3] * a[0] + b[6] * a[1] + b[8] * a[2] + b[0] * a[3] + b[10] * a[4] - b[11] * a[5] - b[1] * a[6] - b[13] * a[7] - b[2] * a[8] - b[14] * a[9] - b[4] * a[10] - b[5] * a[11] - b[15] * a[12] - b[7] * a[13] - b[9] * a[14] + b[12] * a[15];
            res[4]  = b[4] * a[0] + b[7] * a[1] + b[9] * a[2] + b[10] * a[3] + b[0] * a[4] - b[12] * a[5] - b[13] * a[6] - b[1] * a[7] - b[14] * a[8] - b[2] * a[9] - b[3] * a[10] - b[15] * a[11] - b[5] * a[12] - b[6] * a[13] - b[8] * a[14] + b[11] * a[15];
            res[5]  = b[5] * a[0] + b[11] * a[3] - b[12] * a[4] + b[0] * a[5] + b[15] * a[10] + b[3] * a[11] - b[4] * a[12] + b[10] * a[15];
            res[6]  = b[6] * a[0] - b[11] * a[2] - b[13] * a[4] + b[0] * a[6] - b[15] * a[9] - b[2] * a[11] - b[4] * a[13] - b[9] * a[15];
            res[7]  = b[7] * a[0] - b[12] * a[2] - b[13] * a[3] + b[0] * a[7] - b[15] * a[8] - b[2] * a[12] - b[3] * a[13] - b[8] * a[15];
            res[8]  = b[8] * a[0] + b[11] * a[1] - b[14] * a[4] + b[15] * a[7] + b[0] * a[8] + b[1] * a[11] - b[4] * a[14] + b[7] * a[15];
            res[9]  = b[9] * a[0] + b[12] * a[1] - b[14] * a[3] + b[15] * a[6] + b[0] * a[9] + b[1] * a[12] - b[3] * a[14] + b[6] * a[15];
            res[10] = b[10] * a[0] + b[13] * a[1] + b[14] * a[2] - b[15] * a[5] + b[0] * a[10] + b[1] * a[13] + b[2] * a[14] - b[5] * a[15];
            res[11] = b[11] * a[0] + b[15] * a[4] + b[0] * a[11] - b[4] * a[15];
            res[12] = b[12] * a[0] + b[15] * a[3] + b[0] * a[12] - b[3] * a[15];
            res[13] = b[13] * a[0] - b[15] * a[2] + b[0] * a[13] + b[2] * a[15];
            res[14] = b[14] * a[0] + b[15] * a[1] + b[0] * a[14] - b[1] * a[15];
            res[15] = b[15] * a[0] + b[0] * a[15];
            return(res);
        }
示例#7
0
        /// <summary>
        /// SPACETIME.Vee : res = a & b
        /// The regressive product. (JOIN)
        /// </summary>
        public static SPACETIME operator &(SPACETIME a, SPACETIME b)
        {
            SPACETIME res = new SPACETIME();

            res[15] = 1 * (a[15] * b[15]);
            res[14] = -1 * (a[14] * -1 * b[15] + a[15] * b[14] * -1);
            res[13] = 1 * (a[13] * b[15] + a[15] * b[13]);
            res[12] = -1 * (a[12] * -1 * b[15] + a[15] * b[12] * -1);
            res[11] = 1 * (a[11] * b[15] + a[15] * b[11]);
            res[10] = 1 * (a[10] * b[15] + a[13] * b[14] * -1 - a[14] * -1 * b[13] + a[15] * b[10]);
            res[9]  = -1 * (a[9] * -1 * b[15] + a[12] * -1 * b[14] * -1 - a[14] * -1 * b[12] * -1 + a[15] * b[9] * -1);
            res[8]  = 1 * (a[8] * b[15] + a[11] * b[14] * -1 - a[14] * -1 * b[11] + a[15] * b[8]);
            res[7]  = 1 * (a[7] * b[15] + a[12] * -1 * b[13] - a[13] * b[12] * -1 + a[15] * b[7]);
            res[6]  = -1 * (a[6] * -1 * b[15] + a[11] * b[13] - a[13] * b[11] + a[15] * b[6] * -1);
            res[5]  = 1 * (a[5] * b[15] + a[11] * b[12] * -1 - a[12] * -1 * b[11] + a[15] * b[5]);
            res[4]  = -1 * (a[4] * -1 * b[15] + a[7] * b[14] * -1 - a[9] * -1 * b[13] + a[10] * b[12] * -1 + a[12] * -1 * b[10] - a[13] * b[9] * -1 + a[14] * -1 * b[7] + a[15] * b[4] * -1);
            res[3]  = 1 * (a[3] * b[15] + a[6] * -1 * b[14] * -1 - a[8] * b[13] + a[10] * b[11] + a[11] * b[10] - a[13] * b[8] + a[14] * -1 * b[6] * -1 + a[15] * b[3]);
            res[2]  = -1 * (a[2] * -1 * b[15] + a[5] * b[14] * -1 - a[8] * b[12] * -1 + a[9] * -1 * b[11] + a[11] * b[9] * -1 - a[12] * -1 * b[8] + a[14] * -1 * b[5] + a[15] * b[2] * -1);
            res[1]  = 1 * (a[1] * b[15] + a[5] * b[13] - a[6] * -1 * b[12] * -1 + a[7] * b[11] + a[11] * b[7] - a[12] * -1 * b[6] * -1 + a[13] * b[5] + a[15] * b[1]);
            res[0]  = 1 * (a[0] * b[15] + a[1] * b[14] * -1 - a[2] * -1 * b[13] + a[3] * b[12] * -1 - a[4] * -1 * b[11] + a[5] * b[10] - a[6] * -1 * b[9] * -1 + a[7] * b[8] + a[8] * b[7] - a[9] * -1 * b[6] * -1 + a[10] * b[5] + a[11] * b[4] * -1 - a[12] * -1 * b[3] + a[13] * b[2] * -1 - a[14] * -1 * b[1] + a[15] * b[0]);
            return(res);
        }