• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョンe09b1b8af6927299d26d39001e1c68416e110639 (tree)
日時2021-08-13 14:10:22
作者toshinagata1964 <toshinagata1964@a2be...>
コミッターtoshinagata1964

ログメッセージ

LAMatrix:SVD may cause random crashes. Fixed.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@628 a2be9bc6-48de-4e38-9406-05402d4bc13c

変更サマリ

差分

--- a/MolLib/Types.c
+++ b/MolLib/Types.c
@@ -587,12 +587,11 @@ LAMatrixSingularValueDecomposition(LAMatrix *matU, LAMatrix *matW, LAMatrix *mat
587587 n = mat->column;
588588 lda = m;
589589 num = (m < n ? m : n);
590- LAMatrixResize(matW, num, 1);
591- LAMatrixResize(matU, m, m);
592- LAMatrixResize(matV, n, n);
590+ if (matW->row != num || matW->column != 1 || matU->row != m || matU->column != m || matV->row != n || matV->column != n)
591+ return -1; /* Illegal dimension */
593592 matData = (__CLPK_doublereal *)malloc(sizeof(__CLPK_doublereal) * n * m);
594593 memmove(matData, mat->data, sizeof(__CLPK_doublereal) * n * m);
595- iwork = (__CLPK_integer *)malloc(sizeof(__CLPK_integer) * num);
594+ iwork = (__CLPK_integer *)malloc(sizeof(__CLPK_integer) * num * 8);
596595 lwork = -1;
597596 info = 0;
598597 dgesdd_("A", &m, &n, matData, &lda, matW->data, matU->data, &m, matV->data, &n, &workSize, &lwork, iwork, &info);
旧リポジトリブラウザで表示