Merge pull request #4554 from ev-br/patch-1

Add a test for dnrm(..., incx=-1)
This commit is contained in:
Martin Kroeker 2024-03-12 18:24:42 +01:00 committed by GitHub
commit 161ac17466
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 1 deletions

View File

@ -30,7 +30,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**********************************************************************************/ **********************************************************************************/
#include <math.h>
#include "openblas_utest.h" #include "openblas_utest.h"
#if defined(BUILD_DOUBLE) #if defined(BUILD_DOUBLE)
@ -64,4 +64,17 @@ CTEST(dnrm2,dnrm2_tiny)
res1=BLASFUNC(dnrm2)(&n, x, &incx); res1=BLASFUNC(dnrm2)(&n, x, &incx);
ASSERT_DBL_NEAR_TOL(res2, res1, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(res2, res1, DOUBLE_EPS);
} }
CTEST(dnrm2,dnrm2_neg_incx)
{
int i;
double x[5];
blasint incx=-1;
blasint n=5;
double res1, res2;
for (i=0;i<n;i++)x[i]=10.0;
res1=BLASFUNC(dnrm2)(&n, x, &incx);
res2 = sqrt(500.0);
ASSERT_DBL_NEAR_TOL(res2, res1, DOUBLE_EPS);
}
#endif #endif