Skip to content

Commit

Permalink
Merge branch 'v.dev' into v.docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bskinn committed May 16, 2016
2 parents 4ec3bf0 + 90e99c1 commit 03af063
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 111 deletions.
107 changes: 0 additions & 107 deletions source/Residual.bas
Expand Up @@ -23,113 +23,6 @@ Attribute VB_Name = "Residual"
Option Explicit
Option Base 1

'Public Function mtxOrthonormCheck(ByVal Matrix As Variant, _
' Optional ByVal orthonormTol As Double = DEF_Orthonorm_Tol) As VbTriState
' ' ##TODO## Convert to string return type!
'
' ' Columnwise check for orthonormality of a matrix
' ' Matrix does not have to be square
' ' Function assumes that both dimensions of 'matrix' are Base 1
' ' vbUseDefault return indicates invalid 'matrix' argument passed
'
' Dim iter As Long, iter2 As Long
' Dim vecs As Variant
'
' ' Initialize return to success; any non-orthonorm result will crash to fail
' mtxOrthonormCheck = vbTrue
'
' ' arrayify input if needed
' Matrix = arrayify(Matrix)
' If IsEmpty(Matrix) Then
' mtxOrthonormCheck = vbUseDefault
' Exit Function
' End If
'
' ' Perform check
' For iter = 1 To UBound(Matrix, 2)
' For iter2 = iter To UBound(Matrix, 2)
' If Abs(ProdScal(MCol(Matrix, iter), MCol(Matrix, iter2))) - _
' CDbl(deltaFxn(iter, iter2)) > orthonormTol Then
' mtxOrthonormCheck = vbFalse
' Exit Function
' End If
' Next iter2
' Next iter
'
'End Function
'
'Public Function vecsOrthonormCheck(ParamArray vecs()) As VbTriState
' ' ##TODO## CONVERT TO STRING RETURN TYPE
' Dim maxVecIdx As Long, vecLength As Long
' Dim iter As Long, iter2 As Long
' Dim orthonormTol As Double
'
' ' ParamArray is always Base 0, regardless of Option Base setting
' ' A single double value can be passed as the last argument to adjust
' ' the orthonormality tolerance. Otherwise, the default value is used.
'
' ' No-good return if no argument passed
' If IsMissing(vecs) Then
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
'
' ' Store the index of the last element in the vector array
' maxVecIdx = UBound(vecs)
'
' ' Check if the last element is a non-array single value. If so, treat as the tolerance
' ' and decrement the max vector index (crashing out if this leaves no vectors).
' ' Otherwise, set the default tolerance.
' If IsNumeric(vecs(maxVecIdx)) Then
' orthonormTol = CDbl(vecs(maxVecIdx))
' If maxVecIdx > 0 Then
' maxVecIdx = maxVecIdx - 1
' Else
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
' Else
' orthonormTol = DEF_Orthonorm_Tol
' End If
'
' ' arrayify all of the vectors, dumping out if any arguments aren't workable
' For iter = 0 To maxVecIdx
' vecs(iter) = arrayify(vecs(iter))
' If IsEmpty(vecs(iter)) Then
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
' Next iter
'
' ' Store the length of the first vector
' vecLength = UBound(vecs(0), 1)
'
' ' Check to ensure all vectors are this length, crashing out if not
' For iter = 0 To maxVecIdx
' If UBound(vecs(iter), 1) <> vecLength Then
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
' Next iter
'
' ' Initialize the success return
' vecsOrthonormCheck = vbTrue
'
' ' Loop through the vectors, confirming orthonormality.
' ' If any fail, set the fail return and dump from function.
' For iter = 0 To maxVecIdx
' For iter2 = iter To maxVecIdx
' If (Abs(ProdScal(vecs(iter), vecs(iter2))) - deltaFxn(iter, iter2)) _
' > CDbl(orthonormTol) Then
' vecsOrthonormCheck = vbFalse
' Exit Function
' End If
' Next iter2
' Next iter
'
'End Function



Public Function rotConstUnitName(rcuType As RotConstUnits) As String

Expand Down
52 changes: 52 additions & 0 deletions source/Util_Matrix.bas
Expand Up @@ -429,3 +429,55 @@ Public Function mTranspose(ByVal mtx As Variant) As Variant

End Function

' Function mTrace TODO
' Function mGetDiag TODO
' Function mExciseRow TODO
' Function mExciseCol TODO
' Function mDet TODO
' Function mDims TODO --> Vector
' Function mRows TODO --> Long
' Function mCols TODO --> Long
' Function mAdd TODO
' Function mSubtract TODO
' Function mMultiply TODO
' Function mDivide TODO
' Function mRaise TODO
' Function mPlusVal TODO
' Function mTimesVal TODO
' Function mPowerVal TODO

