FullMatrix version are now all visible in lib. Now need FullColumn etc to work.

This commit is contained in:
John Dupuy
2023-11-05 01:07:12 -05:00
parent 8408c2245e
commit ede688e7da
28 changed files with 939 additions and 1104 deletions

View File

@@ -5,19 +5,301 @@ project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibo
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(GNUInstallDirs)
set(ONDSELSOLVER_HEADERS
OndselSolver/AbsConstraint.h
OndselSolver/Abs.h
OndselSolver/AccICKineNewtonRaphson.h
OndselSolver/AccICNewtonRaphson.h
OndselSolver/AccKineNewtonRaphson.h
OndselSolver/AccNewtonRaphson.h
OndselSolver/AngleJoint.h
OndselSolver/AngleZIecJec.h
OndselSolver/AngleZIeqcJec.h
OndselSolver/AngleZIeqcJeqc.h
OndselSolver/AnyGeneralSpline.h
OndselSolver/AnyPosICNewtonRaphson.h
OndselSolver/APIExport.h
OndselSolver/ArcSine.h
OndselSolver/ArcTan2.h
OndselSolver/ArcTan.h
OndselSolver/Array.h
OndselSolver/ASMTAnimationParameters.h
OndselSolver/ASMTAssembly.h
OndselSolver/ASMTConstantGravity.h
OndselSolver/ASMTConstraintSet.h
OndselSolver/ASMTCylindricalJoint.h
OndselSolver/ASMTExtrusion.h
OndselSolver/ASMTFixedJoint.h
OndselSolver/ASMTForceTorque.h
OndselSolver/ASMTGeneralMotion.h
OndselSolver/ASMTItem.h
OndselSolver/ASMTItemIJ.h
OndselSolver/ASMTJoint.h
OndselSolver/ASMTKinematicIJ.h
OndselSolver/ASMTMarker.h
OndselSolver/ASMTMotion.h
OndselSolver/ASMTNoRotationJoint.h
OndselSolver/ASMTPart.h
OndselSolver/ASMTPointInLineJoint.h
OndselSolver/ASMTPointInPlaneJoint.h
OndselSolver/ASMTPrincipalMassMarker.h
OndselSolver/ASMTRefCurve.h
OndselSolver/ASMTRefItem.h
OndselSolver/ASMTRefPoint.h
OndselSolver/ASMTRefSurface.h
OndselSolver/ASMTRevoluteJoint.h
OndselSolver/ASMTRotationalMotion.h
OndselSolver/ASMTSimulationParameters.h
OndselSolver/ASMTSpatialContainer.h
OndselSolver/ASMTSpatialItem.h
OndselSolver/ASMTSphericalJoint.h
OndselSolver/ASMTTime.h
OndselSolver/ASMTTranslationalJoint.h
OndselSolver/ASMTTranslationalMotion.h
OndselSolver/ASMTUniversalJoint.h
OndselSolver/AtPointConstraintIJ.h
OndselSolver/AtPointConstraintIqcJc.h
OndselSolver/AtPointConstraintIqcJqc.h
OndselSolver/AtPointConstraintIqctJqc.h
OndselSolver/AtPointJoint.h
OndselSolver/BasicIntegrator.h
OndselSolver/BasicQuasiIntegrator.h
OndselSolver/BasicUserFunction.h
OndselSolver/CADSystem.h
OndselSolver/CartesianFrame.h
OndselSolver/CompoundJoint.h
OndselSolver/ConstantGravity.h
OndselSolver/Constant.h
OndselSolver/ConstantVelocityJoint.h
OndselSolver/Constraint.h
OndselSolver/ConstraintIJ.h
OndselSolver/ConstVelConstraintIJ.h
OndselSolver/ConstVelConstraintIqcJc.h
OndselSolver/ConstVelConstraintIqcJqc.h
OndselSolver/corecrt_math_defines.h
OndselSolver/Cosine.h
OndselSolver/CREATE.h
OndselSolver/CylindricalJoint.h
OndselSolver/CylSphJoint.h
OndselSolver/DiagonalMatrix.h
OndselSolver/DifferenceOperator.h
OndselSolver/DifferentiatedGeneralSpline.h
OndselSolver/DirectionCosineConstraintIJ.h
OndselSolver/DirectionCosineConstraintIqcJc.h
OndselSolver/DirectionCosineConstraintIqcJqc.h
OndselSolver/DirectionCosineConstraintIqctJqc.h
OndselSolver/DirectionCosineIecJec.h
OndselSolver/DirectionCosineIeqcJec.h
OndselSolver/DirectionCosineIeqcJeqc.h
OndselSolver/DirectionCosineIeqctJeqc.h
OndselSolver/DiscontinuityError.h
OndselSolver/DispCompIecJecIe.h
OndselSolver/DispCompIecJecKec.h
OndselSolver/DispCompIecJecKeqc.h
OndselSolver/DispCompIecJecO.h
OndselSolver/DispCompIeqcJecIe.h
OndselSolver/DispCompIeqcJecKeqc.h
OndselSolver/DispCompIeqcJecO.h
OndselSolver/DispCompIeqcJeqcIe.h
OndselSolver/DispCompIeqcJeqcKeqc.h
OndselSolver/DispCompIeqcJeqcKeqct.h
OndselSolver/DispCompIeqcJeqcO.h
OndselSolver/DispCompIeqctJeqcIe.h
OndselSolver/DispCompIeqctJeqcKeqct.h
OndselSolver/DispCompIeqctJeqcO.h
OndselSolver/DistanceConstraintIJ.h
OndselSolver/DistanceConstraintIqcJc.h
OndselSolver/DistanceConstraintIqcJqc.h
OndselSolver/DistanceConstraintIqctJqc.h
OndselSolver/DistancexyConstraintIJ.h
OndselSolver/DistancexyConstraintIqcJc.h
OndselSolver/DistancexyConstraintIqcJqc.h
OndselSolver/DistIecJec.h
OndselSolver/DistIeqcJec.h
OndselSolver/DistIeqcJeqc.h
OndselSolver/DistIeqctJeqc.h
OndselSolver/DistxyIecJec.h
OndselSolver/DistxyIeqcJec.h
OndselSolver/DistxyIeqcJeqc.h
OndselSolver/DistxyIeqctJeqc.h
OndselSolver/EigenDecomposition.h
OndselSolver/EndFramec.h
OndselSolver/EndFrameqc.h
OndselSolver/EndFrameqct2.h
OndselSolver/EndFrameqct.h
OndselSolver/enum.h
OndselSolver/EulerAnglesDDot.h
OndselSolver/EulerAnglesDot.h
OndselSolver/EulerAngles.h
OndselSolver/EulerAngleszxzDDot.h
OndselSolver/EulerAngleszxzDot.h
OndselSolver/EulerAngleszxz.h
OndselSolver/EulerArray.h
OndselSolver/EulerConstraint.h
OndselSolver/EulerParametersDDot.h
OndselSolver/EulerParametersDot.h
OndselSolver/EulerParameters.h
OndselSolver/Exponential.h
OndselSolver/ExpressionX.h
OndselSolver/ExternalSystem.h
OndselSolver/FixedJoint.h
OndselSolver/ForceTorqueData.h
OndselSolver/ForceTorqueItem.h
OndselSolver/FullColumn.h
OndselSolver/FullMatrix.h
OndselSolver/FullMotion.h
OndselSolver/FullRow.h
OndselSolver/FullVector.h
OndselSolver/FunctionFromData.h
OndselSolver/Function.h
OndselSolver/FunctionWithManyArgs.h
OndselSolver/FunctionXcParameter.h
OndselSolver/FunctionX.h
OndselSolver/FunctionXY.h
OndselSolver/GearConstraintIJ.h
OndselSolver/GearConstraintIqcJc.h
OndselSolver/GearConstraintIqcJqc.h
OndselSolver/GearJoint.h
OndselSolver/GEFullMatFullPv.h
OndselSolver/GEFullMat.h
OndselSolver/GEFullMatParPv.h
OndselSolver/GeneralSpline.h
OndselSolver/GESpMatFullPv.h
OndselSolver/GESpMatFullPvPosIC.h
OndselSolver/GESpMat.h
OndselSolver/GESpMatParPv.h
OndselSolver/GESpMatParPvMarkoFast.h
OndselSolver/GESpMatParPvMarko.h
OndselSolver/GESpMatParPvPrecise.h
OndselSolver/ICKineIntegrator.h
OndselSolver/IndependentVariable.h
OndselSolver/InLineJoint.h
OndselSolver/InPlaneJoint.h
OndselSolver/Integrator.h
OndselSolver/IntegratorInterface.h
OndselSolver/Item.h
OndselSolver/Joint.h
OndselSolver/KineIntegrator.h
OndselSolver/KinematicIeJe.h
OndselSolver/LDUFullMat.h
OndselSolver/LDUFullMatParPv.h
OndselSolver/LDUSpMat.h
OndselSolver/LDUSpMatParPv.h
OndselSolver/LDUSpMatParPvMarko.h
OndselSolver/LDUSpMatParPvPrecise.h
OndselSolver/LinearMultiStepMethod.h
OndselSolver/LineInPlaneJoint.h
OndselSolver/Ln.h
OndselSolver/Log10.h
OndselSolver/LogN.h
OndselSolver/MarkerFrame.h
OndselSolver/MatrixDecomposition.h
OndselSolver/MatrixGaussElimination.h
OndselSolver/MatrixLDU.h
OndselSolver/MatrixSolver.h
OndselSolver/MaximumIterationError.h
OndselSolver/MbdMath.h
OndselSolver/MBDynBlock.h
OndselSolver/MBDynBody.h
OndselSolver/MBDynControlData.h
OndselSolver/MBDynData.h
OndselSolver/MBDynElement.h
OndselSolver/MBDynInitialValue.h
OndselSolver/MBDynItem.h
OndselSolver/MBDynJoint.h
OndselSolver/MBDynMarker.h
OndselSolver/MBDynNode.h
OndselSolver/MBDynReference.h
OndselSolver/MBDynStructural.h
OndselSolver/MBDynSystem.h
OndselSolver/MomentOfInertiaSolver.h
OndselSolver/Negative.h
OndselSolver/NewtonRaphsonError.h
OndselSolver/NewtonRaphson.h
OndselSolver/NoRotationJoint.h
OndselSolver/NotKinematicError.h
OndselSolver/Numeric.h
OndselSolver/OndselSolver.h
OndselSolver/OrbitAnglezIecJec.h
OndselSolver/OrbitAnglezIeqcJec.h
OndselSolver/OrbitAnglezIeqcJeqc.h
OndselSolver/Orientation.h
OndselSolver/ParallelAxesJoint.h
OndselSolver/PartFrame.h
OndselSolver/Part.h
OndselSolver/PerpendicularJoint.h
OndselSolver/PlanarJoint.h
OndselSolver/PointInLineJoint.h
OndselSolver/PointInPlaneJoint.h
OndselSolver/PosICKineNewtonRaphson.h
OndselSolver/PosICNewtonRaphson.h
OndselSolver/PosKineNewtonRaphson.h
OndselSolver/PosNewtonRaphson.h
OndselSolver/PosVelAccData.h
OndselSolver/Power.h
OndselSolver/PrescribedMotion.h
OndselSolver/Product.h
OndselSolver/QuasiIntegrator.h
OndselSolver/RackPinConstraintIJ.h
OndselSolver/RackPinConstraintIqcJc.h
OndselSolver/RackPinConstraintIqcJqc.h
OndselSolver/RackPinJoint.h
OndselSolver/Reciprocal.h
OndselSolver/RedundantConstraint.h
OndselSolver/resource.h
OndselSolver/RevCylJoint.h
OndselSolver/RevoluteJoint.h
OndselSolver/RowTypeMatrix.h
OndselSolver/ScalarNewtonRaphson.h
OndselSolver/ScrewConstraintIJ.h
OndselSolver/ScrewConstraintIqcJc.h
OndselSolver/ScrewConstraintIqcJqc.h
OndselSolver/ScrewJoint.h
OndselSolver/SimulationStoppingError.h
OndselSolver/Sine.h
OndselSolver/SingularMatrixError.h
OndselSolver/Solver.h
OndselSolver/SparseColumn.h
OndselSolver/SparseMatrix.h
OndselSolver/SparseRow.h
OndselSolver/SparseVector.h
OndselSolver/SphericalJoint.h
OndselSolver/SphSphJoint.h
OndselSolver/StableBackwardDifference.h
OndselSolver/StateData.h
OndselSolver/Sum.h
OndselSolver/Symbolic.h
OndselSolver/SymbolicParser.h
OndselSolver/SyntaxError.h
OndselSolver/System.h
OndselSolver/SystemNewtonRaphson.h
OndselSolver/SystemSolver.h
OndselSolver/Time.h
OndselSolver/TooManyTriesError.h
OndselSolver/TooSmallStepSizeError.h
OndselSolver/TranslationalJoint.h
OndselSolver/TranslationConstraintIJ.h
OndselSolver/TranslationConstraintIqcJc.h
OndselSolver/TranslationConstraintIqcJqc.h
OndselSolver/TranslationConstraintIqctJqc.h
OndselSolver/Translation.h
OndselSolver/Units.h
OndselSolver/UniversalJoint.h
OndselSolver/UserFunction.h
OndselSolver/Variable.h
OndselSolver/VectorNewtonRaphson.h
OndselSolver/VelICKineSolver.h
OndselSolver/VelICSolver.h
OndselSolver/VelKineSolver.h
OndselSolver/VelSolver.h
OndselSolver/ZRotation.h
OndselSolver/ZTranslation.h
)
add_library(OndselSolver STATIC)
set(ONDSELSOLVER_SRC
OndselSolver/Array.cpp
OndselSolver/FullVector.cpp
OndselSolver/RowTypeMatrix.cpp
OndselSolver/FullColumn.cpp
set(ONDSELSOLVER_EXPORT
OndselSolver/FullMatrix.cpp
OndselSolver/FullRow.cpp
OndselSolver/Abs.cpp
OndselSolver/AbsConstraint.cpp
OndselSolver/Abs.cpp
OndselSolver/AccICKineNewtonRaphson.cpp
OndselSolver/AccICNewtonRaphson.cpp
OndselSolver/AccKineNewtonRaphson.cpp
@@ -29,8 +311,9 @@ set(ONDSELSOLVER_SRC
OndselSolver/AnyGeneralSpline.cpp
OndselSolver/AnyPosICNewtonRaphson.cpp
OndselSolver/ArcSine.cpp
OndselSolver/ArcTan.cpp
OndselSolver/ArcTan2.cpp
OndselSolver/ArcTan.cpp
OndselSolver/Array.cpp
OndselSolver/ASMTAnimationParameters.cpp
OndselSolver/ASMTAssembly.cpp
OndselSolver/ASMTConstantGravity.cpp
@@ -132,8 +415,8 @@ set(ONDSELSOLVER_SRC
OndselSolver/EigenDecomposition.cpp
OndselSolver/EndFramec.cpp
OndselSolver/EndFrameqc.cpp
OndselSolver/EndFrameqct.cpp
OndselSolver/EndFrameqct2.cpp
OndselSolver/EndFrameqct.cpp
OndselSolver/EulerAngles.cpp
OndselSolver/EulerAnglesDDot.cpp
OndselSolver/EulerAnglesDot.cpp
@@ -151,12 +434,15 @@ set(ONDSELSOLVER_SRC
OndselSolver/FixedJoint.cpp
OndselSolver/ForceTorqueData.cpp
OndselSolver/ForceTorqueItem.cpp
OndselSolver/FullColumn.cpp
OndselSolver/FullMotion.cpp
OndselSolver/FullRow.cpp
OndselSolver/FullVector.cpp
OndselSolver/Function.cpp
OndselSolver/FunctionFromData.cpp
OndselSolver/FunctionWithManyArgs.cpp
OndselSolver/FunctionX.cpp
OndselSolver/FunctionXcParameter.cpp
OndselSolver/FunctionX.cpp
OndselSolver/FunctionXY.cpp
OndselSolver/GearConstraintIJ.cpp
OndselSolver/GearConstraintIqcJc.cpp
@@ -221,6 +507,7 @@ set(ONDSELSOLVER_SRC
OndselSolver/NoRotationJoint.cpp
OndselSolver/NotKinematicError.cpp
OndselSolver/Numeric.cpp
OndselSolver/OndselSolver.cpp
OndselSolver/OrbitAnglezIecJec.cpp
OndselSolver/OrbitAnglezIeqcJec.cpp
OndselSolver/OrbitAnglezIeqcJeqc.cpp
@@ -249,6 +536,7 @@ set(ONDSELSOLVER_SRC
OndselSolver/RedundantConstraint.cpp
OndselSolver/RevCylJoint.cpp
OndselSolver/RevoluteJoint.cpp
OndselSolver/RowTypeMatrix.cpp
OndselSolver/ScalarNewtonRaphson.cpp
OndselSolver/ScrewConstraintIJ.cpp
OndselSolver/ScrewConstraintIqcJc.cpp
@@ -276,12 +564,12 @@ set(ONDSELSOLVER_SRC
OndselSolver/Time.cpp
OndselSolver/TooManyTriesError.cpp
OndselSolver/TooSmallStepSizeError.cpp
OndselSolver/Translation.cpp
OndselSolver/TranslationalJoint.cpp
OndselSolver/TranslationConstraintIJ.cpp
OndselSolver/TranslationConstraintIqcJc.cpp
OndselSolver/TranslationConstraintIqcJqc.cpp
OndselSolver/TranslationConstraintIqctJqc.cpp
OndselSolver/Translation.cpp
OndselSolver/Units.cpp
OndselSolver/UniversalJoint.cpp
OndselSolver/UserFunction.cpp
@@ -295,310 +583,25 @@ set(ONDSELSOLVER_SRC
OndselSolver/ZTranslation.cpp
)
set(ONDSELSOLVER_HEADERS
OndselSolver/Array.h
OndselSolver/FullVector.h
OndselSolver/RowTypeMatrix.h
OndselSolver/FullRow.h
OndselSolver/FullColumn.h
OndselSolver/FullMatrix.h
OndselSolver/Abs.h
OndselSolver/AbsConstraint.h
OndselSolver/AccICKineNewtonRaphson.h
OndselSolver/AccICNewtonRaphson.h
OndselSolver/AccKineNewtonRaphson.h
OndselSolver/AccNewtonRaphson.h
OndselSolver/AngleJoint.h
OndselSolver/AngleZIecJec.h
OndselSolver/AngleZIeqcJec.h
OndselSolver/AngleZIeqcJeqc.h
OndselSolver/AnyGeneralSpline.h
OndselSolver/AnyPosICNewtonRaphson.h
OndselSolver/APIExport.h
OndselSolver/ArcSine.h
OndselSolver/ArcTan.h
OndselSolver/ArcTan2.h
OndselSolver/ASMTAnimationParameters.h
OndselSolver/ASMTAssembly.h
OndselSolver/ASMTConstantGravity.h
OndselSolver/ASMTConstraintSet.h
OndselSolver/ASMTCylindricalJoint.h
OndselSolver/ASMTExtrusion.h
OndselSolver/ASMTFixedJoint.h
OndselSolver/ASMTForceTorque.h
OndselSolver/ASMTGeneralMotion.h
OndselSolver/ASMTItem.h
OndselSolver/ASMTItemIJ.h
OndselSolver/ASMTJoint.h
OndselSolver/ASMTKinematicIJ.h
OndselSolver/ASMTMarker.h
OndselSolver/ASMTMotion.h
OndselSolver/ASMTNoRotationJoint.h
OndselSolver/ASMTPart.h
OndselSolver/ASMTPointInLineJoint.h
OndselSolver/ASMTPointInPlaneJoint.h
OndselSolver/ASMTPrincipalMassMarker.h
OndselSolver/ASMTRefCurve.h
OndselSolver/ASMTRefItem.h
OndselSolver/ASMTRefPoint.h
OndselSolver/ASMTRefSurface.h
OndselSolver/ASMTRevoluteJoint.h
OndselSolver/ASMTRotationalMotion.h
OndselSolver/ASMTSimulationParameters.h
OndselSolver/ASMTSpatialContainer.h
OndselSolver/ASMTSpatialItem.h
OndselSolver/ASMTSphericalJoint.h
OndselSolver/ASMTTime.h
OndselSolver/ASMTTranslationalJoint.h
OndselSolver/ASMTTranslationalMotion.h
OndselSolver/ASMTUniversalJoint.h
OndselSolver/AtPointConstraintIJ.h
OndselSolver/AtPointConstraintIqcJc.h
OndselSolver/AtPointConstraintIqcJqc.h
OndselSolver/AtPointConstraintIqctJqc.h
OndselSolver/AtPointJoint.h
OndselSolver/BasicIntegrator.h
OndselSolver/BasicQuasiIntegrator.h
OndselSolver/BasicUserFunction.h
OndselSolver/CADSystem.h
OndselSolver/CartesianFrame.h
OndselSolver/CompoundJoint.h
OndselSolver/Constant.h
OndselSolver/ConstantGravity.h
OndselSolver/ConstantVelocityJoint.h
OndselSolver/Constraint.h
OndselSolver/ConstraintIJ.h
OndselSolver/ConstVelConstraintIJ.h
OndselSolver/ConstVelConstraintIqcJc.h
OndselSolver/ConstVelConstraintIqcJqc.h
OndselSolver/corecrt_math_defines.h
OndselSolver/Cosine.h
OndselSolver/CREATE.h
OndselSolver/CylindricalJoint.h
OndselSolver/CylSphJoint.h
OndselSolver/DiagonalMatrix.h
OndselSolver/DifferenceOperator.h
OndselSolver/DifferentiatedGeneralSpline.h
OndselSolver/DirectionCosineConstraintIJ.h
OndselSolver/DirectionCosineConstraintIqcJc.h
OndselSolver/DirectionCosineConstraintIqcJqc.h
OndselSolver/DirectionCosineConstraintIqctJqc.h
OndselSolver/DirectionCosineIecJec.h
OndselSolver/DirectionCosineIeqcJec.h
OndselSolver/DirectionCosineIeqcJeqc.h
OndselSolver/DirectionCosineIeqctJeqc.h
OndselSolver/DiscontinuityError.h
OndselSolver/DispCompIecJecIe.h
OndselSolver/DispCompIecJecKec.h
OndselSolver/DispCompIecJecKeqc.h
OndselSolver/DispCompIecJecO.h
OndselSolver/DispCompIeqcJecIe.h
OndselSolver/DispCompIeqcJecKeqc.h
OndselSolver/DispCompIeqcJecO.h
OndselSolver/DispCompIeqcJeqcIe.h
OndselSolver/DispCompIeqcJeqcKeqc.h
OndselSolver/DispCompIeqcJeqcKeqct.h
OndselSolver/DispCompIeqcJeqcO.h
OndselSolver/DispCompIeqctJeqcIe.h
OndselSolver/DispCompIeqctJeqcKeqct.h
OndselSolver/DispCompIeqctJeqcO.h
OndselSolver/DistanceConstraintIJ.h
OndselSolver/DistanceConstraintIqcJc.h
OndselSolver/DistanceConstraintIqcJqc.h
OndselSolver/DistanceConstraintIqctJqc.h
OndselSolver/DistancexyConstraintIJ.h
OndselSolver/DistancexyConstraintIqcJc.h
OndselSolver/DistancexyConstraintIqcJqc.h
OndselSolver/DistIecJec.h
OndselSolver/DistIeqcJec.h
OndselSolver/DistIeqcJeqc.h
OndselSolver/DistIeqctJeqc.h
OndselSolver/DistxyIecJec.h
OndselSolver/DistxyIeqcJec.h
OndselSolver/DistxyIeqcJeqc.h
OndselSolver/DistxyIeqctJeqc.h
OndselSolver/EigenDecomposition.h
OndselSolver/EndFramec.h
OndselSolver/EndFrameqc.h
OndselSolver/EndFrameqct.h
OndselSolver/EndFrameqct2.h
OndselSolver/enum.h
OndselSolver/EulerAngles.h
OndselSolver/EulerAnglesDDot.h
OndselSolver/EulerAnglesDot.h
OndselSolver/EulerAngleszxz.h
OndselSolver/EulerAngleszxzDDot.h
OndselSolver/EulerAngleszxzDot.h
OndselSolver/EulerArray.h
OndselSolver/EulerConstraint.h
OndselSolver/EulerParameters.h
OndselSolver/EulerParametersDDot.h
OndselSolver/EulerParametersDot.h
OndselSolver/Exponential.h
OndselSolver/ExpressionX.h
OndselSolver/ExternalSystem.h
OndselSolver/FixedJoint.h
OndselSolver/ForceTorqueData.h
OndselSolver/ForceTorqueItem.h
OndselSolver/FullMotion.h
OndselSolver/FullRow.h
OndselSolver/Function.h
OndselSolver/FunctionFromData.h
OndselSolver/FunctionWithManyArgs.h
OndselSolver/FunctionX.h
OndselSolver/FunctionXcParameter.h
OndselSolver/FunctionXY.h
OndselSolver/GearConstraintIJ.h
OndselSolver/GearConstraintIqcJc.h
OndselSolver/GearConstraintIqcJqc.h
OndselSolver/GearJoint.h
OndselSolver/GEFullMat.h
OndselSolver/GEFullMatFullPv.h
OndselSolver/GEFullMatParPv.h
OndselSolver/GeneralSpline.h
OndselSolver/GESpMat.h
OndselSolver/GESpMatFullPv.h
OndselSolver/GESpMatFullPvPosIC.h
OndselSolver/GESpMatParPv.h
OndselSolver/GESpMatParPvMarko.h
OndselSolver/GESpMatParPvMarkoFast.h
OndselSolver/GESpMatParPvPrecise.h
OndselSolver/ICKineIntegrator.h
OndselSolver/IndependentVariable.h
OndselSolver/InLineJoint.h
OndselSolver/InPlaneJoint.h
OndselSolver/Integrator.h
OndselSolver/IntegratorInterface.h
OndselSolver/Item.h
OndselSolver/Joint.h
OndselSolver/KineIntegrator.h
OndselSolver/KinematicIeJe.h
OndselSolver/LDUFullMat.h
OndselSolver/LDUFullMatParPv.h
OndselSolver/LDUSpMat.h
OndselSolver/LDUSpMatParPv.h
OndselSolver/LDUSpMatParPvMarko.h
OndselSolver/LDUSpMatParPvPrecise.h
OndselSolver/LinearMultiStepMethod.h
OndselSolver/LineInPlaneJoint.h
OndselSolver/Ln.h
OndselSolver/Log10.h
OndselSolver/LogN.h
OndselSolver/MarkerFrame.h
OndselSolver/MatrixDecomposition.h
OndselSolver/MatrixGaussElimination.h
OndselSolver/MatrixLDU.h
OndselSolver/MatrixSolver.h
OndselSolver/MaximumIterationError.h
OndselSolver/MbdMath.h
OndselSolver/MBDynBlock.h
OndselSolver/MBDynBody.h
OndselSolver/MBDynControlData.h
OndselSolver/MBDynData.h
OndselSolver/MBDynElement.h
OndselSolver/MBDynInitialValue.h
OndselSolver/MBDynItem.h
OndselSolver/MBDynJoint.h
OndselSolver/MBDynMarker.h
OndselSolver/MBDynNode.h
OndselSolver/MBDynReference.h
OndselSolver/MBDynStructural.h
OndselSolver/MBDynSystem.h
OndselSolver/MomentOfInertiaSolver.h
OndselSolver/Negative.h
OndselSolver/NewtonRaphson.h
OndselSolver/NewtonRaphsonError.h
OndselSolver/NoRotationJoint.h
OndselSolver/NotKinematicError.h
OndselSolver/Numeric.h
OndselSolver/OrbitAnglezIecJec.h
OndselSolver/OrbitAnglezIeqcJec.h
OndselSolver/OrbitAnglezIeqcJeqc.h
OndselSolver/Orientation.h
OndselSolver/ParallelAxesJoint.h
OndselSolver/Part.h
OndselSolver/PartFrame.h
OndselSolver/PerpendicularJoint.h
OndselSolver/PlanarJoint.h
OndselSolver/PointInLineJoint.h
OndselSolver/PointInPlaneJoint.h
OndselSolver/PosICKineNewtonRaphson.h
OndselSolver/PosICNewtonRaphson.h
OndselSolver/PosKineNewtonRaphson.h
OndselSolver/PosNewtonRaphson.h
OndselSolver/PosVelAccData.h
OndselSolver/Power.h
OndselSolver/PrescribedMotion.h
OndselSolver/Product.h
OndselSolver/QuasiIntegrator.h
OndselSolver/RackPinConstraintIJ.h
OndselSolver/RackPinConstraintIqcJc.h
OndselSolver/RackPinConstraintIqcJqc.h
OndselSolver/RackPinJoint.h
OndselSolver/Reciprocal.h
OndselSolver/RedundantConstraint.h
OndselSolver/resource.h
OndselSolver/RevCylJoint.h
OndselSolver/RevoluteJoint.h
OndselSolver/ScalarNewtonRaphson.h
OndselSolver/ScrewConstraintIJ.h
OndselSolver/ScrewConstraintIqcJc.h
OndselSolver/ScrewConstraintIqcJqc.h
OndselSolver/ScrewJoint.h
OndselSolver/SimulationStoppingError.h
OndselSolver/Sine.h
OndselSolver/SingularMatrixError.h
OndselSolver/Solver.h
OndselSolver/SparseColumn.h
OndselSolver/SparseMatrix.h
OndselSolver/SparseRow.h
OndselSolver/SparseVector.h
OndselSolver/SphericalJoint.h
OndselSolver/SphSphJoint.h
OndselSolver/StableBackwardDifference.h
OndselSolver/StateData.h
OndselSolver/Sum.h
OndselSolver/Symbolic.h
OndselSolver/SymbolicParser.h
OndselSolver/SyntaxError.h
OndselSolver/System.h
OndselSolver/SystemNewtonRaphson.h
OndselSolver/SystemSolver.h
OndselSolver/Time.h
OndselSolver/TooManyTriesError.h
OndselSolver/TooSmallStepSizeError.h
OndselSolver/Translation.h
OndselSolver/TranslationalJoint.h
OndselSolver/TranslationConstraintIJ.h
OndselSolver/TranslationConstraintIqcJc.h
OndselSolver/TranslationConstraintIqcJqc.h
OndselSolver/TranslationConstraintIqctJqc.h
OndselSolver/Units.h
OndselSolver/UniversalJoint.h
OndselSolver/UserFunction.h
OndselSolver/Variable.h
OndselSolver/VectorNewtonRaphson.h
OndselSolver/VelICKineSolver.h
OndselSolver/VelICSolver.h
OndselSolver/VelKineSolver.h
OndselSolver/VelSolver.h
OndselSolver/ZRotation.h
OndselSolver/ZTranslation.h
add_library(OndselSolver "")
target_sources(OndselSolver
PRIVATE
${ONDSELSOLVER_EXPORT}
PUBLIC
${ONDSELSOLVER_HEADERS}
)
target_sources(OndselSolver PRIVATE
"${ONDSELSOLVER_SRC}"
"${ONDSELSOLVER_HEADERS}")
set_target_properties(OndselSolver
PROPERTIES VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER "${ONDSELSOLVER_HEADERS}"
)
#target_sources(OndselSolver PRIVATE ${ONDSELSOLVER_EXPORT})
#target_sources(OndselSolver PRIVATE ${ONDSELSOLVER_HEADERS})
configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY)
install(TARGETS OndselSolver
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver)
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver)
install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)

View File

@@ -10,6 +10,7 @@
#include "ASMTAssembly.h"
#include "ASMTMarker.h"
#include "Joint.h"
#include "FullMatrix.h"
using namespace MbD;

View File

@@ -7,6 +7,7 @@
***************************************************************************/
#include "ASMTMarker.h"
#include "FullMatrix.h"
#include "ASMTRefItem.h"
#include "ASMTPart.h"
#include "Part.h"

View File

@@ -7,5 +7,111 @@
***************************************************************************/
#include "DiagonalMatrix.h"
#include "FullMatrix.h"
using namespace MbD;
namespace MbD {
template<>
inline DiagMatDsptr DiagonalMatrix<double>::times(double factor)
{
auto nrow = (int)this->size();
auto answer = std::make_shared<DiagonalMatrix<double>>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i) * factor;
}
return answer;
}
template<typename T>
inline void DiagonalMatrix<T>::atiputDiagonalMatrix(int i, std::shared_ptr<DiagonalMatrix<T>> diagMat)
{
for (int ii = 0; ii < diagMat->size(); ii++)
{
this->at(i + ii) = diagMat->at(ii);
}
}
template<typename T>
inline DiagMatsptr<T> DiagonalMatrix<T>::times(T factor)
{
assert(false);
}
template<typename T>
inline FColsptr<T> DiagonalMatrix<T>::timesFullColumn(FColsptr<T> fullCol)
{
//"a*b = a(i,j)b(j) sum j."
auto nrow = (int)this->size();
auto answer = std::make_shared<FullColumn<T>>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i) * fullCol->at(i);
}
return answer;
}
template<typename T>
inline FMatDsptr DiagonalMatrix<T>::timesFullMatrix(FMatDsptr fullMat)
{
auto nrow = (int)this->size();
auto answer = std::make_shared<FullMatrixDouble>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = fullMat->at(i)->times(this->at(i));
}
return answer;
}
template<>
inline double DiagonalMatrix<double>::sumOfSquares()
{
double sum = 0.0;
for (int i = 0; i < this->size(); i++)
{
double element = this->at(i);
sum += element * element;
}
return sum;
}
template<typename T>
inline int DiagonalMatrix<T>::numberOfElements()
{
auto n = (int)this->size();
return n * n;
}
template<>
inline void DiagonalMatrix<double>::zeroSelf()
{
for (int i = 0; i < this->size(); i++) {
this->at(i) = 0.0;
}
}
template<>
inline double DiagonalMatrix<double>::maxMagnitude()
{
double max = 0.0;
for (int i = 0; i < this->size(); i++)
{
double element = this->at(i);
if (element < 0.0) element = -element;
if (max < element) max = element;
}
return max;
}
template<typename T>
inline double DiagonalMatrix<T>::maxMagnitude()
{
assert(false);
return 0.0;
}
template<typename T>
inline std::ostream& DiagonalMatrix<T>::printOn(std::ostream& s) const
{
s << "DiagMat[";
s << this->at(0);
for (int i = 1; i < this->size(); i++)
{
s << ", " << this->at(i);
}
s << "]";
return s;
}
}

View File

@@ -8,10 +8,14 @@
#pragma once
#include "FullColumn.ref.h"
#include "FullRow.ref.h"
#include "FullMatrix.ref.h"
#include "DiagonalMatrix.ref.h"
#include "Array.h"
#include "FullColumn.h"
#include "FullMatrix.h"
//#include "FullColumn.h"
//#include "FullRow.h"
// #include "FullMatrix.h"
namespace MbD {
template<typename T>
@@ -41,107 +45,5 @@ namespace MbD {
std::ostream& printOn(std::ostream& s) const override;
};
template<>
inline DiagMatDsptr DiagonalMatrix<double>::times(double factor)
{
auto nrow = (int)this->size();
auto answer = std::make_shared<DiagonalMatrix<double>>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i) * factor;
}
return answer;
}
template<typename T>
inline void DiagonalMatrix<T>::atiputDiagonalMatrix(int i, std::shared_ptr<DiagonalMatrix<T>> diagMat)
{
for (int ii = 0; ii < diagMat->size(); ii++)
{
this->at(i + ii) = diagMat->at(ii);
}
}
template<typename T>
inline DiagMatsptr<T> DiagonalMatrix<T>::times(T factor)
{
assert(false);
}
template<typename T>
inline FColsptr<T> DiagonalMatrix<T>::timesFullColumn(FColsptr<T> fullCol)
{
//"a*b = a(i,j)b(j) sum j."
auto nrow = (int)this->size();
auto answer = std::make_shared<FullColumn<T>>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i) * fullCol->at(i);
}
return answer;
}
template<typename T>
inline FMatDsptr DiagonalMatrix<T>::timesFullMatrix(FMatDsptr fullMat)
{
auto nrow = (int)this->size();
auto answer = std::make_shared<FullMatrixDouble>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = fullMat->at(i)->times(this->at(i));
}
return answer;
}
template<>
inline double DiagonalMatrix<double>::sumOfSquares()
{
double sum = 0.0;
for (int i = 0; i < this->size(); i++)
{
double element = this->at(i);
sum += element * element;
}
return sum;
}
template<typename T>
inline int DiagonalMatrix<T>::numberOfElements()
{
auto n = (int)this->size();
return n * n;
}
template<>
inline void DiagonalMatrix<double>::zeroSelf()
{
for (int i = 0; i < this->size(); i++) {
this->at(i) = 0.0;
}
}
template<>
inline double DiagonalMatrix<double>::maxMagnitude()
{
double max = 0.0;
for (int i = 0; i < this->size(); i++)
{
double element = this->at(i);
if (element < 0.0) element = -element;
if (max < element) max = element;
}
return max;
}
template<typename T>
inline double DiagonalMatrix<T>::maxMagnitude()
{
assert(false);
return 0.0;
}
template<typename T>
inline std::ostream& DiagonalMatrix<T>::printOn(std::ostream& s) const
{
s << "DiagMat[";
s << this->at(0);
for (int i = 1; i < this->size(); i++)
{
s << ", " << this->at(i);
}
s << "]";
return s;
}
}

