/// <summary> Assembly using setValues</summary> /// <param name="nu">Maximum number of entries /// </param> /// <returns> Dense representation (not a direct copy) /// </returns> public static double[] setsAssembleVector(IElementalAccessVector x, int nu) { int n = x.Length; double[] data = new double[n]; System.Random r = new System.Random(); int[] ind = TesterUtilities.getIntArray(nu, r); double[] arr = TesterUtilities.getDoubleArray(ind.Length, r); for (int i = 0; i < ind.Length; ++i) { data[ind[i]] = arr[i]; } x.SetValues(ind, arr); return(data); }
private void boundary(IElementalAccessMatrix A, IElementalAccessVector b, IElementalAccessVector x, double gl, double gr) { int n = b.Length - 1; int[] boundary = new int[] { 0, n }; double[] boundaryV = new double[] { gl, gr }; x.SetValues(boundary, boundaryV); b.SetValues(boundary, boundaryV); A.SetValue(0, 0, 1); A.SetValue(0, 1, 0); A.SetValue(n, n, 1); A.SetValue(n, n - 1, 0); }