Ejemplo n.º 1
0
        /// <summary>
        ///  return the value at the specified position
        /// </summary>
        /// <param name="index1"></param>
        /// <param name="index2"></param>
        /// <returns></returns>
        public double Value(int index1, int index2)
        {
            double val = 0.0;

            if (index1 >= matrixRowCount || index2 >= elemColCount)
            {
                throw new Exception("Index out of range.");
            }

            MatrixElement matrixElement = (MatrixElement)matrix[index1];

            switch (index2)
            {
            case 0:
                val = matrixElement.a;
                break;

            case 1:
                val = matrixElement.b;
                break;

            case 2:
                val = matrixElement.c;
                break;

            case 3:
                val = matrixElement.vector;
                break;

            default:
                break;
            }
            return(val);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// default constructor
 /// initialize a 3*4 matrix
 /// </summary>
 public Matrix()
 {
     matrix = new MatrixElement [matrixRowCount];
     for (int i = 0; i < matrixRowCount; i++)
     {
         MatrixElement matrixElement = new MatrixElement();
         matrix[i] = matrixElement;
     }
 }
Ejemplo n.º 3
0
        public Object Clone()
        {
            MatrixElement newElement = new MatrixElement();

            newElement.dimId  = this.dimId;
            newElement.a      = this.a;
            newElement.b      = this.b;
            newElement.c      = this.c;
            newElement.vector = this.vector;
            return(newElement);
        }