View File

@@ -79,10 +79,10 @@ namespace MbD {
auto term7 = phiA->timesFullMatrix(theAdot->timesFullMatrix(psiAdot));
auto term8 = phiA->timesFullMatrix(theA->timesFullMatrix(psiAddot));
aAddot = toFMDsptr(term->plusFullMatrix(term1)->plusFullMatrix(term2)
aAddot = term->plusFullMatrix(term1)->plusFullMatrix(term2)
->plusFullMatrix(term3)->plusFullMatrix(term4)
->plusFullMatrix(term5)->plusFullMatrix(term6)
->plusFullMatrix(term7)->plusFullMatrix(term8));
->plusFullMatrix(term7)->plusFullMatrix(term8);
}
template<typename T>
inline void EulerAnglesDDot<T>::aEulerAngles(EulerAngles<T>* eulerAngles)

View File

@@ -7,6 +7,9 @@
***************************************************************************/
#include "EulerParameters.h"
#include "FullColumn.h"
#include "FullRow.h"
#include "FullMatrix.h"
using namespace MbD;
template<>
@@ -160,8 +163,8 @@ inline FMatFMatDsptr EulerParameters<double>::ppApEpEtimesMatrix(FMatDsptr mat)
return answer;
}
template<>
inline void EulerParameters<double>::initialize()
template<typename T> // this is ALWAYS double; see note below.
inline void EulerParameters<T>::initialize()
{
aA = FullMatrixDouble::identitysptr(3);
aB = std::make_shared<FullMatrixDouble>(3, 4);
@@ -172,6 +175,14 @@ inline void EulerParameters<double>::initialize()
pApE->at(i) = std::make_shared<FullMatrixDouble>(3, 3);
}
}
// the following can't be valid as FullMatrix instatiatiates <double>, yet
// this class needs to see the member functions of FullMatrix
//template<>
//inline void EulerParameters<double>::initialize()
//{
//}
template<typename T>
inline void EulerParameters<T>::calc()
{

View File

@@ -8,10 +8,12 @@
#pragma once
#include "FullColumn.ref.h"
#include "FullMatrix.ref.h"
#include "EulerParameters.ref.h"
#include "EulerArray.h"
#include "FullColumn.h"
#include "FullMatrix.h"
// #include "FullColumn.h"
// #include "FullMatrix.h"
namespace MbD {

View File

@@ -185,7 +185,7 @@ namespace MbD {
inline FColDsptr EulerParametersDot<T>::omeOpO()
{
auto aaa = this->aB();
auto bbb = aaa->timesFullColumn(this);
auto bbb = aaa->timesFullColumn((MbD::FColsptr<double>)this);
auto ccc = bbb->times(2.0);
return ccc;
//return this->aB->timesFullColumn(this)->times(2.0);

View File

@@ -9,5 +9,171 @@
#include <sstream>
#include "FullColumn.h"
#include "FullRow.h"
#include "FullMatrix.h"
using namespace MbD;
namespace MbD {
template<typename T>
FColsptr<T> FullColumn<T>::plusFullColumn(FColsptr<T> fullCol)
{
int n = (int) this->size();
auto answer = std::make_shared<FullColumn<T>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i) + fullCol->at(i);
}
return answer;
}
template<typename T>
FColsptr<T> FullColumn<T>::minusFullColumn(FColsptr<T> fullCol)
{
int n = (int) this->size();
auto answer = std::make_shared<FullColumn<T>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i) - fullCol->at(i);
}
return answer;
}
template<>
FColDsptr FullColumn<double>::times(double a)
{
int n = (int)this->size();
auto answer = std::make_shared<FullColumn<double>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i) * a;
}
return answer;
}
template<typename T>
FColsptr<T> FullColumn<T>::times(T a)
{
assert(false);
}
template<typename T>
FColsptr<T> FullColumn<T>::negated()
{
return this->times(-1.0);
}
template<typename T>
void FullColumn<T>::atiputFullColumn(int i, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
this->at(i + ii) = fullCol->at(ii);
}
}
template<typename T>
void FullColumn<T>::atiplusFullColumn(int i, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
this->at(i + ii) += fullCol->at(ii);
}
}
template<typename T>
void FullColumn<T>::equalSelfPlusFullColumnAt(FColsptr<T> fullCol, int ii)
{
//self is subcolumn of fullCol
for (int i = 0; i < this->size(); i++)
{
this->at(i) += fullCol->at(ii + i);
}
}
template<typename T>
void FullColumn<T>::atiminusFullColumn(int i1, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
int i = i1 + ii;
this->at(i) -= fullCol->at(ii);
}
}
template<typename T>
void FullColumn<T>::equalFullColumnAt(FColsptr<T> fullCol, int i)
{
this->equalArrayAt(fullCol, i);
//for (int ii = 0; ii < this->size(); ii++)
//{
// this->at(ii) = fullCol->at(i + ii);
//}
}
template<>
FColDsptr FullColumn<double>::copy()
{
auto n = (int) this->size();
auto answer = std::make_shared<FullColumn<double>>(n);
for (int i = 0; i < n; i++)
{
answer->at(i) = this->at(i);
}
return answer;
}
template<typename T>
FRowsptr<T> FullColumn<T>::transpose()
{
return std::make_shared<FullRow<T>>(*this);
}
template<typename T>
void FullColumn<T>::atiplusFullColumntimes(int i1, FColsptr<T> fullCol, T factor)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
int i = i1 + ii;
this->at(i) += fullCol->at(ii) * factor;
}
}
template<typename T>
T FullColumn<T>::transposeTimesFullColumn(const FColsptr<T> fullCol)
{
return this->dot(fullCol);
}
template<typename T>
void FullColumn<T>::equalSelfPlusFullColumntimes(FColsptr<T> fullCol, T factor)
{
this->equalSelfPlusFullVectortimes(fullCol, factor);
}
template<typename T>
FColsptr<T> FullColumn<T>::cross(FColsptr<T> fullCol)
{
auto a0 = this->at(0);
auto a1 = this->at(1);
auto a2 = this->at(2);
auto b0 = fullCol->at(0);
auto b1 = fullCol->at(1);
auto b2 = fullCol->at(2);
auto answer = std::make_shared<FullColumn<T>>(3);
answer->atiput(0, a1 * b2 - (a2 * b1));
answer->atiput(1, a2 * b0 - (a0 * b2));
answer->atiput(2, a0 * b1 - (a1 * b0));
return answer;
}
//template<>
//inline std::shared_ptr<FullColumn<Symsptr>> FullColumn<Symsptr>::simplified()
//{
// auto n = this->size();
// auto answer = std::make_shared<FullColumn<Symsptr>>(n);
// for (int i = 0; i < n; i++)
// {
// auto func = this->at(i);
// answer->at(i) = func->simplified(func);
// }
// return answer;
//}
template<typename T>
FColsptr<T> FullColumn<T>::simplified()
{
assert(false);
return FColsptr<T>();
}
template<typename T>
std::ostream& FullColumn<T>::printOn(std::ostream& s) const
{
s << "FullCol{";
s << this->at(0);
for (int i = 1; i < this->size(); i++)
{
s << ", " << this->at(i);
}
s << "}";
return s;
}
}

