-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected errors during subassignment; not mimicking arrays #17
Comments
Yeah subassignment is still a work-in-progress. In particular using a multidimensional index is not ready in general. It's on the TODO list but it might take a few more weeks before I get to it. In the meantime, the workaround is to use a linear index i.e. a numeric vector or N-col matrix where N is the number of dimensions. In this case the right value must be a vector. So:
Not always super easy/convenient to translate a multidimensional index Hopefully that'll get you going for now. |
This is helpful. Thank you for the quick response. If anyone is reading this and wants a quick and dirty workaround solution for now, here's the helper function I came up with:
Then you can write things like this:
|
Nice. Good to know about I don't know the details of your use case but note that another way to build a big multidimensional sparse array is to construct slices of lower dimensions and
or load them from a file, then stack them together with:
Note that stacking SVT_SparseArray objects of identical dimensions like this is a very cheap operation (almost instantaneous!). In particular it will be a lot more efficient than creating a big allzero array and subassigning slices to it. See Also be aware that the row/col summarization methods for SVT_SparseArray objects (a.k.a. matrixStats methods) can handle multidimensional objects and support the
See Hope this helps, |
I'm unable to assign 1- or 2D-slices to vectors. I can loop through every element of an array with nested for-loops, but it is incredibly slow to do. I get a variety of error messages, demonstrated below. All errors were identical whether using
=
or<-
, on a Windows laptop and a Linux server.The errors differ whether subsetting by column or by row, and whether it's the entire column or a subset of it:
Windows sessionInfo()
Linux sessionInfo()
The text was updated successfully, but these errors were encountered: