You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: calculateCubicEquationRoots.m
    path of file: ./repos/NASTRAN_CoFE/nastran_cofe/cofe_models
    
    the code of the file until where you have to start completion: function [x1,x2,x3] = calculateCubicEquationRoots(a,b,c,d)
% Finds the roots of the general cubic equation ax^3+bx^2+cx+d=0. 
%
% INPUTS
%   a       Size-consistent n-dimensional coefficient arrays (real 
%   b       or complex) for independent cubic equation(s)
%   c        
%   d       f(x) = a.*x.^3 + b.*x.^2 + c.*x + d
%
% OUTPUTS
% 
%   x1      Roots (n-dimensional arrays). Each array contains one of the 
%   x2      three roots of the equation(s). Root are sorted in descending
%   x3      order such that
%                  real(x1) <= real(x2) <= real(x3)
%
% This function is designed for the unique situation where the user needs 
% to evaluate many independent cubic equations at once. Input coefficients 
% a, b, c, and d can be arrays of any dimension (including 3D and beyond). 
% Array processing is used exclusively for efficiency (no loops). Three
% roots of each equation are provided in separate output arrays.
%
% If the user requires the solution for a single cubic equation, the user 
% should consider using the MATLAB roots() fun
    
function is designed for the unique situation where the user needs 
% to evaluate many independent cubic equations at once. Input coefficients 
% a, b, c, and d can be arrays of any dimension (including 3D and beyond). 
% Array processing is used exclusively for efficiency (no loops). Three
% roots of each equation are provided in separate output arrays.
%
% If the user requires the solution for a single cubic equation, the user 
% should consider using the MATLAB roots() function instead of this 
% function. 
%
% One example where this functionality is useful is for structural 
% analysis: when calculating principal stresses for a 3D stress state for 
% many stress points and/or solution timesteps. Cubic equation coefficient 
% matrices can be assembled for all points and/or timesteps and principal 
% stresses can be determined calculated using array processing with this 
% function. The alternative of looping over every point/timestep would be 
% much less efficient.
%
% This function should only be used for strict cubic equations (a~=0).
% An error message will be provided if any(a(:)==0). In cases where inputs 
% approach a quadratic equation (a is numerical 0), one of the three roots 
% will approach numerical infinity. MATLAB roots() function has equivalent 
% behavior for near quadratics.

% Anthony Ricciardi
% June 2021

% input checks
if ~all([isfloat(a),isfloat(b),isfloat(c),isfloat(d)])
    error('cubicRoots:InputType','Inputs must be a floating point number array.')
end
sizeA=size(a);
if ~all([all(sizeA==size(b)),all(sizeA==size(c)),all(sizeA==size(d))])
    error('cubicRoots:InputSize','Input dimensions must be consistent')
end