View File

@@ -14,19 +14,9 @@
#include "FullVector.h"
#include "FullColumn.ref.h"
#include "FullRow.ref.h"
#include "FullColumn.h"
#include "FullRow.h"
#include "FullMatrix.ref.h"
namespace MbD {
// template<typename T>
// class FullColumn;
// using FColDsptr = std::shared_ptr<FullColumn<double>>;
// template<typename T>
// using FColsptr = std::shared_ptr<FullColumn<T>>;
// template<typename T>
// class FullRow;
// template<typename T>
// using FRowsptr = std::shared_ptr<FullRow<T>>;
class Symbolic;
template<typename T>
@@ -58,168 +48,6 @@ namespace MbD {
std::ostream& printOn(std::ostream& s) const override;
};
template<typename T>
inline FColsptr<T> FullColumn<T>::plusFullColumn(FColsptr<T> fullCol)
{
int n = (int) this->size();
auto answer = std::make_shared<FullColumn<T>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i) + fullCol->at(i);
}
return answer;
}
template<typename T>
inline FColsptr<T> FullColumn<T>::minusFullColumn(FColsptr<T> fullCol)
{
int n = (int) this->size();
auto answer = std::make_shared<FullColumn<T>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i) - fullCol->at(i);
}
return answer;
}
template<>
inline FColDsptr FullColumn<double>::times(double a)
{
int n = (int)this->size();
auto answer = std::make_shared<FullColumn<double>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i) * a;
}
return answer;
}
template<typename T>
inline FColsptr<T> FullColumn<T>::times(T a)
{
assert(false);
}
template<typename T>
inline FColsptr<T> FullColumn<T>::negated()
{
return this->times(-1.0);
}
template<typename T>
inline void FullColumn<T>::atiputFullColumn(int i, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
this->at(i + ii) = fullCol->at(ii);
}
}
template<typename T>
inline void FullColumn<T>::atiplusFullColumn(int i, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
this->at(i + ii) += fullCol->at(ii);
}
}
template<typename T>
inline void FullColumn<T>::equalSelfPlusFullColumnAt(FColsptr<T> fullCol, int ii)
{
//self is subcolumn of fullCol
for (int i = 0; i < this->size(); i++)
{
this->at(i) += fullCol->at(ii + i);
}
}
template<typename T>
inline void FullColumn<T>::atiminusFullColumn(int i1, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
int i = i1 + ii;
this->at(i) -= fullCol->at(ii);
}
}
template<typename T>
inline void FullColumn<T>::equalFullColumnAt(FColsptr<T> fullCol, int i)
{
this->equalArrayAt(fullCol, i);
//for (int ii = 0; ii < this->size(); ii++)
//{
// this->at(ii) = fullCol->at(i + ii);
//}
}
template<>
inline FColDsptr FullColumn<double>::copy()
{
auto n = (int) this->size();
auto answer = std::make_shared<FullColumn<double>>(n);
for (int i = 0; i < n; i++)
{
answer->at(i) = this->at(i);
}
return answer;
}
template<typename T>
inline FRowsptr<T> FullColumn<T>::transpose()
{
return std::make_shared<FullRow<T>>(*this);
}
template<typename T>
inline void FullColumn<T>::atiplusFullColumntimes(int i1, FColsptr<T> fullCol, T factor)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
int i = i1 + ii;
this->at(i) += fullCol->at(ii) * factor;
}
}
template<typename T>
inline T FullColumn<T>::transposeTimesFullColumn(const FColsptr<T> fullCol)
{
return this->dot(fullCol);
}
template<typename T>
inline void FullColumn<T>::equalSelfPlusFullColumntimes(FColsptr<T> fullCol, T factor)
{
this->equalSelfPlusFullVectortimes(fullCol, factor);
}
template<typename T>
inline FColsptr<T> FullColumn<T>::cross(FColsptr<T> fullCol)
{
auto a0 = this->at(0);
auto a1 = this->at(1);
auto a2 = this->at(2);
auto b0 = fullCol->at(0);
auto b1 = fullCol->at(1);
auto b2 = fullCol->at(2);
auto answer = std::make_shared<FullColumn<T>>(3);
answer->atiput(0, a1 * b2 - (a2 * b1));
answer->atiput(1, a2 * b0 - (a0 * b2));
answer->atiput(2, a0 * b1 - (a1 * b0));
return answer;
}
//template<>
//inline std::shared_ptr<FullColumn<Symsptr>> FullColumn<Symsptr>::simplified()
//{
// auto n = this->size();
// auto answer = std::make_shared<FullColumn<Symsptr>>(n);
// for (int i = 0; i < n; i++)
// {
// auto func = this->at(i);
// answer->at(i) = func->simplified(func);
// }
// return answer;
//}
template<typename T>
inline FColsptr<T> FullColumn<T>::simplified()
{
assert(false);
return FColsptr<T>();
}
template<typename T>
inline std::ostream& FullColumn<T>::printOn(std::ostream& s) const
{
s << "FullCol{";
s << this->at(0);
for (int i = 1; i < this->size(); i++)
{
s << ", " << this->at(i);
}
s << "}";
return s;
}
template class FullVector<double>;
}

