[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/arrayfire/arrayfire/feature/optional-graphics/test/lu_dense.cpp [Back]  [Original]

/*******************************************************
 * Copyright (c) 2014, ArrayFire
 * All rights reserved.
 *
 * This file is distributed under 3-clause BSD license.
 * The complete license agreement can be obtained at:
 * http://arrayfire.com/licenses/BSD-3-Clause
 ********************************************************/

// NOTE: Tests are known to fail on OSX when utilizing the CPU and OpenCL
// backends for sizes larger than 128x128 or more. You can read more about it on
// issue https://github.com/arrayfire/arrayfire/issues/1617

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using af::array;
using af::cdouble;
using af::cfloat;
using af::count;
using af::dim4;
using af::dtype_traits;
using af::max;
using af::seq;
using af::span;
using std::abs;
using std::endl;
using std::string;
using std::vector;

TEST(LU, InPlaceSmall) {
    LAPACK_ENABLED_CHECK();

    int resultIdx = 0;

    vector numDims;
    vector in;
    vector tests;
    readTests(string(TEST_DIR "/lapack/lu.test"), numDims,
                                   in, tests);

    dim4 idims = numDims[0];
    array input(idims, &(in[0].front()));
    array output, pivot;
    lu(output, pivot, input);

    dim4 odims = output.dims();

    // Get result
    float* outData = new float[tests[resultIdx].size()];
    output.host((void*)outData);

    // Compare result
    for (int y = 0; y < (int)odims[1]; ++y) {
        for (int x = 0; x < (int)odims[0]; ++x) {
            // Check only upper triangle
            if (x 

Web Proxy Viewer  |  New URL  |  Original Page