[Trilinos-Users] PyTrilinos: Behaviour of __getitem__ on Epetra Crs Matrix
Karim Khayrat
kkhayrat at gmail.com
Thu Oct 27 10:22:01 EDT 2016
Hello,
When I run the following code :
from PyTrilinos import Epetra
comm = Epetra.PyComm()
test_map = Epetra.Map(100, 0 , comm)
W = Epetra.CrsMatrix(Epetra.Copy, test_map, test_map, 2)
W.InsertMyValues([1,1,2,3,3],[1,2,1,3,4],[5,5,5,5,5])
W.FillComplete()
print W[W.Map().GID(1)]
print W.ExtractMyRowCopy(1)
[stdout:0]
[ 0. 5. 5. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0.]
(array([ 5., 5.]), array([1, 2], dtype=int32))
[stdout:1]
[ 0. 5. 5. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0.]
(array([ 5., 5.]), array([1, 2], dtype=int32))
[stdout:2]
[ 0. 5. 5. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0.]
(array([ 5., 5.]), array([1, 2], dtype=int32))
[stdout:3]
[ 0. 5. 5. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0.]
(array([ 5., 5.]), array([1, 2], dtype=int32))
I do not understand why the get item operator [] gives back an array of
length 25. While ExtractMyRowCopy would return values as expected. Is this
an implementation issue?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20161027/3a88a86c/attachment.html>
More information about the Trilinos-Users
mailing list