r472 - trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix
Author: bpoussin Date: 2014-04-10 15:41:07 +0200 (Thu, 10 Apr 2014) New Revision: 472 Url: http://forge.nuiton.org/projects/nuiton-matrix/repository/revisions/472 Log: enhance paste method for LazyVector Modified: trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/LazyVector.java Modified: trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/LazyVector.java =================================================================== --- trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/LazyVector.java 2014-04-10 12:44:04 UTC (rev 471) +++ trunk/nuiton-matrix/src/main/java/org/nuiton/math/matrix/LazyVector.java 2014-04-10 13:41:07 UTC (rev 472) @@ -148,14 +148,27 @@ protected void initBackend() { if (!isInitBackend) { backend.init(capacity); + isInitBackend = true; if (copy != null) { pasteToBackend(copy); } - isInitBackend = true; } } + /** + * Before call this method backend, must be initialized + * @param copy + */ protected void pasteToBackend(Vector copy) { + if (copy instanceof LazyVector) { + LazyVector l = (LazyVector)copy; + if (l.isInitBackend) { + copy = l.backend; + } else if (l.copy != null) { + copy = l.copy; + } + } + if (backend.isImplementedPaste(copy)) { backend.paste(copy); } else {
participants (1)
-
bpoussin@users.nuiton.org