View File

@@ -1,5 +1,8 @@
#pragma once
#include <algorithm>
#include <memory>
namespace MbD {
template<typename T>
class FullColumn;

View File

@@ -13,68 +13,29 @@
#include "EulerParameters.h"
namespace MbD {
// template<typename T>
//
// inline std::shared_ptr<FullMatrixTemplate<T>> rotatex(T the)
FColsptr<double> FullMatrixDouble::timesFullColumn(FColsptr<double> fullCol)
{
// return this->timesFullColumn(fullCol.get());
auto nrow = this->nrow();
auto answer = std::make_shared<FullColumn<double>>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i)->timesFullColumn(fullCol);
}
return answer;
}
// FColsptr<double> timesFullColumn(FullColumn<double>* fullCol) // local
// {
// auto sthe = std::sin(the);
// auto cthe = std::cos(the);
// auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
// auto row0 = rotMat->at(0);
// row0->atiput(0, 1.0);
// row0->atiput(1, 0.0);
// row0->atiput(2, 0.0);
// auto row1 = rotMat->at(1);
// row1->atiput(0, 0.0);
// row1->atiput(1, cthe);
// row1->atiput(2, -sthe);
// auto row2 = rotMat->at(2);
// row2->atiput(0, 0.0);
// row2->atiput(1, sthe);
// row2->atiput(2, cthe);
// return rotMat;
// //"a*b = a(i,j)b(j) sum j."
// auto nrow = this->nrow();
// auto answer = std::make_shared<FullColumn<double>>(nrow);
// for (int i = 0; i < nrow; i++)
// {
// answer->at(i) = this->at(i)->timesFullColumn(fullCol);
// }
// return answer;
// }
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> rotatey(T the)
// {
// auto sthe = std::sin(the);
// auto cthe = std::cos(the);
// auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
// auto row0 = rotMat->at(0);
// row0->atiput(0, cthe);
// row0->atiput(1, 0.0);
// row0->atiput(2, sthe);
// auto row1 = rotMat->at(1);
// row1->atiput(0, 0.0);
// row1->atiput(1, 1.0);
// row1->atiput(2, 0.0);
// auto row2 = rotMat->at(2);
// row2->atiput(0, -sthe);
// row2->atiput(1, 0.0);
// row2->atiput(2, cthe);
// return rotMat;
// }
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> rotatez(T the)
// {
// auto sthe = std::sin(the);
// auto cthe = std::cos(the);
// auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
// auto row0 = rotMat->at(0);
// row0->atiput(0, cthe);
// row0->atiput(1, -sthe);
// row0->atiput(2, 0.0);
// auto row1 = rotMat->at(1);
// row1->atiput(0, sthe);
// row1->atiput(1, cthe);
// row1->atiput(2, 0.0);
// auto row2 = rotMat->at(2);
// row2->atiput(0, 0.0);
// row2->atiput(1, 0.0);
// row2->atiput(2, 1.0);
// return rotMat;
// }
inline std::shared_ptr<FullMatrixDouble> rotatex(double the)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatex(double the)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -93,7 +54,7 @@ namespace MbD {
row2->atiput(2, cthe);
return rotMat;
}
inline std::shared_ptr<FullMatrixDouble> rotatey(double the)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatey(double the)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -112,7 +73,7 @@ namespace MbD {
row2->atiput(2, cthe);
return rotMat;
}
inline std::shared_ptr<FullMatrixDouble> rotatez(double the)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatez(double the)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -131,73 +92,7 @@ namespace MbD {
row2->atiput(2, 1.0);
return rotMat;
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> rotatexrotDot(T the, T thedot)
// {
// auto sthe = std::sin(the);
// auto cthe = std::cos(the);
// auto sthedot = cthe * thedot;
// auto cthedot = -sthe * thedot;
// auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
// auto row0 = rotMat->at(0);
// row0->atiput(0, 0.0);
// row0->atiput(1, 0.0);
// row0->atiput(2, 0.0);
// auto row1 = rotMat->at(1);
// row1->atiput(0, 0.0);
// row1->atiput(1, cthedot);
// row1->atiput(2, -sthedot);
// auto row2 = rotMat->at(2);
// row2->atiput(0, 0.0);
// row2->atiput(1, sthedot);
// row2->atiput(2, cthedot);
// return rotMat;
// }
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> rotateyrotDot(T the, T thedot)
// {
// auto sthe = std::sin(the);
// auto cthe = std::cos(the);
// auto sthedot = cthe * thedot;
// auto cthedot = -sthe * thedot;
// auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
// auto row0 = rotMat->at(0);
// row0->atiput(0, cthedot);
// row0->atiput(1, 0.0);
// row0->atiput(2, sthedot);
// auto row1 = rotMat->at(1);
// row1->atiput(0, 0.0);
// row1->atiput(1, 0.0);
// row1->atiput(2, 0.0);
// auto row2 = rotMat->at(2);
// row2->atiput(0, -sthedot);
// row2->atiput(1, 0.0);
// row2->atiput(2, cthedot);
// return rotMat;
// }
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> rotatezrotDot(T the, T thedot)
// {
// auto sthe = std::sin(the);
// auto cthe = std::cos(the);
// auto sthedot = cthe * thedot;
// auto cthedot = -sthe * thedot;
// auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
// auto row0 = rotMat->at(0);
// row0->atiput(0, cthedot);
// row0->atiput(1, -sthedot);
// row0->atiput(2, 0.0);
// auto row1 = rotMat->at(1);
// row1->atiput(0, sthedot);
// row1->atiput(1, cthedot);
// row1->atiput(2, 0.0);
// auto row2 = rotMat->at(2);
// row2->atiput(0, 0.0);
// row2->atiput(1, 0.0);
// row2->atiput(2, 0.0);
// return rotMat;
// }
inline std::shared_ptr<FullMatrixDouble> rotatexrotDot(double the, double thedot)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatexrotDot(double the, double thedot)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -218,7 +113,7 @@ namespace MbD {
row2->atiput(2, cthedot);
return rotMat;
}
inline std::shared_ptr<FullMatrixDouble> rotateyrotDot(double the, double thedot)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotateyrotDot(double the, double thedot)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -239,7 +134,7 @@ namespace MbD {
row2->atiput(2, cthedot);
return rotMat;
}
inline std::shared_ptr<FullMatrixDouble> rotatezrotDot(double the, double thedot)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatezrotDot(double the, double thedot)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -260,8 +155,7 @@ namespace MbD {
row2->atiput(2, 0.0);
return rotMat;
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> rotatexrotDotrotDDot(T the, T thedot, T theddot)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatexrotDotrotDDot(double the, double thedot, double theddot)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -269,7 +163,7 @@ namespace MbD {
auto cthedot = -sthe * thedot;
auto stheddot = cthedot * thedot + (cthe * theddot);
auto ctheddot = -(sthedot * thedot) - (sthe * theddot);
auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
auto rotMat = std::make_shared<FullMatrixDouble>(3, 3);
auto row0 = rotMat->at(0);
row0->atiput(0, 0.0);
row0->atiput(1, 0.0);
@@ -284,8 +178,7 @@ namespace MbD {
row2->atiput(2, ctheddot);
return rotMat;
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> rotateyrotDotrotDDot(T the, T thedot, T theddot)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotateyrotDotrotDDot(double the, double thedot, double theddot)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -293,7 +186,7 @@ namespace MbD {
auto cthedot = -sthe * thedot;
auto stheddot = cthedot * thedot + (cthe * theddot);
auto ctheddot = -(sthedot * thedot) - (sthe * theddot);
auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
auto rotMat = std::make_shared<FullMatrixDouble>(3, 3);
auto row0 = rotMat->at(0);
row0->atiput(0, ctheddot);
row0->atiput(1, 0.0);
@@ -308,8 +201,7 @@ namespace MbD {
row2->atiput(2, ctheddot);
return rotMat;
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> rotatezrotDotrotDDot(T the, T thedot, T theddot)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::rotatezrotDotrotDDot(double the, double thedot, double theddot)
{
auto sthe = std::sin(the);
auto cthe = std::cos(the);
@@ -317,7 +209,7 @@ namespace MbD {
auto cthedot = -sthe * thedot;
auto stheddot = cthedot * thedot + (cthe * theddot);
auto ctheddot = -(sthedot * thedot) - (sthe * theddot);
auto rotMat = std::make_shared<FullMatrixTemplate<T>>(3, 3);
auto rotMat = std::make_shared<FullMatrixDouble>(3, 3);
auto row0 = rotMat->at(0);
row0->atiput(0, ctheddot);
row0->atiput(1, -stheddot);
@@ -332,27 +224,19 @@ namespace MbD {
row2->atiput(2, 0.0);
return rotMat;
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::identitysptr(int n)
{
auto mat = std::make_shared<FullMatrixTemplate<T>>(n, n);
mat->identity();
return mat;
}
inline std::shared_ptr<MbD::FullMatrixDouble> FullMatrixDouble::identitysptr(int n)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::identitysptr(int n)
{
auto mat = std::make_shared<FullMatrixDouble>(n, n);
mat->identity();
return mat;
}
inline std::shared_ptr<MbD::FullMatrixFullMatrixDouble> FullMatrixFullMatrixDouble::identitysptr(int n)
std::shared_ptr<MbD::FullMatrixFullMatrixDouble> FullMatrixFullMatrixDouble::identitysptr(int n)
{
auto mat = std::make_shared<FullMatrixFullMatrixDouble>(n, n);
mat->identity();
return mat;
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::tildeMatrix(FColDsptr col)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::tildeMatrix(FColDsptr col)
{
//"tildeMatrix is skew symmetric matrix related to angular velocity and cross product."
if (col->size() != 3) throw std::runtime_error("Column is not of dimension 3");
@@ -371,50 +255,47 @@ namespace MbD {
tilde->atijput(2, 1, c0);
return tilde;
}
template<>
inline void FullMatrixTemplate<double>::zeroSelf()
void FullMatrixDouble::zeroSelf()
{
for (int i = 0; i < this->size(); i++) {
this->at(i)->zeroSelf();
}
}
template<typename T>
inline void FullMatrixTemplate<T>::identity() {
assert(false);
void FullMatrixFullMatrixDouble::zeroSelf()
{
for (int i = 0; i < this->size(); i++) {
this->at(i)->zeroSelf();
}
}
inline void FullMatrixDouble::identity() {
void FullMatrixFullColumnDouble::zeroSelf()
{
for (int i = 0; i < this->size(); i++) {
this->at(i)->zeroSelf();
}
}
void FullMatrixDouble::identity() {
this->zeroSelf();
for (int i = 0; i < this->size(); i++) {
this->at(i)->at(i) = 1.0;
}
}
inline void FullMatrixFullMatrixDouble::identity() {
void FullMatrixFullMatrixDouble::identity() {
assert(false);
// this->zeroSelf();
// for (int i = 0; i < this->size(); i++) {
// this->at(i)->at(i) = 1.0;
// }
}
template<typename T>
inline FColsptr<T> FullMatrixTemplate<T>::column(int j) {
// TODO: should there be a FullMatrixFullColumnDouble version of this?
FColsptr<double> FullMatrixDouble::column(int j) {
int n = (int)this->size();
auto answer = std::make_shared<FullColumn<T>>(n);
auto answer = std::make_shared<FullColumn<double>>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i)->at(j);
}
return answer;
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::timesFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat)
// {
// int m = this->nrow();
// auto answer = std::make_shared<FullMatrixTemplate<T>>(m);
// for (int i = 0; i < m; i++) {
// answer->at(i) = this->at(i)->timesFullMatrix(fullMat);
// }
// return answer;
// }
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::timesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::timesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
int m = this->nrow();
auto answer = std::make_shared<FullMatrixDouble>(m);
@@ -423,7 +304,7 @@ namespace MbD {
}
return answer;
}
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
int nrow = this->nrow();
auto answer = std::make_shared<FullMatrixDouble>(nrow);
@@ -432,7 +313,7 @@ namespace MbD {
}
return answer;
}
inline std::shared_ptr<FullMatrixFullMatrixDouble> FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat)
std::shared_ptr<FullMatrixFullMatrixDouble> FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat)
{
int nrow = this->nrow();
auto answer = std::make_shared<FullMatrixFullMatrixDouble>(nrow);
@@ -441,7 +322,7 @@ namespace MbD {
}
return answer;
}
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::times(double a)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::times(double a)
{
int m = this->nrow();
auto answer = std::make_shared<FullMatrixDouble>(m);
@@ -451,11 +332,11 @@ namespace MbD {
}
return answer;
}
inline std::shared_ptr<FullMatrixFullMatrixDouble> FullMatrixFullMatrixDouble::times(double a)
std::shared_ptr<FullMatrixFullMatrixDouble> FullMatrixFullMatrixDouble::times(double a)
{
assert(false);
}
inline std::shared_ptr<FullMatrixFullColumnDouble> FullMatrixFullColumnDouble::times(double a)
std::shared_ptr<FullMatrixFullColumnDouble> FullMatrixFullColumnDouble::times(double a)
{
// int m = this->nrow();
// auto answer = std::make_shared<FullMatrixFullColumnDouble>(m);
@@ -465,31 +346,11 @@ namespace MbD {
// return answer;
assert(false);
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::times(T a)
{
assert(false);
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::transposeTimesFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat)
// {
// return this->transpose()->timesFullMatrix(fullMat);
// }
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
return this->transpose()->timesFullMatrix(fullMat);
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::plusFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat)
// {
// int n = (int)this->size();
// auto answer = std::make_shared<FullMatrixTemplate<T>>(n);
// for (int i = 0; i < n; i++) {
// answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i));
// }
// return answer;
// }
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::plusFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::plusFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
int n = (int)this->size();
auto answer = std::make_shared<FullMatrixDouble>(n);
@@ -498,31 +359,16 @@ namespace MbD {
}
return answer;
}
template<typename T>
inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::minusFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat)
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::minusFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
int n = (int)this->size();
auto answer = std::make_shared<FullMatrixTemplate<T>>(n);
auto answer = std::make_shared<FullMatrixDouble>(n);
for (int i = 0; i < n; i++) {
answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i));
}
return answer;
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::transpose()
// {
// int nrow = this->nrow();
// auto ncol = this->ncol();
// auto answer = std::make_shared<FullMatrixTemplate<T>>(ncol, nrow);
// for (int i = 0; i < nrow; i++) {
// auto& row = this->at(i);
// for (int j = 0; j < ncol; j++) {
// answer->at(j)->at(i) = row->at(j);
// }
// }
// return answer;
// }
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::transpose() {
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::transpose() {
int nrow = this->nrow();
auto ncol = this->ncol();
auto answer = std::make_shared<FullMatrixDouble>(ncol, nrow);
@@ -534,17 +380,11 @@ namespace MbD {
}
return answer;
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::negated()
// {
// return this->times(-1.0);
// }
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::negated()
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::negated()
{
return this->times(-1.0);
}
template<typename T>
inline void FullMatrixTemplate<T>::symLowerWithUpper()
void FullMatrixDouble::symLowerWithUpper()
{
int n = (int)this->size();
for (int i = 0; i < n; i++) {
@@ -553,42 +393,45 @@ namespace MbD {
}
}
}
template<typename T>
inline void FullMatrixTemplate<T>::atiput(int i, FRowsptr<T> fullRow)
void FullMatrixFullColumnDouble::symLowerWithUpper()
{
int n = (int)this->size();
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
this->at(j)->at(i) = this->at(i)->at(j);
}
}
}
void FullMatrixDouble::atiput(int i, FRowsptr<double> fullRow)
{
this->at(i) = fullRow;
}
template<typename T>
inline void FullMatrixTemplate<T>::atijput(int i, int j, T value)
void FullMatrixDouble::atijput(int i, int j, double value)
{
this->at(i)->atiput(j, value);
}
template<typename T>
inline void FullMatrixTemplate<T>::atijputFullColumn(int i1, int j1, FColsptr<T> fullCol)
void FullMatrixDouble::atijputFullColumn(int i1, int j1, FColsptr<double> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
{
this->at(i1 + ii)->at(j1) = fullCol->at(ii);
}
}
template<typename T>
inline void FullMatrixTemplate<T>::atijplusFullRow(int i, int j, FRowsptr<T> fullRow)
void FullMatrixDouble::atijplusFullRow(int i, int j, FRowsptr<double> fullRow)
{
this->at(i)->atiplusFullRow(j, fullRow);
}
template<typename T>
inline void FullMatrixTemplate<T>::atijplusNumber(int i, int j, T value)
void FullMatrixDouble::atijplusNumber(int i, int j, double value)
{
auto rowi = this->at(i);
rowi->at(j) += value;
}
template<typename T>
inline void FullMatrixTemplate<T>::atijminusNumber(int i, int j, T value)
void FullMatrixDouble::atijminusNumber(int i, int j, double value)
{
auto rowi = this->at(i);
rowi->at(j) -= value;
}
inline double FullMatrixDouble::sumOfSquares()
double FullMatrixDouble::sumOfSquares()
{
double sum = 0.0;
for (int i = 0; i < this->size(); i++)
@@ -597,7 +440,7 @@ namespace MbD {
}
return sum;
}
inline double FullMatrixFullMatrixDouble::sumOfSquares()
double FullMatrixFullMatrixDouble::sumOfSquares()
{
double sum = 0.0;
for (int i = 0; i < this->size(); i++)
@@ -606,30 +449,16 @@ namespace MbD {
}
return sum;
}
template<typename T>
inline double FullMatrixTemplate<T>::sumOfSquares()
double FullMatrixFullColumnDouble::sumOfSquares()
{
assert(false);
return 0.0;
double sum = 0.0;
for (int i = 0; i < this->size(); i++)
{
sum += this->at(i)->sumOfSquares();
}
return sum;
}
template<typename T>
inline void FullMatrixTemplate<T>::zeroSelf()
{
assert(false);
}
// template<typename T>
// inline std::shared_ptr<FullMatrixTemplate<T>> FullMatrixTemplate<T>::copy()
// {
// auto m = (int)this->size();
// auto answer = std::make_shared<FullMatrixTemplate<T>>(m);
// for (int i = 0; i < m; i++)
// {
// answer->at(i) = this->at(i)->copy();
// }
// return answer;
// }
inline std::shared_ptr<FullMatrixDouble> FullMatrixDouble::copy()
std::shared_ptr<FullMatrixDouble> FullMatrixDouble::copy()
{
auto m = (int)this->size();
auto answer = std::make_shared<FullMatrixDouble>(m);
@@ -639,31 +468,27 @@ namespace MbD {
}
return answer;
}
template<typename T>
inline FullMatrixTemplate<T> FullMatrixTemplate<T>::operator+(const FullMatrixTemplate<T> fullMat)
FullMatrixDouble FullMatrixDouble::operator+(const FullMatrixDouble fullMat)
{
int n = (int)this->size();
auto answer = FullMatrixTemplate<T>(n);
FullMatrixDouble answer(n);
for (int i = 0; i < n; i++) {
answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i));
}
return answer;
}
template<typename T>
inline FColsptr<T> FullMatrixTemplate<T>::transposeTimesFullColumn(FColsptr<T> fullCol)
FColsptr<double> FullMatrixDouble::transposeTimesFullColumn(FColsptr<double> fullCol)
{
auto sptr = std::make_shared<FullMatrixTemplate<T>>(*this);
auto sptr = std::make_shared<FullMatrixDouble>(*this);
return fullCol->transpose()->timesFullMatrix(sptr)->transpose();
}
template<typename T>
inline void FullMatrixTemplate<T>::magnifySelf(T factor)
void FullMatrixDouble::magnifySelf(double factor)
{
for (int i = 0; i < this->size(); i++) {
this->at(i)->magnifySelf(factor);
}
}
template<typename T>
inline std::ostream& FullMatrixTemplate<T>::printOn(std::ostream& s) const
std::ostream& FullMatrixDouble::printOn(std::ostream& s) const
{
s << "FullMat[" << std::endl;
for (int i = 0; i < this->size(); i++)
@@ -673,16 +498,15 @@ namespace MbD {
s << "]";
return s;
}
template<typename T>
inline std::shared_ptr<EulerParameters<T>> FullMatrixTemplate<T>::asEulerParameters()
std::shared_ptr<EulerParameters<double>> FullMatrixDouble::asEulerParameters()
{
//"Given [A], compute Euler parameter."
auto traceA = this->trace();
T dum = 0.0;
T dumSq = 0.0;
double dum = 0.0;
double dumSq = 0.0;
//auto qE = CREATE<EulerParameters<double>>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why?
auto qE = std::make_shared<EulerParameters<T>>(4);
auto qE = std::make_shared<EulerParameters<double>>(4);
qE->initialize();
auto OneMinusTraceDivFour = (1.0 - traceA) / 4.0;
for (int i = 0; i < 3; i++)
@@ -694,7 +518,7 @@ namespace MbD {
dumSq = (1.0 + traceA) / 4.0;
dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0;
qE->atiput(3, dum);
T max = 0.0;
double max = 0.0;
int maxE = -1;
for (int i = 0; i < 4; i++)
{
@@ -733,18 +557,16 @@ namespace MbD {
qE->calc();
return qE;
}
template<typename T>
inline T FullMatrixTemplate<T>::trace()
double FullMatrixDouble::trace()
{
T trace = 0.0;
double trace = 0.0;
for (int i = 0; i < this->size(); i++)
{
trace += this->at(i)->at(i);
}
return trace;
}
template<typename T>
inline double FullMatrixTemplate<T>::maxMagnitude()
double FullMatrixDouble::maxMagnitude()
{
double max = 0.0;
for (int i = 0; i < this->size(); i++)
@@ -754,12 +576,31 @@ namespace MbD {
}
return max;
}
template<typename T>
inline FColsptr<T> FullMatrixTemplate<T>::bryantAngles()
double FullMatrixFullMatrixDouble::maxMagnitude()
{
auto answer = std::make_shared<FullColumn<T>>(3);
double max = 0.0;
for (int i = 0; i < this->size(); i++)
{
double element = this->at(i)->maxMagnitude();
if (max < element) max = element;
}
return max;
}
double FullMatrixFullColumnDouble::maxMagnitude()
{
double max = 0.0;
for (int i = 0; i < this->size(); i++)
{
double element = this->at(i)->maxMagnitude();
if (max < element) max = element;
}
return max;
}
FColsptr<double> FullMatrixDouble::bryantAngles()
{
auto answer = std::make_shared<FullColumn<double>>(3);
auto sthe1y = this->at(0)->at(2);
T the0x, the1y, the2z, cthe0x, sthe0x, y, x;
double the0x, the1y, the2z, cthe0x, sthe0x, y, x;
if (std::abs(sthe1y) > 0.9999) {
if (sthe1y > 0.0) {
the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1));
@@ -791,8 +632,7 @@ namespace MbD {
answer->atiput(2, the2z);
return answer;
}
template<typename T>
inline bool FullMatrixTemplate<T>::isDiagonal()
bool FullMatrixDouble::isDiagonal()
{
auto m = this->nrow();
auto n = this->ncol();
@@ -807,8 +647,7 @@ namespace MbD {
}
return true;
}
template<typename T>
inline bool FullMatrixTemplate<T>::isDiagonalToWithin(double ratio)
bool FullMatrixDouble::isDiagonalToWithin(double ratio)
{
double maxMag = this->maxMagnitude();
auto tol = ratio * maxMag;
@@ -828,39 +667,20 @@ namespace MbD {
return false;
}
}
template<typename T>
inline std::shared_ptr<DiagonalMatrix<T>> FullMatrixTemplate<T>::asDiagonalMatrix()
std::shared_ptr<DiagonalMatrix<double>> FullMatrixDouble::asDiagonalMatrix()
{
int nrow = this->nrow();
auto diagMat = std::make_shared<DiagonalMatrix<T>>(nrow);
auto diagMat = std::make_shared<DiagonalMatrix<double>>(nrow);
for (int i = 0; i < nrow; i++)
{
diagMat->atiput(i, this->at(i)->at(i));
}
return diagMat;
}
template<typename T>
inline void FullMatrixTemplate<T>::conditionSelfWithTol(double tol)
void FullMatrixDouble::conditionSelfWithTol(double tol)
{
for (auto row : *this) {
row->conditionSelfWithTol(tol);
}
}
template<typename T>
inline FColsptr<T> FullMatrixTemplate<T>::timesFullColumn(FColsptr<T> fullCol)
{
return this->timesFullColumn(fullCol.get());
}
template<typename T>
inline FColsptr<T> FullMatrixTemplate<T>::timesFullColumn(FullColumn<T>* fullCol)
{
//"a*b = a(i,j)b(j) sum j."
auto nrow = this->nrow();
auto answer = std::make_shared<FullColumn<T>>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i)->timesFullColumn(fullCol);
}
return answer;
}
}

View File

@@ -17,103 +17,46 @@
#include "DiagonalMatrix.ref.h"
#include "EulerParameters.ref.h"
#include "RowTypeMatrix.h"
#include "FullRow.h" // exception to normal include pattern
#include "FullRow.h" // now that refs are resolved, go do the full systems
//#include "FullColumn.h"
//#include "DiagonalMatrix.h"
//#include "EulerParameters.h"
namespace MbD {
template<typename T>
class FullMatrixTemplate : public RowTypeMatrix<FRowsptr<T>>
{
public:
FullMatrixTemplate() = default;
explicit FullMatrixTemplate(int m) : RowTypeMatrix<FRowsptr<T>>(m)
{
}
FullMatrixTemplate(int m, int n) {
for (int i = 0; i < m; i++) {
auto row = std::make_shared<FullRow<T>>(n);
this->push_back(row);
}
}
FullMatrixTemplate(std::initializer_list<FRowsptr<T>> listOfRows) {
for (auto& row : listOfRows)
{
this->push_back(row);
}
}
FullMatrixTemplate(std::initializer_list<std::initializer_list<T>> list2D) {
for (auto& rowList : list2D)
{
auto row = std::make_shared<FullRow<T>>(rowList);
this->push_back(row);
}
}
// static std::shared_ptr<FullMatrixTemplate<T>> rotatex(T angle);
// static std::shared_ptr<FullMatrixTemplate<T>> rotatey(T angle);
// static std::shared_ptr<FullMatrixTemplate<T>> rotatez(T angle);
// static std::shared_ptr<FullMatrixTemplate<T>> rotatexrotDot(T angle, T angledot);
// static std::shared_ptr<FullMatrixTemplate<T>> rotateyrotDot(T angle, T angledot);
// static std::shared_ptr<FullMatrixTemplate<T>> rotatezrotDot(T angle, T angledot);
static std::shared_ptr<FullMatrixTemplate<T>> rotatexrotDotrotDDot(T angle, T angleDot, T angleDDot);
static std::shared_ptr<FullMatrixTemplate<T>> rotateyrotDotrotDDot(T angle, T angleDot, T angleDDot);
static std::shared_ptr<FullMatrixTemplate<T>> rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot);
static std::shared_ptr<FullMatrixTemplate<T>> identitysptr(int n);
static std::shared_ptr<FullMatrixTemplate<T>> tildeMatrix(FColDsptr col);
virtual void identity();
FColsptr<T> column(int j);
FColsptr<T> timesFullColumn(FColsptr<T> fullCol);
FColsptr<T> timesFullColumn(FullColumn<T>* fullCol);
// std::shared_ptr<FullMatrixTemplate<T>> timesFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat);
virtual std::shared_ptr<FullMatrixTemplate<T>> timesTransposeFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat);
std::shared_ptr<FullMatrixTemplate<T>> times(T a);
// std::shared_ptr<FullMatrixTemplate<T>> transposeTimesFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat);
// std::shared_ptr<FullMatrixTemplate<T>> plusFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat);
std::shared_ptr<FullMatrixTemplate<T>> minusFullMatrix(std::shared_ptr<FullMatrixTemplate<T>> fullMat);
// std::shared_ptr<FullMatrixTemplate<T>> transpose();
// std::shared_ptr<FullMatrixTemplate<T>> negated();
void symLowerWithUpper();
void atiput(int i, FRowsptr<T> fullRow) override;
void atijput(int i, int j, T value);
void atijputFullColumn(int i, int j, FColsptr<T> fullCol);
void atijplusFullRow(int i, int j, FRowsptr<T> fullRow);
void atijplusNumber(int i, int j, T value);
void atijminusNumber(int i, int j, T value);
double sumOfSquares() override;
void zeroSelf() override;
// std::shared_ptr<FullMatrixTemplate<T>> copy();
FullMatrixTemplate<T> operator+(const FullMatrixTemplate<T> fullMat);
FColsptr<T> transposeTimesFullColumn(const FColsptr<T> fullCol);
void magnifySelf(T factor);
std::shared_ptr<EulerParameters<T>> asEulerParameters();
T trace();
double maxMagnitude() override;
FColsptr<T> bryantAngles();
bool isDiagonal();
bool isDiagonalToWithin(double ratio);
std::shared_ptr<DiagonalMatrix<T>> asDiagonalMatrix();
void conditionSelfWithTol(double tol);
std::ostream& printOn(std::ostream& s) const override;
};
//
// FULL MATRIX DOUBLE instantiation
// FULL MATRIX DOUBLE
//
class FullMatrixDouble : public FullMatrixTemplate<double> {
class FullMatrixDouble : public RowTypeMatrix<FRowsptr<double>> {
public:
FullMatrixDouble() : FullMatrixTemplate<double>() {};
explicit FullMatrixDouble(int m) : FullMatrixTemplate<double>(m) {};
FullMatrixDouble(int m, int n) : FullMatrixTemplate<double>(m, n) {};
FullMatrixDouble(std::initializer_list<std::initializer_list<double>> list2D) : FullMatrixTemplate<double>(list2D) {}
FullMatrixDouble(std::initializer_list<FRowsptr<double>> listOfRows) : FullMatrixTemplate<double>(listOfRows) {};
FullMatrixDouble() = default;
explicit FullMatrixDouble(int m) : RowTypeMatrix<FRowsptr<double>>(m)
{
}
FullMatrixDouble(int m, int n) {
for (int i = 0; i < m; i++) {
auto row = std::make_shared<FullRow<double>>(n);
this->push_back(row);
}
}
FullMatrixDouble(std::initializer_list<FRowsptr<double>> listOfRows) {
for (auto& row : listOfRows)
{
this->push_back(row);
}
}
FullMatrixDouble(std::initializer_list<std::initializer_list<double>> list2D) {
for (auto& rowList : list2D)
{
auto row = std::make_shared<FullRow<double>>(rowList);
this->push_back(row);
}
}
std::shared_ptr<FullMatrixDouble> times(double a);
std::shared_ptr<FullMatrixDouble> timesTransposeFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat);
void identity() override;
void identity();
static std::shared_ptr<MbD::FullMatrixDouble> identitysptr(int n);
double sumOfSquares();
double sumOfSquares() override;
std::shared_ptr<FullMatrixDouble> transposeTimesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat);
std::shared_ptr<FullMatrixDouble> timesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat);
std::shared_ptr<FullMatrixDouble> transpose();
@@ -125,37 +68,82 @@ namespace MbD {
static std::shared_ptr<FullMatrixDouble> rotatexrotDot(double angle, double angledot);
static std::shared_ptr<FullMatrixDouble> rotateyrotDot(double angle, double angledot);
static std::shared_ptr<FullMatrixDouble> rotatezrotDot(double angle, double angledot);
std::shared_ptr<FullMatrixDouble> copy();
static std::shared_ptr<FullMatrixDouble> rotatexrotDotrotDDot(double angle, double angleDot, double angleDDot);
static std::shared_ptr<FullMatrixDouble> rotateyrotDotrotDDot(double angle, double angleDot, double angleDDot);
static std::shared_ptr<FullMatrixDouble> rotatezrotDotrotDDot(double angle, double angleDot, double angleDDot);
static std::shared_ptr<FullMatrixDouble> tildeMatrix(FColDsptr col);
void zeroSelf() override;
FColsptr<double> column(int j);
void atiput(int i, FRowsptr<double> fullRow);
void atijput(int i, int j, double value);
std::shared_ptr<FullMatrixDouble> copy();
double maxMagnitude() override;
FullMatrixDouble operator+(const FullMatrixDouble fullMat);
std::shared_ptr<FullMatrixDouble> minusFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat);
FColsptr<double> transposeTimesFullColumn(FColsptr<double> fullCol);
void symLowerWithUpper();
void atijputFullColumn(int i1, int j1, FColsptr<double> fullCol);
void atijplusFullRow(int i, int j, FRowsptr<double> fullRow);
void atijplusNumber(int i, int j, double value);
void atijminusNumber(int i, int j, double value);
void magnifySelf(double factor);
std::shared_ptr<EulerParameters<double>> asEulerParameters();
FColsptr<double> bryantAngles();
double trace();
bool isDiagonal();
bool isDiagonalToWithin(double ratio);
std::shared_ptr<DiagonalMatrix<double>> asDiagonalMatrix();
void conditionSelfWithTol(double tol);
std::ostream& printOn(std::ostream& s) const override;
FColsptr<double> timesFullColumn(FColsptr<double> fullCol);
// FColsptr<double> timesFullColumn(FullColumn<double>* fullCol);
};
//
// FULL MATRIX FULL MATRIX DOUBLE instantiation
// FULL MATRIX FULL MATRIX DOUBLE
//
class FullMatrixFullMatrixDouble : public FullMatrixTemplate<FMatDsptr> {
class FullMatrixFullMatrixDouble : public RowTypeMatrix<FRowsptr<FMatDsptr>> {
public:
FullMatrixFullMatrixDouble() : FullMatrixTemplate<FMatDsptr>() {};
explicit FullMatrixFullMatrixDouble(int m) : FullMatrixTemplate<FMatDsptr>(m) {};
FullMatrixFullMatrixDouble(int m, int n) : FullMatrixTemplate<FMatDsptr>(m, n) {};
FullMatrixFullMatrixDouble() = default;
explicit FullMatrixFullMatrixDouble(int m) : RowTypeMatrix<FRowsptr<FMatDsptr>>(m)
{
}
FullMatrixFullMatrixDouble(int m, int n) {
for (int i = 0; i < m; i++) {
auto row = std::make_shared<FullRow<FMatDsptr>>(n);
this->push_back(row);
}
}
double maxMagnitude() override;
void zeroSelf() override;
std::shared_ptr<FullMatrixFullMatrixDouble> times(double a);
std::shared_ptr<FullMatrixFullMatrixDouble> timesTransposeFullMatrix(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat);
double sumOfSquares() override;
void identity() override;
void identity();
static std::shared_ptr<MbD::FullMatrixFullMatrixDouble> identitysptr(int n);
};
//
// FULL MATRIX FULL COLUMN DOUBLE instantiation
// FULL MATRIX FULL COLUMN DOUBLE
//
class FullMatrixFullColumnDouble : public FullMatrixTemplate<FColDsptr> {
class FullMatrixFullColumnDouble : public RowTypeMatrix<FRowsptr<FColDsptr>> {
public:
FullMatrixFullColumnDouble() : FullMatrixTemplate<FColDsptr>() {};
explicit FullMatrixFullColumnDouble(int m) : FullMatrixTemplate<FColDsptr>(m) {};
FullMatrixFullColumnDouble(int m, int n) : FullMatrixTemplate<FColDsptr>(m, n) {};
FullMatrixFullColumnDouble() = default;
explicit FullMatrixFullColumnDouble(int m) : RowTypeMatrix<FRowsptr<FColDsptr>>(m)
{
}
FullMatrixFullColumnDouble(int m, int n) {
for (int i = 0; i < m; i++) {
auto row = std::make_shared<FullRow<FColDsptr>>(n);
this->push_back(row);
}
}
std::shared_ptr<FullMatrixFullColumnDouble> times(double a);
std::shared_ptr<FullMatrixFullColumnDouble> timesTransposeFullMatrix(std::shared_ptr<FullMatrixFullColumnDouble> fullMat);
double maxMagnitude() override;
void zeroSelf() override;
double sumOfSquares() override;
void identity() override;
static std::shared_ptr<MbD::FullMatrixFullColumnDouble> identitysptr(int n);
void symLowerWithUpper();
std::shared_ptr<FullMatrixFullColumnDouble> times(double a);
};
}

View File

@@ -1,6 +1,7 @@
#pragma once
#include "FullColumn.ref.h"
#include <algorithm>
namespace MbD {
class FullMatrixDouble;

View File

@@ -7,65 +7,64 @@
***************************************************************************/
#include "FullRow.h"
#include "FullMatrix.h"
using namespace MbD;
template<typename T>
std::shared_ptr<FullMatrixDouble> FullRow<T>::transposeTimesFullRow(FRowsptr<T> fullRow)
{
//"a*b = a(i)b(j)"
auto nrow = (int)this->size();
auto answer = std::make_shared<FullMatrixDouble>(nrow);
for (int i = 0; i < nrow; i++)
namespace MbD {
template<typename T>
std::shared_ptr<FullMatrixDouble> FullRow<T>::transposeTimesFullRow(FRowsptr<T> fullRow)
{
answer->atiput(i, fullRow->times(this->at(i)));
//"a*b = a(i)b(j)"
auto nrow = (int)this->size();
auto answer = std::make_shared<FullMatrixDouble>(nrow);
for (int i = 0; i < nrow; i++)
{
answer->atiput(i, fullRow->times(this->at(i)));
}
return answer;
}
return answer;
}
template<typename T>
inline FRowsptr<T> FullRow<T>::timesTransposeFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
//"a*bT = a(1,j)b(k,j)"
int ncol = fullMat->nrow();
auto answer = std::make_shared<FullRow<T>>(ncol);
for (int k = 0; k < ncol; k++) {
answer->at(k) = this->dot(fullMat->at(k));
}
return answer;
}
template<typename T>
inline FRowsptr<T> FullRow<T>::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat)
{
//"a*bT = a(1,j)b(k,j)"
int ncol = fullMat->nrow();
auto answer = std::make_shared<FullRow<T>>(ncol);
for (int k = 0; k < ncol; k++) {
answer->at(k) = this->dot(fullMat->at(k));
}
return answer;
}
template<typename T>
inline FRowsptr<T> FullRow<T>::timesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
FRowsptr<T> answer = fullMat->at(0)->times(this->at(0));
for (int j = 1; j < (int) this->size(); j++)
template<typename T>
FRowsptr<T> FullRow<T>::timesTransposeFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j));
//"a*bT = a(1,j)b(k,j)"
int ncol = fullMat->nrow();
auto answer = std::make_shared<FullRow<T>>(ncol);
for (int k = 0; k < ncol; k++) {
answer->at(k) = this->dot(fullMat->at(k));
}
return answer;
}
return answer;
}
template<typename T>
inline FRowsptr<T> FullRow<T>::timesFullMatrixForFMFMDsptr(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat)
{
FRowsptr<T> answer = fullMat->at(0)->times(this->at(0));
for (int j = 1; j < (int) this->size(); j++)
template<typename T>
FRowsptr<T> FullRow<T>::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat)
{
answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j));
//"a*bT = a(1,j)b(k,j)"
int ncol = fullMat->nrow();
auto answer = std::make_shared<FullRow<T>>(ncol);
for (int k = 0; k < ncol; k++) {
answer->at(k) = this->dot(fullMat->at(k));
}
return answer;
}
template<typename T>
FRowsptr<T> FullRow<T>::timesFullMatrix(std::shared_ptr<FullMatrixDouble> fullMat)
{
FRowsptr<T> answer = fullMat->at(0)->times(this->at(0));
for (int j = 1; j < (int) this->size(); j++)
{
answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j));
}
return answer;
}
template<typename T>
FRowsptr<T> FullRow<T>::timesFullMatrixForFMFMDsptr(std::shared_ptr<FullMatrixFullMatrixDouble> fullMat)
{
FRowsptr<T> answer = fullMat->at(0)->times(this->at(0));
for (int j = 1; j < (int) this->size(); j++)
{
answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j));
}
return answer;
}
return answer;
}

View File

@@ -10,9 +10,13 @@
#include <string>
#include <vector>
#include "FullColumn.ref.h"
#include "FullRow.ref.h"
#include "DiagonalMatrix.ref.h"
#include "FullMatrix.ref.h"
#include "FullColumn.h"
// #include "FullMatrix.h"
#include "FullRow.h"
#include "FullMatrix.h"
#include "DiagonalMatrix.h"
#include "SparseMatrix.h"
#include "enum.h"

View File

@@ -164,7 +164,7 @@ FMatDsptr MbD::MBDynItem::readOrientation(std::vector<std::string>& args)
auto ref = mbdynReferences()->at(refName);
auto aAFf = readBasicOrientation(args);
auto aAOF = ref->aAOf;
aAOf = toFMDsptr(aAOF->timesFullMatrix(aAFf));
aAOf = aAOF->timesFullMatrix(aAFf);
}
else if (str.find("hinge") != std::string::npos) {
args.erase(args.begin());

View File

@@ -21,7 +21,7 @@ void MbD::MBDynMarker::parseMBDyn(std::vector<std::string>& args)
auto rOmO = readPosition(args);
auto aAOm = readOrientation(args);
rPmP = aAOP->transposeTimesFullColumn(rOmO->minusFullColumn(rOPO));
aAPm = toFMDsptr(aAOP->transposeTimesFullMatrix(aAOm));
aAPm = aAOP->transposeTimesFullMatrix(aAOm);
}
else if (str.find("offset") != std::string::npos) {
rPmP = readPosition(args);

View File

@@ -70,13 +70,13 @@ void MarkerFrame::calcPostDynCorrectorIteration()
auto rOpO = partFrame->rOpO();
auto aAOp = partFrame->aAOp();
rOmO = rOpO->plusFullColumn(aAOp->timesFullColumn(rpmp));
aAOm = toFMDsptr(aAOp->timesFullMatrix(aApm));
aAOm = aAOp->timesFullMatrix(aApm);
auto pAOppE = partFrame->pAOppE();
for (int i = 0; i < 4; i++)
{
auto& pAOppEi = pAOppE->at(i);
prOmOpE->atijputFullColumn(0, i, pAOppEi->timesFullColumn(rpmp));
pAOmpE->at(i) = toFMDsptr(pAOppEi->timesFullMatrix(aApm));
pAOmpE->at(i) = pAOppEi->timesFullMatrix(aApm);
}
}

