you make a keyable attribute, you expose it as a button with attribute editor templates,
once the user click, the node's compute() is called, you check that the call comes from this attribute, you make a boolean member variable on your class, set to false at first
and if it's false you make your matrix and set it to true in the same if block
otherwhise if it's true, you dont redo the matrix, it's just simple caching