Exemplo n.º 1
0
        public void dnrm2_TestCaseData_ResultOfBenchmarkImplementation(int n, int incX, params double[] x)
        {
            double actual   = m_Level1BLAS.dnrm2(n, x, incX);
            double expected = m_BenchmarkLevel1BLAS.dnrm2(n, x, incX);

            Assert.That(actual, Is.EqualTo(expected).Within(1E-9));
        }
        /// <summary>Computes the square of the Euclidean norm of a specific vector, i.e. ||x||^2.
        /// </summary>
        /// <param name="level1">The BLAS level 1 implementation.</param>
        /// <param name="n">The number of elements of <paramref name="x"/>.</param>
        /// <param name="x">The vector 'x' with at least <paramref name="n"/> elements.</param>
        /// <param name="incX">The increment for <paramref name="x"/>.</param>
        /// <returns>The square of the euclidian norm of x, i.e. x_0^2 + ... + x_n^2.</returns>
        public static double dnrm2sq(this ILevel1BLAS level1, int n, double[] x, int incX = 1)
        {
            var norm = level1.dnrm2(n, x, incX);

            return(norm * norm);
        }