Exemple #1
0
        public static IFloatMatrix AU(IFloatMatrix A, IROFloatVector u, int r1, int r2, int c1, int c2, IFloatVector v)
        {
            if (r2 < r1 || c2 < c1)
            {
                return(A);
            }

            if (c2 - c1 + 1 > u.Length)
            {
                throw new ArgumentException("Householder vector too short.", "u");
            }

            if (r2 - r1 + 1 > v.Length)
            {
                throw new ArgumentException("Work vector too short.", "v");
            }

            for (int i = r1; i <= r2; i++)
            {
                v[i - r1] = 0.0f;
                for (int j = c1; j <= c2; j++)
                {
                    v[i - r1] = v[i - r1] + A[i, j] * u[j - c1];
                }
            }
            for (int i = r1; i <= r2; i++)
            {
                for (int j = c1; j <= c2; j++)
                {
                    A[i, j] = A[i, j] - v[i - r1] * u[j - c1];
                }
            }
            return(A);
        }
Exemple #2
0
		public static IFloatMatrix AU(IFloatMatrix A, IROFloatVector u, int r1, int r2, int c1, int c2, IFloatVector v)
		{
			if (r2 < r1 || c2 < c1)
			{
				return A;
			}

			if (c2 - c1 + 1 > u.Length)
			{
				throw new ArgumentException("Householder vector too short.", "u");
			}

			if (r2 - r1 + 1 > v.Length)
			{
				throw new ArgumentException("Work vector too short.", "v");
			}

			for (int i = r1; i <= r2; i++)
			{
				v[i - r1] = 0.0f;
				for (int j = c1; j <= c2; j++)
				{
					v[i - r1] = v[i - r1] + A[i, j] * u[j - c1];
				}
			}
			for (int i = r1; i <= r2; i++)
			{
				for (int j = c1; j <= c2; j++)
				{
					A[i, j] = A[i, j] - v[i - r1] * u[j - c1];
				}
			}
			return A;
		}