'Public Function mtxOrthonormCheck(ByVal Matrix As Variant, _
' Optional ByVal orthonormTol As Double = DEF_Orthonorm_Tol) As VbTriState
' ' ##TODO## Convert to string return type!
'
' ' Columnwise check for orthonormality of a matrix
' ' Matrix does not have to be square
' ' Function assumes that both dimensions of 'matrix' are Base 1
' ' vbUseDefault return indicates invalid 'matrix' argument passed
'
' Dim iter As Long, iter2 As Long
' Dim vecs As Variant
'
' ' Initialize return to success; any non-orthonorm result will crash to fail
' mtxOrthonormCheck = vbTrue
'
' ' arrayify input if needed
' Matrix = arrayify(Matrix)
' If IsEmpty(Matrix) Then
' mtxOrthonormCheck = vbUseDefault
' Exit Function
' End If
'
' ' Perform check
' For iter = 1 To UBound(Matrix, 2)
' For iter2 = iter To UBound(Matrix, 2)
' If Abs(ProdScal(MCol(Matrix, iter), MCol(Matrix, iter2))) - _
' CDbl(deltaFxn(iter, iter2)) > orthonormTol Then
' mtxOrthonormCheck = vbFalse
' Exit Function
' End If
' Next iter2
' Next iter
'
'End Function

86 changes: 82 additions & 4 deletions source/Util_Vector.bas
@@ -1,7 +1,8 @@
Attribute VB_Name = "Util_Vector"
'-------------------------------------------------------------------------------
' Name: Util_Vector (Module)
' Purpose: Helper functions for ORCA Importer taking 1-D array inputs
' Purpose: Helper functions for ORCA Importer taking 1-D array or
' Nx1/1xN 2-D array inputs
'
' Author: Brian Skinn
' bskinn@alum.mit.edu
Expand Down Expand Up @@ -262,11 +263,11 @@ Public Function vDot(ByVal vec1 As Variant, ByVal vec2 As Variant) As Variant

End Function

' Function vProj
' Function vProj TODO

' Function vRej
' Function vRej TODO

' Function vCross
' Function vCross TODO

Public Function vNorm(ByVal vec As Variant) As Variant
' Return the 2-norm of the input vector. Accepts both 1-D and
Expand Down Expand Up @@ -343,3 +344,80 @@ Public Function vNormalize(ByVal vec As Variant) As Variant
End If

End Function

' Function vOrthoBasis TODO
' Function vLength TODO
' Function vAngle TODO

'Public Function vecsOrthonormCheck(ParamArray vecs()) As VbTriState
' ' ##TODO## CONVERT TO STRING RETURN TYPE
' Dim maxVecIdx As Long, vecLength As Long
' Dim iter As Long, iter2 As Long
' Dim orthonormTol As Double
'
' ' ParamArray is always Base 0, regardless of Option Base setting
' ' A single double value can be passed as the last argument to adjust
' ' the orthonormality tolerance. Otherwise, the default value is used.
'
' ' No-good return if no argument passed
' If IsMissing(vecs) Then
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
'
' ' Store the index of the last element in the vector array
' maxVecIdx = UBound(vecs)
'
' ' Check if the last element is a non-array single value. If so, treat as the tolerance
' ' and decrement the max vector index (crashing out if this leaves no vectors).
' ' Otherwise, set the default tolerance.
' If IsNumeric(vecs(maxVecIdx)) Then
' orthonormTol = CDbl(vecs(maxVecIdx))
' If maxVecIdx > 0 Then
' maxVecIdx = maxVecIdx - 1
' Else
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
' Else
' orthonormTol = DEF_Orthonorm_Tol
' End If
'
' ' arrayify all of the vectors, dumping out if any arguments aren't workable
' For iter = 0 To maxVecIdx
' vecs(iter) = arrayify(vecs(iter))
' If IsEmpty(vecs(iter)) Then
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
' Next iter
'
' ' Store the length of the first vector
' vecLength = UBound(vecs(0), 1)
'
' ' Check to ensure all vectors are this length, crashing out if not
' For iter = 0 To maxVecIdx
' If UBound(vecs(iter), 1) <> vecLength Then
' vecsOrthonormCheck = vbUseDefault
' Exit Function
' End If
' Next iter
'
' ' Initialize the success return
' vecsOrthonormCheck = vbTrue
'
' ' Loop through the vectors, confirming orthonormality.
' ' If any fail, set the fail return and dump from function.
' For iter = 0 To maxVecIdx
' For iter2 = iter To maxVecIdx
' If (Abs(ProdScal(vecs(iter), vecs(iter2))) - deltaFxn(iter, iter2)) _
' > CDbl(orthonormTol) Then
' vecsOrthonormCheck = vbFalse
' Exit Function
' End If
' Next iter2
' Next iter
'
'End Function


0 comments on commit 03af063

Please sign in to comment.