View File

@@ -188,7 +188,7 @@ void MbD::MomentOfInertiaSolver::calcJoo()
auto term22 = rPoPtilde->timesFullMatrix(rocmPtilde);
auto term23 = term22->transpose();
auto term2 = term21->plusFullMatrix(term22)->plusFullMatrix(term23)->times(m);
aJoo = toFMDsptr(aAPo->transposeTimesFullMatrix(term1->plusFullMatrix(term2))->timesFullMatrix(aAPo));
aJoo = aAPo->transposeTimesFullMatrix(term1->plusFullMatrix(term2))->timesFullMatrix(aAPo);
aJoo->symLowerWithUpper();
aJoo->conditionSelfWithTol(aJoo->maxMagnitude() * 1.0e-6);
}
@@ -198,7 +198,7 @@ void MbD::MomentOfInertiaSolver::calcJpp()
//"aJcmP = aJPP + mass*(rPcmPTilde*rPcmPTilde)"
auto rPcmPtilde = FullMatrixDouble::tildeMatrix(rPcmP);
aJcmP = toFMDsptr(aJPP->plusFullMatrix(rPcmPtilde->timesFullMatrix(rPcmPtilde)->times(m)));
aJcmP = aJPP->plusFullMatrix(rPcmPtilde->timesFullMatrix(rPcmPtilde)->times(m));
aJcmP->symLowerWithUpper();
aJcmP->conditionSelfWithTol(aJcmP->maxMagnitude() * 1.0e-6);
if (aJcmP->isDiagonal()) {
@@ -249,7 +249,7 @@ FColDsptr MbD::MomentOfInertiaSolver::eigenvectorFor(double lam)
//"[aJcmP] - lam[I]."
double e0, e1, e2;
aJcmPcopy = toFMDsptr(aJcmP->copy());
aJcmPcopy = aJcmP->copy();
colOrder = std::make_shared<FullRow<int>>(3);
auto eigenvector = std::make_shared<FullColumn<double>>(3);
for (int i = 0; i < 3; i++)

View File

@@ -462,7 +462,7 @@ void Part::calcmEdot()
auto a4J = aJ->times(4.0);
auto term1 = aC->transposeTimesFullMatrix(a4J->timesFullMatrix(aCdot));
auto term2 = term1->transpose();
mEdot = toFMDsptr(term1->plusFullMatrix(term2));
mEdot = term1->plusFullMatrix(term2);
}
void Part::calcpTpE()
@@ -479,7 +479,7 @@ void Part::calcppTpEpE()
auto& qEdot = partFrame->qEdot;
auto pCpEtimesqEdot = EulerParameters<double>::pCpEtimesColumn(qEdot);
auto a4J = aJ->times(4.0);
ppTpEpE = toFMDsptr(pCpEtimesqEdot->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot)));
ppTpEpE = pCpEtimesqEdot->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot));
}
void Part::calcppTpEpEdot()
@@ -491,13 +491,13 @@ void Part::calcppTpEpEdot()
auto term1 = EulerParameters<double>::pCTpEtimesColumn(a4J->timesFullColumn(aC->timesFullColumn(qEdot)));
auto pCpEtimesqEdot = EulerParameters<double>::pCpEtimesColumn(qEdot);
auto term2 = aC->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot));
ppTpEpEdot = toFMDsptr(term1->plusFullMatrix(term2)->transpose());
ppTpEpEdot = term1->plusFullMatrix(term2)->transpose();
}
void Part::calcmE()
{
auto aC = partFrame->aC();
mE = toFMDsptr(aC->transposeTimesFullMatrix(aJ->timesFullMatrix(aC))->times(4.0));
mE = aC->transposeTimesFullMatrix(aJ->timesFullMatrix(aC))->times(4.0);
}
void Part::fillAccICIterError(FColDsptr col)

