Buggy code:
public class LatentFactorModel extends AbstractModelLikelihood implements Citable { private final MatrixParameter data ; private final MatrixParameter factors ; private final MatrixParameter loadings ; private MatrixParameter sData ; private final DiagonalMatrix rowPrecision ; private final DiagonalMatrix colPrecision ; private final Parameter continuous ; private final boolean scaleData ; private final int dimFactors ; private final int dimData ; private final int nTaxa ; private boolean newModel ; private boolean likelihoodKnown = false ; private boolean isDataScaled = false ; private boolean storedLikelihoodKnown ; private boolean residualKnown = false ; private boolean LxFKnown = false ; private boolean storedResidualKnown = false ; private boolean storedLxFKnown ; private boolean traceKnown = false ; private boolean storedTraceKnown ; private boolean logDetColKnown = false ; private boolean storedLogDetColKnown ; private double trace ; private double storedTrace ; private double logLikelihood ; private double storedLogLikelihood ; private double logDetCol ; private double storedLogDetCol ; private boolean [ ] [ ] changed ; private boolean [ ] [ ] storedChanged ; private boolean RecomputeResiduals = false ; private Vector < Integer > changedValues ; private double [ ] residual ; private double [ ] LxF ; private double [ ] storedResidual ; private double [ ] storedLxF ; private double pathParameter = 1.0 ; public LatentFactorModel ( MatrixParameter data , MatrixParameter factors , MatrixParameter loadings , DiagonalMatrix rowPrecision , DiagonalMatrix colPrecision , boolean scaleData , Parameter continuous , boolean newModel ) { } public MatrixParameter getFactors ( ) { } public MatrixParameter getColumnPrecision ( ) { } public MatrixParameter getLoadings ( ) { } public MatrixParameter getData ( ) { } public Parameter returnIntermediate ( ) { } public MatrixParameter getScaledData ( ) { } public Parameter getContinuous ( ) { } public int getFactorDimension ( ) { } private void Multiply ( MatrixParameter Left , MatrixParameter Right , double [ ] answer ) { } private void add ( MatrixParameter Left , MatrixParameter Right , double [ ] answer ) { } private void subtract ( MatrixParameter Left , double [ ] Right , double [ ] answer ) { } private double TDTTrace ( double [ ] array , DiagonalMatrix middle ) { } private MatrixParameter computeScaledData ( ) { } private Matrix copy ( CompoundParameter parameter , int dimMajor , int dimMinor ) { } private void computeResiduals ( ) { } @ Override protected void handleModelChangedEvent ( Model model , Object object , int index ) { } @ Override protected void storeState ( ) { } @ Override protected void restoreState ( ) { } @ Override protected void acceptState ( ) { } @ Override protected void handleVariableChangedEvent ( Variable variable , int index , Parameter . ChangeType type ) { } @ Override public List < Citation > getCitations ( ) { } @ Override public Model getModel ( ) { } @ Override public double getLogLikelihood ( ) { } @ Override public void makeDirty ( ) { } private boolean checkLoadings ( ) { } private double calculateLogLikelihood ( ) { if ( ! ( residualKnown ) ) { computeResiduals ( ) ; } if ( ! ( logDetColKnown ) ) { logDetColKnown = true ; double product = 1 ; for ( int i = 0 ; i < ( colPrecision . getRowDimension ( ) ) ; i ++ ) { if ( ( continuous . getParameterValue ( i ) ) != 0 ) product *= colPrecision . getParameterValue ( i , i ) ; } logDetCol = StrictMath . log ( product ) ; } if ( ! ( traceKnown ) ) { traceKnown = true ; trace = TDTTrace ( residual , colPrecision ) ; } <START_BUG> return ( ( ( - 0.5 ) * ( trace ) ) + ( ( 0.5 * ( data . getColumnDimension ( ) ) ) * ( logDetCol ) ) ) - ( ( ( 0.5 * ( data . getRowDimension ( ) ) ) * ( data . getColumnDimension ( ) ) ) * ( Math . log ( ( 2.0 * ( StrictMath . PI ) ) ) ) ) ; <END_BUG> } }

Fix:
return ( ( ( ( - 0.5 ) * ( trace ) ) - ( ( 0.5 * ( data . getColumnDimension ( ) ) ) * ( logDetCol ) ) ) - ( 0.5 * ( data . getRowDimension ( ) ) ) ) - ( ( ( 0.5 * ( data . getRowDimension ( ) ) ) * ( data . getColumnDimension ( ) ) ) * ( Math . log ( ( 2.0 * ( StrictMath . PI ) ) ) ) ) ;