PAQ=LU pivoting factorization python programming

import scipy.linalg
import numpy as np
(p_mtrx, q_mtrx, l_mtrx, u_mtrx) = scipy.linalg.lu( a_mtrx )

np.set_printoptions(threshold=3)
np.set_printoptions(precision=3)

print(‘l_mtrx=n’,l_mtrx)
print(‘q_mtrx=n’,q_mtrx)
print(‘u_mtrx=n’,u_mtrx)
print(‘p_mtrx=n’,p_mtrx)
print(‘verificationn’,p_mtrx@l_mtrx @ u_mtrx-a_mtrx)

and I got error: not enough values to unpack(expexted 4 got 3)

How to increase the efficiency of this programming code?

can someone help me to improve this code functionality or add some extra features on it. Its about accessing an insurance application. I hope some of you have any other idea related to this part. If you need more information about it or other part of code tell me.Mostly, is an IntellJDE project with gradle, spring boot and databases.

 package fi.mandatumlife.epeli.ms.workqueueservice.core.service;

 import com.mandatum.epeli.model.domain.Company;
 import com.mandatum.epeli.model.domain.Insurance;
 import com.mandatum.epeli.model.domain.Notification;
 import com.mandatum.epeli.model.domain.Person;
 import 
 fi.mandatumlife.epeli.ms.workqueueservice.api.dto.WorkqueueRequestDTO;
 import 
 fi.mandatumlife.epeli.ms.workqueueservice.api.dto.EntryParametersDTO;
 import 
 fi.mandatumlife.epeli.ms.workqueueservice.core.
 filler.WorkqueueRequestFiller;
 import 

 fi.mandatumlife.epeli.ms.
 workqueueservice.core.repository.CompanyRepository;
 import 

 fi.mandatumlife.epeli.ms. 
 workqueueservice.core.repository.InsuranceRepository;
 import 
 fi.mandatumlife.epeli.
 ms.workqueueservice.core.repository.PersonRepository;

 import 

 fi.mandatumlife.epeli.
 ms.workqueueservice.core.tyojono.TyojonoRequestService;
 import fi.mandatumlife.epeli.ms.workqueueservice.core.util.Util;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.HttpServerErrorException;

 import javax.annotation.Resource;
 import java.util.Map;


 @Service
 public class CoreService {

 static final Logger log = LoggerFactory.getLogger(CoreService.class);

 private static final String POLICY_HOLDER = "Vakuutuksenottaja";

 private static final String MSG_UI_0047 = "MSG_UI_0047";
 private static final String MSG_UI_0048 = "MSG_UI_0048";
 private static final String SOURCE_EPELI = "Epeli";
 private static final String SOURCE_TYOJONOT = "Työjonot";

 private static final String K0091 = "K0091";

 @Autowired
 private PersonRepository personRepository;

 @Autowired
 private InsuranceRepository insuranceRepository;

 @Autowired
 private CompanyRepository companyRepository;

@Autowired
private WorkqueueRequestFiller addTaskToWorkqueueRequestFiller;

@Autowired
private NotificationService notificationService;

@Autowired
private TyojonoRequestService tyojonoRequestService;

@Autowired
private Util util;

@Resource(name = "ui_codes")
private Map  uiCodes;

public HttpStatus addTaskToWorkqueueRequest(EntryParametersDTO dto) {
Insurance insurance = fetchInsurance(dto.getInsuranceNumber());
Company company = fetchCompany(dto.getInsuranceNumber());
Person person = util.checkNullOrEmpty(dto.getPersonNumber()) ?null : 
fetchPerson(dto.getPersonNumber());

String status = dto.getStatus();
String documentType = dto.getDocumentType();
String product = insurance.getProduct();
if (checkRequiredParameters(status, documentType, product)) {
Notification notification = createFirstCaseNotification(insurance, 
person, status, documentType, product);
log.error("All or some mandatory fields are missed or incorrect.");
throw new HttpServerErrorException(HttpStatus.NOT_FOUND,
        "The mandatory information is missing. " +
                "See the Notification (id = " + 
 notification.getNotificationId() + ").");
}

  WorkqueueRequestDTO taskDto =
    addTaskToWorkqueueRequestFiller.createAndFill(insurance, 
 company, dto);
 HttpStatus httpStatus = tyojonoRequestService.sendRequest(taskDto);

  if (httpStatus != HttpStatus.CREATED) {
  Notification notification = createSecondCaseNotification(insurance, 
  person, documentType, httpStatus);
  log.error("Http code different from 201.");
  throw new HttpServerErrorException(httpStatus, "Task was not raised. 
  " +
        "See the Notification (id = " +    
   notification.getNotificationId() + ").");
  }

   return httpStatus;
 }

 private boolean checkRequiredParameters(String status, String 
  documentType, String product) {
  return util.checkNullOrEmpty(product) || 
  util.checkNullOrEmpty(documentType)
    || status == null || !status.equalsIgnoreCase("Saapunut");
  }

   private Notification createFirstCaseNotification(Insurance insurance, 
   Person 
   person, String status, String documentType, String product) {
   String text = "Seuraavat pakolliset tiedot puuttuvat: "
    + (util.checkNullOrEmpty(product) ? "vakuutuslaji, " : "")
    + (util.checkNullOrEmpty(documentType) ? 
   "tehtu00E4vu00E4tyyppi, " : "")
    + ((status == null || !status.equalsIgnoreCase("Saapunut")) ? 
  "tila " : "");
   return notificationService.createAndSave(MSG_UI_0048, SOURCE_EPELI, 
   text, person, insurance);
    }

   private Notification createSecondCaseNotification(Insurance 
    insurance, Person person, String documentType, HttpStatus httpStatus) {
    String text = uiCodes.get(MSG_UI_0047)
    + "- Tehtu00E4vu00E4 jota yritettiin nostaa: Task attempted to 
    raise "
    + documentType + " " + 
    util.getCodesMap(K0091).get(documentType);
     return notificationService.createAndSave(MSG_UI_0047, SOURCE_TYOJONOT, 
     text, 
    person, insurance);
     }

When to use articles before programming terms?

I’ve found such a paragraph in one of programming tutorials:

Ruby strings are simply sequences of 8-bit bytes and they are objects
of class String. Double-quoted strings allow substitution and
backslash notation but single-quoted strings don’t allow substitution
and allow backslash notation only for and ‘

What I have problem with:

  • “class String” instead of “the String class”
  • “substitution” instead of “the substitution”
  • “backslash notation” instead of “the backslash notation”
  • no articles before “” and “‘”

On the other hand, in the same tutorial we have a sentence:

Constants defined within a class or module can be accessed from within
that class or module, and those defined outside a class or module can
be accessed globally.

Where we have “a class”.

So my question is: are these sentences written correctly? And what rules should I obey with articles as a programmer writing about programming stuff?

Vectors and unit vector in programming

First, my math is horrible, that is why I am brushing up at Khan. I have been watching and learning about vectors by the most awesome Sal Khan at Khan academy. My question is more of a general one regarding representing 3D entities on something like a CAD program. Entities like planes, vectors, etc.

All of what Sal does is based with the origin as the starting point of the vector. He is careful to point out that a vector can start at any coordinate though. I suspect that this is to make things much simpler and explain the properties.

My question is this…when a person is representing and doing math in programming (let’s say a line that goes from 2,2,2 -> 5,5,5) of a vector does one transform the vector to (0,0), do the math and then transform the result back to it’s original position or is something done to it “in place”?

Why usage of assignment operator or loops discouraged in functional programming?

If my function meets below two requirements, I believe function Sum to return the summation of items in a list where item evaluates to true for given condition qualifies to be referred as pure function, isn’t it ?

1) For given set of i/p, same o/p is returned irrespective of time when function is called

2) It does not have any side effect

public int Sum(Func predicate, IEnumerable numbers){
int result = 0;
foreach(var item in list)
if(predicate(item)) result += item;
return result;
}

Example : Sum(x=>x%2==0, new List {1,2,3,4,5...100});

Reason I am asking this question is because I see almost every where people advising to avoid assignment operator and loops because it is imperative programming style. So what can go wrong with above example which makes use of loops and assignment operator in context of function programming ?