コード例 #1
0
        public SparseRowColumnMatrix(
            double[] di,
            double[] al,
            double[] au,
            int[] ia,
            int[] ja)
        {
            if (di == null)
            {
                throw new ArgumentNullException(nameof(di));
            }
            if (al == null)
            {
                throw new ArgumentNullException(nameof(al));
            }
            if (au == null)
            {
                throw new ArgumentNullException(nameof(au));
            }
            if (ia == null)
            {
                throw new ArgumentNullException(nameof(ia));
            }
            if (ja == null)
            {
                throw new ArgumentNullException(nameof(ja));
            }

            if (ja.Length != ia[ia.Length - 1] - ia[0] ||
                ja.Length != al.Length ||
                ja.Length != au.Length ||
                di.Length != ia.Length - 1)
            {
                throw new RankException();
            }

            this.di = (double[])di.Clone();
            this.al = (double[])al.Clone();
            this.au = (double[])au.Clone();
            this.ia = (int[])ia.Clone();
            this.ja = (int[])ja.Clone();

            if (this.ia[0] == 1)
            {
                for (int i = 0; i < this.ia.Length; i++)
                {
                    this.ia[i]--;
                }

                for (int j = 0; j < this.ja.Length; j++)
                {
                    this.ja[j]--;
                }
            }

            for (int i = 0; i < Size; i++)
            {
                Sorter.QuickSort(this.ja, this.ia[i], this.ia[i + 1] - 1, this.al, this.au);
                //Array.Sort(this.ja, this.aa, this.ia[i], this.ia[i + 1] - this.ia[i]);
            }
        }