Ask Your Question
1

Testing if an object is a Matrix or a Vector

asked 2025-04-17 18:11:01 +0200

Thierry Dumont gravatar image

updated 2025-04-18 19:06:12 +0200

For a long time I used :

is_Matrix(A)
is_Vector(B)

but it is now deprecated. So I tried, like in https://ask.sagemath.org/question/975..., isinstance(A,sage.matrix.matrix.Matrix) which does not work.

What can I do ?

edit retag flag offensive close merge delete

Comments

Does this one work?: isinstance(A,sage.structure.element.Matrix)

tolga gravatar imagetolga ( 2025-04-17 19:06:49 +0200 )edit

Yes it works ! And also isinstance(B,sage.structure.element..Vector) works. Thhanks a lot !

Thierry Dumont gravatar imageThierry Dumont ( 2025-04-19 09:20:00 +0200 )edit
1

@tolga : for the benefit of future ask.sagemath.org (per-)users, please make a formal response from your comment...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2025-04-19 09:39:45 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2025-04-19 09:45:41 +0200

tolga gravatar image

This command does the job:

isinstance(A,sage.structure.element.Matrix)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2025-04-17 18:11:01 +0200

Seen: 100 times

Last updated: Apr 19