admin管理员组

文章数量:1292459

For example, I have two matrices, indclass and vwap, and I want to apply a function to corresponding rows from both matrices. The current approach fixes indclass to the first row, which is not what I want:

`byRow(contextby{demean, , indclass.row(0)}, vwap)

For example, I have two matrices, indclass and vwap, and I want to apply a function to corresponding rows from both matrices. The current approach fixes indclass to the first row, which is not what I want:

`byRow(contextby{demean, , indclass.row(0)}, vwap)
Share edited Feb 13 at 8:59 DarkBee 15.6k8 gold badges72 silver badges116 bronze badges asked Feb 13 at 8:58 HTLHTL 11
Add a comment  | 

1 Answer 1

Reset to default 0

To realize row-by-row operation of two matrices in DolphinDB, you need to bind the data of the corresponding rows dynamically through the high-level function each or byRow.

try this code:

def processRow(indRow, vwapRow) {
    return contextby(indRow, demean(vwapRow))
}

result = each(processRow, indclass.{row}, vwap.{row})

本文标签: distributed computingHow to Perform Rowwise Operations on Two MatricesStack Overflow