View File

@@ -53,14 +53,14 @@ void MbD::RackPinConstraintIqcJc::calc_pGpXI()
void MbD::RackPinConstraintIqcJc::calc_ppGpEIpEI()
{
ppGpEIpEI = toFMDsptr(xIeJeIe->ppvaluepEIpEI()
->plusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitchRadius)));
ppGpEIpEI = xIeJeIe->ppvaluepEIpEI()
->plusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitchRadius));
}
void MbD::RackPinConstraintIqcJc::calc_ppGpXIpEI()
{
ppGpXIpEI = toFMDsptr(xIeJeIe->ppvaluepXIpEI()
->plusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitchRadius)));
ppGpXIpEI = xIeJeIe->ppvaluepXIpEI()
->plusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitchRadius));
}
void MbD::RackPinConstraintIqcJc::calcPostDynCorrectorIteration()

View File

@@ -30,20 +30,20 @@ void MbD::RackPinConstraintIqcJqc::calc_pGpXJ()
void MbD::RackPinConstraintIqcJqc::calc_ppGpEIpEJ()
{
ppGpEIpEJ = toFMDsptr(xIeJeIe->ppvaluepEIpEJ()
->plusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitchRadius)));
ppGpEIpEJ = xIeJeIe->ppvaluepEIpEJ()
->plusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitchRadius));
}
void MbD::RackPinConstraintIqcJqc::calc_ppGpEIpXJ()
{
ppGpEIpXJ = toFMDsptr(xIeJeIe->ppvaluepEIpXJ()
->plusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitchRadius)));
ppGpEIpXJ = xIeJeIe->ppvaluepEIpXJ()
->plusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitchRadius));
}
void MbD::RackPinConstraintIqcJqc::calc_ppGpEJpEJ()
{
ppGpEJpEJ = toFMDsptr(xIeJeIe->ppvaluepEJpEJ()
->plusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitchRadius)));
ppGpEJpEJ = xIeJeIe->ppvaluepEJpEJ()
->plusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitchRadius));
}
void MbD::RackPinConstraintIqcJqc::calcPostDynCorrectorIteration()

View File

@@ -55,14 +55,14 @@ void MbD::ScrewConstraintIqcJc::calc_pGpXI()
void MbD::ScrewConstraintIqcJc::calc_ppGpEIpEI()
{
ppGpEIpEI = toFMDsptr(zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch)));
ppGpEIpEI = zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch));
}
void MbD::ScrewConstraintIqcJc::calc_ppGpXIpEI()
{
ppGpXIpEI = toFMDsptr(zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch)));
ppGpXIpEI = zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch));
}
void MbD::ScrewConstraintIqcJc::calcPostDynCorrectorIteration()

View File

@@ -32,20 +32,20 @@ void MbD::ScrewConstraintIqcJqc::calc_pGpXJ()
void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpEJ()
{
ppGpEIpEJ = toFMDsptr(zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch)));
ppGpEIpEJ = zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch));
}
void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpXJ()
{
ppGpEIpXJ = toFMDsptr(zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch)));
ppGpEIpXJ = zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch));
}
void MbD::ScrewConstraintIqcJqc::calc_ppGpEJpEJ()
{
ppGpEJpEJ = toFMDsptr(zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch)));
ppGpEJpEJ = zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI)
->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch));
}
void MbD::ScrewConstraintIqcJqc::calcPostDynCorrectorIteration()

View File

@@ -30,10 +30,10 @@ void TranslationConstraintIqcJc::calcPostDynCorrectorIteration()
pGpXI = riIeqJeIeq->pvaluepXI();
pGpEI = (riIeqJeIeq->pvaluepEI())->plusFullRow(riIeqJeIeq->pvaluepEK());
ppGpXIpEI = riIeqJeIeq->ppvaluepXIpEK();
ppGpEIpEI = toFMDsptr(riIeqJeIeq->ppvaluepEIpEI()
ppGpEIpEI = riIeqJeIeq->ppvaluepEIpEI()
->plusFullMatrix(riIeqJeIeq->ppvaluepEIpEK())
->plusFullMatrix((riIeqJeIeq->ppvaluepEIpEK()->
transpose()->plusFullMatrix(riIeqJeIeq->ppvaluepEKpEK()))));
transpose()->plusFullMatrix(riIeqJeIeq->ppvaluepEKpEK())));
}
void TranslationConstraintIqcJc::useEquationNumbers()

View File

@@ -28,8 +28,8 @@ void TranslationConstraintIqcJqc::calcPostDynCorrectorIteration()
TranslationConstraintIqcJc::calcPostDynCorrectorIteration();
pGpXJ = riIeJeIe->pvaluepXJ();
pGpEJ = riIeJeIe->pvaluepEJ();
ppGpEIpXJ = toFMDsptr(riIeJeIe->ppvaluepXJpEK()->transpose());
ppGpEIpEJ = toFMDsptr(riIeJeIe->ppvaluepEJpEK()->transpose());
ppGpEIpXJ = riIeJeIe->ppvaluepXJpEK()->transpose();
ppGpEIpEJ = riIeJeIe->ppvaluepEJpEK()->transpose();
ppGpEJpEJ = riIeJeIe->ppvaluepEJpEJ();
}