Skip to content

missing wildcard example when evaluating help(reshape) #2854

@dvd101x

Description

@dvd101x

When evaluating help(reshape) the examples do not show the use of wlidcard -1

Examples:
    reshape([1, 2, 3, 4, 5, 6], [2, 3])
        [[1, 2, 3], [4, 5, 6]]
    reshape([[1, 2], [3, 4]], [1, 4])
        [[1, 2, 3, 4]]
    reshape([[1, 2], [3, 4]], [4])
        [1, 2, 3, 4]

I see on the docs that an example is shown but with different alignment

 math.reshape([1, 2, 3, 4, 5, 6], [2, 3])
 // returns Array  [[1, 2, 3], [4, 5, 6]]

 math.reshape([[1, 2], [3, 4]], [1, 4])
 // returns Array  [[1, 2, 3, 4]]

 math.reshape([[1, 2], [3, 4]], [4])
 // returns Array [1, 2, 3, 4]

 const x = math.matrix([1, 2, 3, 4, 5, 6, 7, 8])
 math.reshape(x, [2, 2, 2])
 // returns Matrix [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]

math.reshape([1, 2, 3, 4], [-1, 2])
// returns Matrix [[1, 2], [3, 4]]

It seems to be related with either the order or the alignment of lines 30 and 31 in here

* math.reshape([1, 2, 3, 4], [-1, 2])

I don't know if this behavior is as intended but please review

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions