Esempio n. 1
0
        public bool canAppend(mat m)
        {
            if (sb.getT() == false)
            {
                if (latice.dom(new slevel(sb, 'C'), new slevel(ob)) == false)
                {
                    Console.WriteLine("*-property breach !");
                    return(false);
                }
                foreach (objc it in m.obj)
                {
                    if (m.retperm(sb, it).Contains(subcap.acces.read) || m.retperm(sb, it).Contains(subcap.acces.write))
                    {
                        if (latice.dom(new slevel(it), new slevel(ob)) == false)
                        {
                            Console.WriteLine("*-property breach !");
                            return(false);
                        }
                    }
                }
            }
            List <subcap.acces> x = m.retperm(sb, ob);

            if (x.Contains(subcap.acces.append) == false)
            {
                Console.WriteLine("ds-property breach !");
                return(false);
            }
            return(true);
        }
            /// <summary>
            ///   Determines whether the specified <see cref="System.Object" /> is equal to this instance.
            /// </summary>
            ///
            public override bool Equals(object obj)
            {
                mat m = obj as mat;

                if (m != null)
                {
                    return(this.matrix == m.matrix);
                }

                return(matrix.Equals(obj));
            }
Esempio n. 3
0
        public bool canExec(mat m)
        {
            List <subcap.acces> x = m.retperm(sb, ob);

            if (x.Contains(subcap.acces.exec) == false)
            {
                Console.WriteLine("ds-property breach !");
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
    public void ChangeColor(mat type)
    {
        switch (type)
        {
        case mat.regular:
            render.material = regular;
            break;

        case mat.highlight:
            render.material = highlight;
            break;
        }
    }
Esempio n. 5
0
        public bool canRead(mat m)
        {
            if (latice.dom(new slevel(ob), new slevel(sb, 'S')) == false)
            {
                Console.WriteLine("ss-property breach !");
                return(false);
            }
            List <subcap.acces> x = m.retperm(sb, ob);

            if (x.Contains(subcap.acces.read) == false)
            {
                Console.WriteLine("ds-property breach !");
                return(false);
            }
            return(true);
        }
        public void svdTest()
        {
            // Declare local matrices
            mat u = _, s = _, v = _;

            // Compute a new mat
            mat M = magic(3) * 5;

            // Compute the SVD
            ret [u, s, v] = svd(M);

            string str = u;

            /*
             *              0.577350269189626 -0.707106781186548     0.408248290463863
             *         U =  0.577350269189626 -1.48007149071427E-16 -0.816496580927726
             *              0.577350269189626  0.707106781186548     0.408248290463863
             */
            double[,] expectedU =
            {
                { 0.577350269189626,    -0.707106781186548,  0.408248290463863 },
                { 0.577350269189626, -1.48007149071427E-16, -0.816496580927726 },
                { 0.577350269189626,     0.707106781186548,  0.408248290463863 },
            };

            double[,] expectedS =
            {
                { 74.999999999999972,                  0,                  0 },
                {                  0, 34.641016151377556,                  0 },
                {                  0,                  0, 17.320508075688775 },
            };

            double[,] expectedV =
            {
                { 0.57735026918962573,  -0.4082482904638628,                  0.70710678118654779 },
                { 0.57735026918962562,  0.81649658092772615, -0.000000000000000061130671974381729 },
                { 0.57735026918962584, -0.40824829046386324,                 -0.70710678118654757 },
            };

            Assert.IsTrue(expectedU.IsEqual(u, 1e-10));
            Assert.IsTrue(expectedS.IsEqual(s, 1e-10));
            Assert.IsTrue(expectedV.IsEqual(v, 1e-10));
        }
            public MyAlgorithm()
            {
                I = eye(2);

                A = new[, ]
                {
                    { 0.0, 1.0 },
                    { 4.0, 2.0 },
                    { 7.0, 2.0 },
                };

                B = A * I;

                ret[U, S, V] = svd(B);

                Console.WriteLine(U);
                Console.WriteLine(S);
                Console.WriteLine(V);
            }
Esempio n. 8
0
 /// <summary>
 /// Multiply matrix x by matrix y component-wise, i.e.,
 /// result[i][j] is the scalar product of x[i][j] and y[i][j].
 /// Note: to get linear algebraic matrix multiplication, use
 /// the multiply operator (*).
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 protected mat matrixCompMult(mat x, mat y)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Multiply matrix x by matrix y component-wise, i.e.,
 /// result[i][j] is the scalar product of x[i][j] and y[i][j].
 /// Note: to get linear algebraic matrix multiplication, use
 /// the multiply operator (*).
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 protected mat matrixCompMult(mat x, mat y) { throw new NotImplementedException(); }
 public void SetMaterial(mat mat)
 {
     material = mat;
 }
Esempio n. 11
0
            public MyAlgorithm()
            {
                I = eye(5);

                A = new[,]
                {
                    { 0.0, 1.0 },
                    { 4.0, 2.0 },
                    { 7.0, 2.0 },
                };

                B = A * I;

                ret[U, S, V] = svd(B);

                Console.WriteLine(U);
                Console.WriteLine(S);
                Console.WriteLine(V);
            }
Esempio n. 12
0
 public ssec()
 {
     mat = new mat();
 }