Hello, I’m trying to translate something from matlab to java for a project and I’m facing some (many) difficulties.
I have created a dummy block of code to explain what I’m trying to do atm. I tried several things including putColumn and I’m always failing. I also thought of iterating the column and from G (see the code below) and setting on Ge values using data() function, but I don’t like it so much and haven’t tested it yet.
Could you please help?
@officiallor could you try to lay this out a bit more clearly? A bit of context on what some of the matlab does would be useful as well. The less work we have to do to reverse engineer what you’re trying to do, the easier it is to help you. Try to explain what you’re trying to do with a complete code example.
I’m not quite sure what it should produce tbh. I’m still waiting for some outputs from the guys that want it. I tried running it on octave-online dot net and the result is 1 column repeating the the G’s 1st column 365 times. So what I’m trying to do is append to a matrixe’s column (greater in size), one other matrixe’s column that is smaller in size and in general, how to manipulate matrixes using this lib. I have read the docs and tried several things but I was getting some exceptions regarding the size of the column.
In ND4J, tensors have a fixed size, as they have a fixed memory allocation.
You’ll need to create an appropriately sized matrix first, and then you can assign values to it. If you want to do that column by column, you can get a view into that matrix with indexing operations (i.e. arr.get(...) with indexes defined by NDArrayIndex) and then view.assign what you want to have in there.
@treo could you please provide an example for my problem? I’ve read the .java examples and most of the quick start documentation but still I’m not familiar with this.
Thank you
Edit: Note: I’d like something to understand and continue with this matlab project
val Ge = Nd4j.create(96 * 365, 24)
for (i in 1..365) {
Ge.assign(G.getAllRowsOfColumn(1)) //getAllRowsOfColumn body-->
// return this.get(NDArrayIndex.all(), NDArrayIndex.point(columnIndex))
}