# -*- coding: utf-8 -*-## This file is subject to the terms and conditions defined in# file 'LICENSE.txt', which is part of this source code package.#importnumpyasnp
[docs]defImmutableView(data:np.ndarray)->np.ndarray:"""Return a immutable view of a numpy array Parameters ---------- data : np.ndarray input numpy array Returns ------- np.ndarray immutable view of data """res=data.view()res.flags.writeable=Falsereturnres
# to eliminate dofs with know values
[docs]defDeleteRowsCols(A,rows,cols,fixedValues):"""This function will be eliminated. Please do not use it Parameters ---------- A : _type_ _description_ rows : _type_ _description_ cols : _type_ _description_ fixedValues : _type_ _description_ Returns ------- _type_ _description_ """# Assumes that matrix is in symmetric csc form !rhs=A.dot(fixedValues)A=A[np.logical_not(rows),:]A=A[:,np.logical_not(cols)]return[A,rhs]