Skip to content

add Vector (a,b) -> (Vector a, Vector b) et al to Unboxed Vector and MVector #63

Description

@cartazio

I'd like this for Unboxed Vectors and MVector

roughly

Unbox (a,b) =>Vector (a,b) -> (Vector a,Vector b)
Unbox (a,b) => (Vector a,Vector b) -> Vector (a,b)
Unbox (a,b) => (MVector s a,MVector s b) -> MVector s (a,b)
Unbox (a,b) =>MVector (a,b) -> (MVector a,MVector b)

should do this for (,)...(,,,) and Complex at least

Activity

  1. cartazio commented on Dec 9, 2014

    @cartazio
    ContributorAuthor

    https://github.com/wellposed/numerical/blob/d133ff5d982c5e83e711e1f364678a5455fe9b2b/src/Numerical/Array/Shape.hs#L481-L527
    is some code i wrote that uses this, and I actually crucially need these sorts of transformations in another module of my code

    or just export the constructors, because its totally type safe

  2. ttuegel commented on Dec 9, 2014

    @ttuegel
    Member

    If there is any concern about exporting the constructors, there should at least be zero-copy versions of these functions.

  3. cartazio commented on Dec 9, 2014

    @cartazio
    ContributorAuthor

    Looking at how the unboxed tuples instances are defined, I think these have to be zero copy helper functions

    eg

    data instance Vector (a, b)    
          = V_2 {-# UNPACK #-} !Int  !(Vector a)  !(Vector b)
    
  4. cartazio commented on Dec 9, 2014

    @cartazio
    ContributorAuthor

    and I guess in the tuple of (Vector a, Vector b) -> Vector (a,b) direction, they need to validate that the lenghts are the same

  5. neongreen commented on Jan 21, 2015

    @neongreen

    unzip* and zip* are already provided for unboxed vectors and they are O(1): https://github.com/haskell/vector/blob/master/internal/unbox-tuple-instances

    This issue should probably be closed.

  6. ttuegel commented on Jan 21, 2015

    @ttuegel
    Member

    We also need the same for Complex.

  7. yongqli commented on Jan 25, 2015

    @yongqli

    It would be great if there was a way to expose the underlying "structure of arrays". It might be too much to ask for though. See ekmett/linear#61

  8. cartazio commented on Jan 25, 2015

    @cartazio
    ContributorAuthor
  9. ekmett commented on Mar 7, 2015

    @ekmett
    Member

    I personally would have no problem with exporting the constructors from somewhere.

  10. added this to the 0.12 milestone on Jul 24, 2016
  11. modified the milestones: 0.12, 0.13 on Jun 11, 2020
  12. lehins commented on Jun 19, 2022

    @lehins
    Contributor

    Constructors for unboxed vectors have been exported from Data.Vector.Unboxed.Base from the beginning of time. It is an internal module as it very much should be, but it does not prevent others to shoot themselves in the foot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions