Boost logo

Ublas :

Subject: Re: [ublas] [bindings] Workspaces
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2008-12-17 06:54:40


Rutger ter Borg wrote:
> Ok, I guess I was following the lapack naming convention. I was thinking,
> e.g., workspace2 = { array1, array2 } with array being of any array type.
> Vector would be another logical name. Alternatives could be
> get_workspace_of<>, or get_workspace_array_of<>? Or do you have other
> suggestions?

I actually like get_workspace_of<>, because it communicates a sense of intended usage to me.

> I meant temporary workspace arrays, instantiated for the minimal and optimal
> cases. I though it would be clean to wrap these ones in a workspace-struct
> and pass them on as if they were defined by a user.

Whether it is clean to wrap the temporary workspace arrays of minimal_workspace and optimal_workspace like they were defined by a user depends on the overall structure of the lapack bindings. The following example from the heevx bindings might highlight the reasons why the temporary arrays of optimal_workspace are currently not wrapped into a workspace-struct:

        // Function that allocates temporary arrays
        template <typename T, typename R>
        void operator() (
          char const jobz, char const range, char const uplo, int const n,
          T* a, int const lda,
          R vl, R vu, int const il, int const iu,
          R abstol, int& m,
          R* w, T* z, int const ldz, optimal_workspace, int* ifail, int& info) {

          traits::detail::array<int> iwork( 5*n );

          T workspace_query;
          heevx( jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz,
            &workspace_query, -1,
            traits::vector_storage (iwork),
            ifail, info);

          traits::detail::array<T> work( traits::detail::to_int( workspace_query ) );

          heevx( jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz,
            traits::vector_storage (work), traits::vector_size (work),
            traits::vector_storage (iwork),
            ifail, info);
        }

Regards,
Thomas