Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ansys/math/core/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,15 @@ def axpy(self, obj, val1, val2):
"""
if not hasattr(obj, "id"):
raise TypeError("The object to be added must be an AnsMath object.")

# Check if the object in question is a matrix or a vector
if hasattr(obj, "ncol"):
if (self.ncol != obj.ncol) or (self.nrow != obj.nrow):
raise ValueError("The objects to be added have unequal dimensions")
else:
if self.size != obj.size:
raise ValueError("The objects to be added have unequal dimension")

self._mapdl._log.info("Call MAPDL to perform an AXPY operation.")
self._mapdl.run(f"*AXPY,{val1},0,{obj.id},{val2},0,{self.id}", mute=True)
return self
Expand Down