Skip to content

Matrix comprehensions (build_matrix function) #3282

Description

@WardBrian

This would be a variadic function with signature:
matrix build_matrix(int I, int J, Fn f, T1 arg1,...TN argN) (name up for debate)

where Fn is a function (int, int, T1, ..., TN) => real

It returns a matrix M such that M[i,j] = f(i,j, arg1, ... argN)

The real advantage to this function is that it can do local autodiff, which will improve memory usage/locality and allow us to have the returned matrix be a SoA matrix (cf #2344 (comment)).

Once implemented, build_[row]_vector is the obvious extension.

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions