From ede688e7dacba0603096ec08efcad6f75c9546e7 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 01:07:12 -0500 Subject: [PATCH] FullMatrix version are now all visible in lib. Now need FullColumn etc to work. --- CMakeLists.txt | 627 ++++++++++--------- OndselSolver/ASMTConstraintSet.cpp | 1 + OndselSolver/ASMTMarker.cpp | 1 + OndselSolver/DiagonalMatrix.cpp | 108 +++- OndselSolver/DiagonalMatrix.h | 110 +--- OndselSolver/EulerAnglesDDot.h | 4 +- OndselSolver/EulerParameters.cpp | 15 +- OndselSolver/EulerParameters.h | 6 +- OndselSolver/EulerParametersDot.h | 2 +- OndselSolver/FullColumn.cpp | 168 ++++- OndselSolver/FullColumn.h | 176 +----- OndselSolver/FullColumn.ref.h | 3 + OndselSolver/FullMatrix.cpp | 444 ++++--------- OndselSolver/FullMatrix.h | 196 +++--- OndselSolver/FullMatrix.ref.h | 1 + OndselSolver/FullRow.cpp | 103 ++- OndselSolver/Item.h | 8 +- OndselSolver/MBDynItem.cpp | 2 +- OndselSolver/MBDynMarker.cpp | 2 +- OndselSolver/MarkerFrame.cpp | 4 +- OndselSolver/MomentOfInertiaSolver.cpp | 6 +- OndselSolver/Part.cpp | 8 +- OndselSolver/RackPinConstraintIqcJc.cpp | 8 +- OndselSolver/RackPinConstraintIqcJqc.cpp | 12 +- OndselSolver/ScrewConstraintIqcJc.cpp | 8 +- OndselSolver/ScrewConstraintIqcJqc.cpp | 12 +- OndselSolver/TranslationConstraintIqcJc.cpp | 4 +- OndselSolver/TranslationConstraintIqcJqc.cpp | 4 +- 28 files changed, 939 insertions(+), 1104 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7ce907..95c5fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) + diff --git a/OndselSolver/ASMTConstraintSet.cpp b/OndselSolver/ASMTConstraintSet.cpp index b6db283..bd1f36c 100644 --- a/OndselSolver/ASMTConstraintSet.cpp +++ b/OndselSolver/ASMTConstraintSet.cpp @@ -10,6 +10,7 @@ #include "ASMTAssembly.h" #include "ASMTMarker.h" #include "Joint.h" +#include "FullMatrix.h" using namespace MbD; diff --git a/OndselSolver/ASMTMarker.cpp b/OndselSolver/ASMTMarker.cpp index db8d78a..c356bf6 100644 --- a/OndselSolver/ASMTMarker.cpp +++ b/OndselSolver/ASMTMarker.cpp @@ -7,6 +7,7 @@ ***************************************************************************/ #include "ASMTMarker.h" +#include "FullMatrix.h" #include "ASMTRefItem.h" #include "ASMTPart.h" #include "Part.h" diff --git a/OndselSolver/DiagonalMatrix.cpp b/OndselSolver/DiagonalMatrix.cpp index 13bba29..b5b60da 100644 --- a/OndselSolver/DiagonalMatrix.cpp +++ b/OndselSolver/DiagonalMatrix.cpp @@ -7,5 +7,111 @@ ***************************************************************************/ #include "DiagonalMatrix.h" +#include "FullMatrix.h" -using namespace MbD; +namespace MbD { + + template<> + inline DiagMatDsptr DiagonalMatrix::times(double factor) + { + auto nrow = (int)this->size(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i) * factor; + } + return answer; + } + template + inline void DiagonalMatrix::atiputDiagonalMatrix(int i, std::shared_ptr> diagMat) + { + for (int ii = 0; ii < diagMat->size(); ii++) + { + this->at(i + ii) = diagMat->at(ii); + } + } + template + inline DiagMatsptr DiagonalMatrix::times(T factor) + { + assert(false); + } + template + inline FColsptr DiagonalMatrix::timesFullColumn(FColsptr fullCol) + { + //"a*b = a(i,j)b(j) sum j." + + auto nrow = (int)this->size(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i) * fullCol->at(i); + } + return answer; + } + template + inline FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) + { + auto nrow = (int)this->size(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = fullMat->at(i)->times(this->at(i)); + } + return answer; + } + template<> + inline double DiagonalMatrix::sumOfSquares() + { + double sum = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i); + sum += element * element; + } + return sum; + } + template + inline int DiagonalMatrix::numberOfElements() + { + auto n = (int)this->size(); + return n * n; + } + template<> + inline void DiagonalMatrix::zeroSelf() + { + for (int i = 0; i < this->size(); i++) { + this->at(i) = 0.0; + } + } + template<> + inline double DiagonalMatrix::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 + inline double DiagonalMatrix::maxMagnitude() + { + assert(false); + return 0.0; + } + template + inline std::ostream& DiagonalMatrix::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; + } + +} diff --git a/OndselSolver/DiagonalMatrix.h b/OndselSolver/DiagonalMatrix.h index f158195..ac73c50 100644 --- a/OndselSolver/DiagonalMatrix.h +++ b/OndselSolver/DiagonalMatrix.h @@ -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 @@ -41,107 +45,5 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - template<> - inline DiagMatDsptr DiagonalMatrix::times(double factor) - { - auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i) * factor; - } - return answer; - } - template - inline void DiagonalMatrix::atiputDiagonalMatrix(int i, std::shared_ptr> diagMat) - { - for (int ii = 0; ii < diagMat->size(); ii++) - { - this->at(i + ii) = diagMat->at(ii); - } - } - template - inline DiagMatsptr DiagonalMatrix::times(T factor) - { - assert(false); - } - template - inline FColsptr DiagonalMatrix::timesFullColumn(FColsptr fullCol) - { - //"a*b = a(i,j)b(j) sum j." - - auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i) * fullCol->at(i); - } - return answer; - } - template - inline FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) - { - auto nrow = (int)this->size(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = fullMat->at(i)->times(this->at(i)); - } - return answer; - } - template<> - inline double DiagonalMatrix::sumOfSquares() - { - double sum = 0.0; - for (int i = 0; i < this->size(); i++) - { - double element = this->at(i); - sum += element * element; - } - return sum; - } - template - inline int DiagonalMatrix::numberOfElements() - { - auto n = (int)this->size(); - return n * n; - } - template<> - inline void DiagonalMatrix::zeroSelf() - { - for (int i = 0; i < this->size(); i++) { - this->at(i) = 0.0; - } - } - template<> - inline double DiagonalMatrix::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 - inline double DiagonalMatrix::maxMagnitude() - { - assert(false); - return 0.0; - } - template - inline std::ostream& DiagonalMatrix::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; - } } diff --git a/OndselSolver/EulerAnglesDDot.h b/OndselSolver/EulerAnglesDDot.h index f724905..44edb61 100644 --- a/OndselSolver/EulerAnglesDDot.h +++ b/OndselSolver/EulerAnglesDDot.h @@ -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 inline void EulerAnglesDDot::aEulerAngles(EulerAngles* eulerAngles) diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 4c4b999..009e928 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -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::ppApEpEtimesMatrix(FMatDsptr mat) return answer; } -template<> -inline void EulerParameters::initialize() +template // this is ALWAYS double; see note below. +inline void EulerParameters::initialize() { aA = FullMatrixDouble::identitysptr(3); aB = std::make_shared(3, 4); @@ -172,6 +175,14 @@ inline void EulerParameters::initialize() pApE->at(i) = std::make_shared(3, 3); } } + +// the following can't be valid as FullMatrix instatiatiates , yet +// this class needs to see the member functions of FullMatrix +//template<> +//inline void EulerParameters::initialize() +//{ +//} + template inline void EulerParameters::calc() { diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 05d475b..2d93041 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -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 { diff --git a/OndselSolver/EulerParametersDot.h b/OndselSolver/EulerParametersDot.h index 2423cc4..6389f13 100644 --- a/OndselSolver/EulerParametersDot.h +++ b/OndselSolver/EulerParametersDot.h @@ -185,7 +185,7 @@ namespace MbD { inline FColDsptr EulerParametersDot::omeOpO() { auto aaa = this->aB(); - auto bbb = aaa->timesFullColumn(this); + auto bbb = aaa->timesFullColumn((MbD::FColsptr)this); auto ccc = bbb->times(2.0); return ccc; //return this->aB->timesFullColumn(this)->times(2.0); diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index e689f73..75af3f7 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -9,5 +9,171 @@ #include #include "FullColumn.h" +#include "FullRow.h" +#include "FullMatrix.h" -using namespace MbD; +namespace MbD { + template + FColsptr FullColumn::plusFullColumn(FColsptr fullCol) + { + int n = (int) this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i) + fullCol->at(i); + } + return answer; + } + template + FColsptr FullColumn::minusFullColumn(FColsptr fullCol) + { + int n = (int) this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i) - fullCol->at(i); + } + return answer; + } + template<> + FColDsptr FullColumn::times(double a) + { + int n = (int)this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i) * a; + } + return answer; + } + template + FColsptr FullColumn::times(T a) + { + assert(false); + } + template + FColsptr FullColumn::negated() + { + return this->times(-1.0); + } + template + void FullColumn::atiputFullColumn(int i, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + this->at(i + ii) = fullCol->at(ii); + } + } + template + void FullColumn::atiplusFullColumn(int i, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + this->at(i + ii) += fullCol->at(ii); + } + } + template + void FullColumn::equalSelfPlusFullColumnAt(FColsptr fullCol, int ii) + { + //self is subcolumn of fullCol + for (int i = 0; i < this->size(); i++) + { + this->at(i) += fullCol->at(ii + i); + } + } + template + void FullColumn::atiminusFullColumn(int i1, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + int i = i1 + ii; + this->at(i) -= fullCol->at(ii); + } + } + template + void FullColumn::equalFullColumnAt(FColsptr 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::copy() + { + auto n = (int) this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) + { + answer->at(i) = this->at(i); + } + return answer; + } + template + FRowsptr FullColumn::transpose() + { + return std::make_shared>(*this); + } + template + void FullColumn::atiplusFullColumntimes(int i1, FColsptr fullCol, T factor) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + int i = i1 + ii; + this->at(i) += fullCol->at(ii) * factor; + } + } + template + T FullColumn::transposeTimesFullColumn(const FColsptr fullCol) + { + return this->dot(fullCol); + } + template + void FullColumn::equalSelfPlusFullColumntimes(FColsptr fullCol, T factor) + { + this->equalSelfPlusFullVectortimes(fullCol, factor); + } + template + FColsptr FullColumn::cross(FColsptr 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>(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::simplified() + //{ + // auto n = this->size(); + // auto answer = std::make_shared>(n); + // for (int i = 0; i < n; i++) + // { + // auto func = this->at(i); + // answer->at(i) = func->simplified(func); + // } + // return answer; + //} + template + FColsptr FullColumn::simplified() + { + assert(false); + return FColsptr(); + } + template + std::ostream& FullColumn::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; + } +} \ No newline at end of file diff --git a/OndselSolver/FullColumn.h b/OndselSolver/FullColumn.h index 4f495bb..9088a97 100644 --- a/OndselSolver/FullColumn.h +++ b/OndselSolver/FullColumn.h @@ -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 -// class FullColumn; -// using FColDsptr = std::shared_ptr>; -// template -// using FColsptr = std::shared_ptr>; -// template -// class FullRow; -// template -// using FRowsptr = std::shared_ptr>; class Symbolic; template @@ -58,168 +48,6 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - template - inline FColsptr FullColumn::plusFullColumn(FColsptr fullCol) - { - int n = (int) this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i) + fullCol->at(i); - } - return answer; - } - template - inline FColsptr FullColumn::minusFullColumn(FColsptr fullCol) - { - int n = (int) this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i) - fullCol->at(i); - } - return answer; - } - template<> - inline FColDsptr FullColumn::times(double a) - { - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i) * a; - } - return answer; - } - template - inline FColsptr FullColumn::times(T a) - { - assert(false); - } - template - inline FColsptr FullColumn::negated() - { - return this->times(-1.0); - } - template - inline void FullColumn::atiputFullColumn(int i, FColsptr fullCol) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - this->at(i + ii) = fullCol->at(ii); - } - } - template - inline void FullColumn::atiplusFullColumn(int i, FColsptr fullCol) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - this->at(i + ii) += fullCol->at(ii); - } - } - template - inline void FullColumn::equalSelfPlusFullColumnAt(FColsptr fullCol, int ii) - { - //self is subcolumn of fullCol - for (int i = 0; i < this->size(); i++) - { - this->at(i) += fullCol->at(ii + i); - } - } - template - inline void FullColumn::atiminusFullColumn(int i1, FColsptr fullCol) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - int i = i1 + ii; - this->at(i) -= fullCol->at(ii); - } - } - template - inline void FullColumn::equalFullColumnAt(FColsptr 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::copy() - { - auto n = (int) this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) - { - answer->at(i) = this->at(i); - } - return answer; - } - template - inline FRowsptr FullColumn::transpose() - { - return std::make_shared>(*this); - } - template - inline void FullColumn::atiplusFullColumntimes(int i1, FColsptr fullCol, T factor) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - int i = i1 + ii; - this->at(i) += fullCol->at(ii) * factor; - } - } - template - inline T FullColumn::transposeTimesFullColumn(const FColsptr fullCol) - { - return this->dot(fullCol); - } - template - inline void FullColumn::equalSelfPlusFullColumntimes(FColsptr fullCol, T factor) - { - this->equalSelfPlusFullVectortimes(fullCol, factor); - } - template - inline FColsptr FullColumn::cross(FColsptr 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>(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::simplified() - //{ - // auto n = this->size(); - // auto answer = std::make_shared>(n); - // for (int i = 0; i < n; i++) - // { - // auto func = this->at(i); - // answer->at(i) = func->simplified(func); - // } - // return answer; - //} - template - inline FColsptr FullColumn::simplified() - { - assert(false); - return FColsptr(); - } - template - inline std::ostream& FullColumn::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; } diff --git a/OndselSolver/FullColumn.ref.h b/OndselSolver/FullColumn.ref.h index 7673a9c..d622179 100644 --- a/OndselSolver/FullColumn.ref.h +++ b/OndselSolver/FullColumn.ref.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + namespace MbD { template class FullColumn; diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 5989ad5..6087540 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -13,68 +13,29 @@ #include "EulerParameters.h" namespace MbD { -// template -// -// inline std::shared_ptr> rotatex(T the) + FColsptr FullMatrixDouble::timesFullColumn(FColsptr fullCol) + { +// return this->timesFullColumn(fullCol.get()); + auto nrow = this->nrow(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i)->timesFullColumn(fullCol); + } + return answer; + } +// FColsptr timesFullColumn(FullColumn* fullCol) // local // { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto rotMat = std::make_shared>(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>(nrow); +// for (int i = 0; i < nrow; i++) +// { +// answer->at(i) = this->at(i)->timesFullColumn(fullCol); +// } +// return answer; // } -// template -// inline std::shared_ptr> rotatey(T the) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto rotMat = std::make_shared>(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 -// inline std::shared_ptr> rotatez(T the) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto rotMat = std::make_shared>(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 rotatex(double the) + std::shared_ptr 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 rotatey(double the) + std::shared_ptr 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 rotatez(double the) + std::shared_ptr 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 -// inline std::shared_ptr> 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>(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 -// inline std::shared_ptr> 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>(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 -// inline std::shared_ptr> 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>(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 rotatexrotDot(double the, double thedot) + std::shared_ptr 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 rotateyrotDot(double the, double thedot) + std::shared_ptr 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 rotatezrotDot(double the, double thedot) + std::shared_ptr 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 - inline std::shared_ptr> rotatexrotDotrotDDot(T the, T thedot, T theddot) + std::shared_ptr 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>(3, 3); + auto rotMat = std::make_shared(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 - inline std::shared_ptr> rotateyrotDotrotDDot(T the, T thedot, T theddot) + std::shared_ptr 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>(3, 3); + auto rotMat = std::make_shared(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 - inline std::shared_ptr> rotatezrotDotrotDDot(T the, T thedot, T theddot) + std::shared_ptr 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>(3, 3); + auto rotMat = std::make_shared(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 - inline std::shared_ptr> FullMatrixTemplate::identitysptr(int n) - { - auto mat = std::make_shared>(n, n); - mat->identity(); - return mat; - } - inline std::shared_ptr FullMatrixDouble::identitysptr(int n) + std::shared_ptr FullMatrixDouble::identitysptr(int n) { auto mat = std::make_shared(n, n); mat->identity(); return mat; } - inline std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) + std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) { auto mat = std::make_shared(n, n); mat->identity(); return mat; } - template - inline std::shared_ptr> FullMatrixTemplate::tildeMatrix(FColDsptr col) + std::shared_ptr 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::zeroSelf() + void FullMatrixDouble::zeroSelf() { for (int i = 0; i < this->size(); i++) { this->at(i)->zeroSelf(); } } - template - inline void FullMatrixTemplate::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 - inline FColsptr FullMatrixTemplate::column(int j) { + // TODO: should there be a FullMatrixFullColumnDouble version of this? + FColsptr FullMatrixDouble::column(int j) { int n = (int)this->size(); - auto answer = std::make_shared>(n); + auto answer = std::make_shared>(n); for (int i = 0; i < n; i++) { answer->at(i) = this->at(i)->at(j); } return answer; } -// template -// inline std::shared_ptr> FullMatrixTemplate::timesFullMatrix(std::shared_ptr> fullMat) -// { -// int m = this->nrow(); -// auto answer = std::make_shared>(m); -// for (int i = 0; i < m; i++) { -// answer->at(i) = this->at(i)->timesFullMatrix(fullMat); -// } -// return answer; -// } - inline std::shared_ptr FullMatrixDouble::timesFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::timesFullMatrix(std::shared_ptr fullMat) { int m = this->nrow(); auto answer = std::make_shared(m); @@ -423,7 +304,7 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) { int nrow = this->nrow(); auto answer = std::make_shared(nrow); @@ -432,7 +313,7 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) { int nrow = this->nrow(); auto answer = std::make_shared(nrow); @@ -441,7 +322,7 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixDouble::times(double a) + std::shared_ptr FullMatrixDouble::times(double a) { int m = this->nrow(); auto answer = std::make_shared(m); @@ -451,11 +332,11 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixFullMatrixDouble::times(double a) + std::shared_ptr FullMatrixFullMatrixDouble::times(double a) { assert(false); } - inline std::shared_ptr FullMatrixFullColumnDouble::times(double a) + std::shared_ptr FullMatrixFullColumnDouble::times(double a) { // int m = this->nrow(); // auto answer = std::make_shared(m); @@ -465,31 +346,11 @@ namespace MbD { // return answer; assert(false); } - template - inline std::shared_ptr> FullMatrixTemplate::times(T a) - { - assert(false); - } -// template -// inline std::shared_ptr> FullMatrixTemplate::transposeTimesFullMatrix(std::shared_ptr> fullMat) -// { -// return this->transpose()->timesFullMatrix(fullMat); -// } - inline std::shared_ptr FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr fullMat) { return this->transpose()->timesFullMatrix(fullMat); } -// template -// inline std::shared_ptr> FullMatrixTemplate::plusFullMatrix(std::shared_ptr> fullMat) -// { -// int n = (int)this->size(); -// auto answer = std::make_shared>(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::plusFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::plusFullMatrix(std::shared_ptr fullMat) { int n = (int)this->size(); auto answer = std::make_shared(n); @@ -498,31 +359,16 @@ namespace MbD { } return answer; } - template - inline std::shared_ptr> FullMatrixTemplate::minusFullMatrix(std::shared_ptr> fullMat) + std::shared_ptr FullMatrixDouble::minusFullMatrix(std::shared_ptr fullMat) { int n = (int)this->size(); - auto answer = std::make_shared>(n); + auto answer = std::make_shared(n); for (int i = 0; i < n; i++) { answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i)); } return answer; } -// template -// inline std::shared_ptr> FullMatrixTemplate::transpose() -// { -// int nrow = this->nrow(); -// auto ncol = this->ncol(); -// auto answer = std::make_shared>(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::transpose() { + std::shared_ptr FullMatrixDouble::transpose() { int nrow = this->nrow(); auto ncol = this->ncol(); auto answer = std::make_shared(ncol, nrow); @@ -534,17 +380,11 @@ namespace MbD { } return answer; } -// template -// inline std::shared_ptr> FullMatrixTemplate::negated() -// { -// return this->times(-1.0); -// } - inline std::shared_ptr FullMatrixDouble::negated() + std::shared_ptr FullMatrixDouble::negated() { return this->times(-1.0); } - template - inline void FullMatrixTemplate::symLowerWithUpper() + void FullMatrixDouble::symLowerWithUpper() { int n = (int)this->size(); for (int i = 0; i < n; i++) { @@ -553,42 +393,45 @@ namespace MbD { } } } - template - inline void FullMatrixTemplate::atiput(int i, FRowsptr 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 fullRow) { this->at(i) = fullRow; } - template - inline void FullMatrixTemplate::atijput(int i, int j, T value) + void FullMatrixDouble::atijput(int i, int j, double value) { this->at(i)->atiput(j, value); } - template - inline void FullMatrixTemplate::atijputFullColumn(int i1, int j1, FColsptr fullCol) + void FullMatrixDouble::atijputFullColumn(int i1, int j1, FColsptr fullCol) { for (int ii = 0; ii < fullCol->size(); ii++) { this->at(i1 + ii)->at(j1) = fullCol->at(ii); } } - template - inline void FullMatrixTemplate::atijplusFullRow(int i, int j, FRowsptr fullRow) + void FullMatrixDouble::atijplusFullRow(int i, int j, FRowsptr fullRow) { this->at(i)->atiplusFullRow(j, fullRow); } - template - inline void FullMatrixTemplate::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 - inline void FullMatrixTemplate::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 - inline double FullMatrixTemplate::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 - inline void FullMatrixTemplate::zeroSelf() - { - assert(false); - } -// template -// inline std::shared_ptr> FullMatrixTemplate::copy() -// { -// auto m = (int)this->size(); -// auto answer = std::make_shared>(m); -// for (int i = 0; i < m; i++) -// { -// answer->at(i) = this->at(i)->copy(); -// } -// return answer; -// } - inline std::shared_ptr FullMatrixDouble::copy() + std::shared_ptr FullMatrixDouble::copy() { auto m = (int)this->size(); auto answer = std::make_shared(m); @@ -639,31 +468,27 @@ namespace MbD { } return answer; } - template - inline FullMatrixTemplate FullMatrixTemplate::operator+(const FullMatrixTemplate fullMat) + FullMatrixDouble FullMatrixDouble::operator+(const FullMatrixDouble fullMat) { int n = (int)this->size(); - auto answer = FullMatrixTemplate(n); + FullMatrixDouble answer(n); for (int i = 0; i < n; i++) { answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i)); } return answer; } - template - inline FColsptr FullMatrixTemplate::transposeTimesFullColumn(FColsptr fullCol) + FColsptr FullMatrixDouble::transposeTimesFullColumn(FColsptr fullCol) { - auto sptr = std::make_shared>(*this); + auto sptr = std::make_shared(*this); return fullCol->transpose()->timesFullMatrix(sptr)->transpose(); } - template - inline void FullMatrixTemplate::magnifySelf(T factor) + void FullMatrixDouble::magnifySelf(double factor) { for (int i = 0; i < this->size(); i++) { this->at(i)->magnifySelf(factor); } } - template - inline std::ostream& FullMatrixTemplate::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 - inline std::shared_ptr> FullMatrixTemplate::asEulerParameters() + std::shared_ptr> 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>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why? - auto qE = std::make_shared>(4); + auto qE = std::make_shared>(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 - inline T FullMatrixTemplate::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 - inline double FullMatrixTemplate::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 - inline FColsptr FullMatrixTemplate::bryantAngles() + double FullMatrixFullMatrixDouble::maxMagnitude() { - auto answer = std::make_shared>(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 FullMatrixDouble::bryantAngles() + { + auto answer = std::make_shared>(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 - inline bool FullMatrixTemplate::isDiagonal() + bool FullMatrixDouble::isDiagonal() { auto m = this->nrow(); auto n = this->ncol(); @@ -807,8 +647,7 @@ namespace MbD { } return true; } - template - inline bool FullMatrixTemplate::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 - inline std::shared_ptr> FullMatrixTemplate::asDiagonalMatrix() + std::shared_ptr> FullMatrixDouble::asDiagonalMatrix() { int nrow = this->nrow(); - auto diagMat = std::make_shared>(nrow); + auto diagMat = std::make_shared>(nrow); for (int i = 0; i < nrow; i++) { diagMat->atiput(i, this->at(i)->at(i)); } return diagMat; } - template - inline void FullMatrixTemplate::conditionSelfWithTol(double tol) + void FullMatrixDouble::conditionSelfWithTol(double tol) { for (auto row : *this) { row->conditionSelfWithTol(tol); } } - template - inline FColsptr FullMatrixTemplate::timesFullColumn(FColsptr fullCol) - { - return this->timesFullColumn(fullCol.get()); - } - template - inline FColsptr FullMatrixTemplate::timesFullColumn(FullColumn* fullCol) - { - //"a*b = a(i,j)b(j) sum j." - auto nrow = this->nrow(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i)->timesFullColumn(fullCol); - } - return answer; - } } diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index 28a8eba..d0d53d1 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -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 - class FullMatrixTemplate : public RowTypeMatrix> - { - public: - FullMatrixTemplate() = default; - explicit FullMatrixTemplate(int m) : RowTypeMatrix>(m) - { - } - FullMatrixTemplate(int m, int n) { - for (int i = 0; i < m; i++) { - auto row = std::make_shared>(n); - this->push_back(row); - } - } - FullMatrixTemplate(std::initializer_list> listOfRows) { - for (auto& row : listOfRows) - { - this->push_back(row); - } - } - FullMatrixTemplate(std::initializer_list> list2D) { - for (auto& rowList : list2D) - { - auto row = std::make_shared>(rowList); - this->push_back(row); - } - } -// static std::shared_ptr> rotatex(T angle); -// static std::shared_ptr> rotatey(T angle); -// static std::shared_ptr> rotatez(T angle); -// static std::shared_ptr> rotatexrotDot(T angle, T angledot); -// static std::shared_ptr> rotateyrotDot(T angle, T angledot); -// static std::shared_ptr> rotatezrotDot(T angle, T angledot); - static std::shared_ptr> rotatexrotDotrotDDot(T angle, T angleDot, T angleDDot); - static std::shared_ptr> rotateyrotDotrotDDot(T angle, T angleDot, T angleDDot); - static std::shared_ptr> rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot); - static std::shared_ptr> identitysptr(int n); - static std::shared_ptr> tildeMatrix(FColDsptr col); - - virtual void identity(); - FColsptr column(int j); - FColsptr timesFullColumn(FColsptr fullCol); - FColsptr timesFullColumn(FullColumn* fullCol); - // std::shared_ptr> timesFullMatrix(std::shared_ptr> fullMat); - - virtual std::shared_ptr> timesTransposeFullMatrix(std::shared_ptr> fullMat); - - std::shared_ptr> times(T a); - // std::shared_ptr> transposeTimesFullMatrix(std::shared_ptr> fullMat); - // std::shared_ptr> plusFullMatrix(std::shared_ptr> fullMat); - std::shared_ptr> minusFullMatrix(std::shared_ptr> fullMat); - // std::shared_ptr> transpose(); -// std::shared_ptr> negated(); - void symLowerWithUpper(); - void atiput(int i, FRowsptr fullRow) override; - void atijput(int i, int j, T value); - void atijputFullColumn(int i, int j, FColsptr fullCol); - void atijplusFullRow(int i, int j, FRowsptr 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> copy(); - FullMatrixTemplate operator+(const FullMatrixTemplate fullMat); - FColsptr transposeTimesFullColumn(const FColsptr fullCol); - void magnifySelf(T factor); - std::shared_ptr> asEulerParameters(); - T trace(); - double maxMagnitude() override; - FColsptr bryantAngles(); - bool isDiagonal(); - bool isDiagonalToWithin(double ratio); - std::shared_ptr> asDiagonalMatrix(); - void conditionSelfWithTol(double tol); - - std::ostream& printOn(std::ostream& s) const override; - }; - // - // FULL MATRIX DOUBLE instantiation + // FULL MATRIX DOUBLE // - class FullMatrixDouble : public FullMatrixTemplate { + class FullMatrixDouble : public RowTypeMatrix> { public: - FullMatrixDouble() : FullMatrixTemplate() {}; - explicit FullMatrixDouble(int m) : FullMatrixTemplate(m) {}; - FullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; - FullMatrixDouble(std::initializer_list> list2D) : FullMatrixTemplate(list2D) {} - FullMatrixDouble(std::initializer_list> listOfRows) : FullMatrixTemplate(listOfRows) {}; + FullMatrixDouble() = default; + explicit FullMatrixDouble(int m) : RowTypeMatrix>(m) + { + } + FullMatrixDouble(int m, int n) { + for (int i = 0; i < m; i++) { + auto row = std::make_shared>(n); + this->push_back(row); + } + } + FullMatrixDouble(std::initializer_list> listOfRows) { + for (auto& row : listOfRows) + { + this->push_back(row); + } + } + FullMatrixDouble(std::initializer_list> list2D) { + for (auto& rowList : list2D) + { + auto row = std::make_shared>(rowList); + this->push_back(row); + } + } std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); - void identity() override; + void identity(); static std::shared_ptr identitysptr(int n); - double sumOfSquares(); + double sumOfSquares() override; std::shared_ptr transposeTimesFullMatrix(std::shared_ptr fullMat); std::shared_ptr timesFullMatrix(std::shared_ptr fullMat); std::shared_ptr transpose(); @@ -125,37 +68,82 @@ namespace MbD { static std::shared_ptr rotatexrotDot(double angle, double angledot); static std::shared_ptr rotateyrotDot(double angle, double angledot); static std::shared_ptr rotatezrotDot(double angle, double angledot); - std::shared_ptr copy(); + static std::shared_ptr rotatexrotDotrotDDot(double angle, double angleDot, double angleDDot); + static std::shared_ptr rotateyrotDotrotDDot(double angle, double angleDot, double angleDDot); + static std::shared_ptr rotatezrotDotrotDDot(double angle, double angleDot, double angleDDot); + static std::shared_ptr tildeMatrix(FColDsptr col); + void zeroSelf() override; + FColsptr column(int j); + + void atiput(int i, FRowsptr fullRow); + void atijput(int i, int j, double value); + std::shared_ptr copy(); + double maxMagnitude() override; + FullMatrixDouble operator+(const FullMatrixDouble fullMat); + std::shared_ptr minusFullMatrix(std::shared_ptr fullMat); + FColsptr transposeTimesFullColumn(FColsptr fullCol); + void symLowerWithUpper(); + void atijputFullColumn(int i1, int j1, FColsptr fullCol); + void atijplusFullRow(int i, int j, FRowsptr fullRow); + void atijplusNumber(int i, int j, double value); + void atijminusNumber(int i, int j, double value); + void magnifySelf(double factor); + std::shared_ptr> asEulerParameters(); + FColsptr bryantAngles(); + double trace(); + bool isDiagonal(); + bool isDiagonalToWithin(double ratio); + std::shared_ptr> asDiagonalMatrix(); + void conditionSelfWithTol(double tol); + std::ostream& printOn(std::ostream& s) const override; + FColsptr timesFullColumn(FColsptr fullCol); + // FColsptr timesFullColumn(FullColumn* fullCol); }; // - // FULL MATRIX FULL MATRIX DOUBLE instantiation + // FULL MATRIX FULL MATRIX DOUBLE // - class FullMatrixFullMatrixDouble : public FullMatrixTemplate { + class FullMatrixFullMatrixDouble : public RowTypeMatrix> { public: - FullMatrixFullMatrixDouble() : FullMatrixTemplate() {}; - explicit FullMatrixFullMatrixDouble(int m) : FullMatrixTemplate(m) {}; - FullMatrixFullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; + FullMatrixFullMatrixDouble() = default; + explicit FullMatrixFullMatrixDouble(int m) : RowTypeMatrix>(m) + { + } + FullMatrixFullMatrixDouble(int m, int n) { + for (int i = 0; i < m; i++) { + auto row = std::make_shared>(n); + this->push_back(row); + } + } + double maxMagnitude() override; + void zeroSelf() override; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); double sumOfSquares() override; - void identity() override; + void identity(); static std::shared_ptr identitysptr(int n); }; // - // FULL MATRIX FULL COLUMN DOUBLE instantiation + // FULL MATRIX FULL COLUMN DOUBLE // - class FullMatrixFullColumnDouble : public FullMatrixTemplate { + class FullMatrixFullColumnDouble : public RowTypeMatrix> { public: - FullMatrixFullColumnDouble() : FullMatrixTemplate() {}; - explicit FullMatrixFullColumnDouble(int m) : FullMatrixTemplate(m) {}; - FullMatrixFullColumnDouble(int m, int n) : FullMatrixTemplate(m, n) {}; + FullMatrixFullColumnDouble() = default; + explicit FullMatrixFullColumnDouble(int m) : RowTypeMatrix>(m) + { + } + FullMatrixFullColumnDouble(int m, int n) { + for (int i = 0; i < m; i++) { + auto row = std::make_shared>(n); + this->push_back(row); + } + } - std::shared_ptr times(double a); - std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); + double maxMagnitude() override; + void zeroSelf() override; double sumOfSquares() override; - void identity() override; - static std::shared_ptr identitysptr(int n); + void symLowerWithUpper(); + std::shared_ptr times(double a); }; } diff --git a/OndselSolver/FullMatrix.ref.h b/OndselSolver/FullMatrix.ref.h index db820ec..a5c0f9e 100644 --- a/OndselSolver/FullMatrix.ref.h +++ b/OndselSolver/FullMatrix.ref.h @@ -1,6 +1,7 @@ #pragma once #include "FullColumn.ref.h" +#include namespace MbD { class FullMatrixDouble; diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index 6648076..2c3d2a9 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -7,65 +7,64 @@ ***************************************************************************/ #include "FullRow.h" -#include "FullMatrix.h" -using namespace MbD; - -template -std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) -{ - //"a*b = a(i)b(j)" - auto nrow = (int)this->size(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) +namespace MbD { + template + std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr 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(nrow); + for (int i = 0; i < nrow; i++) + { + answer->atiput(i, fullRow->times(this->at(i))); + } + return answer; } - return answer; -} -template -inline FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) -{ - //"a*bT = a(1,j)b(k,j)" - int ncol = fullMat->nrow(); - auto answer = std::make_shared>(ncol); - for (int k = 0; k < ncol; k++) { - answer->at(k) = this->dot(fullMat->at(k)); - } - return answer; -} - -template -inline FRowsptr FullRow::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat) -{ - //"a*bT = a(1,j)b(k,j)" - int ncol = fullMat->nrow(); - auto answer = std::make_shared>(ncol); - for (int k = 0; k < ncol; k++) { - answer->at(k) = this->dot(fullMat->at(k)); - } - return answer; -} - -template -inline FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) -{ - FRowsptr answer = fullMat->at(0)->times(this->at(0)); - for (int j = 1; j < (int) this->size(); j++) + template + FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr 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>(ncol); + for (int k = 0; k < ncol; k++) { + answer->at(k) = this->dot(fullMat->at(k)); + } + return answer; } - return answer; -} -template -inline FRowsptr FullRow::timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat) -{ - FRowsptr answer = fullMat->at(0)->times(this->at(0)); - for (int j = 1; j < (int) this->size(); j++) + template + FRowsptr FullRow::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr 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>(ncol); + for (int k = 0; k < ncol; k++) { + answer->at(k) = this->dot(fullMat->at(k)); + } + return answer; + } + + template + FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) + { + FRowsptr 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 + FRowsptr FullRow::timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat) + { + FRowsptr 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; } diff --git a/OndselSolver/Item.h b/OndselSolver/Item.h index dd1a6c1..57ea6f4 100644 --- a/OndselSolver/Item.h +++ b/OndselSolver/Item.h @@ -10,9 +10,13 @@ #include #include - +#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" diff --git a/OndselSolver/MBDynItem.cpp b/OndselSolver/MBDynItem.cpp index 31a328d..aae8444 100644 --- a/OndselSolver/MBDynItem.cpp +++ b/OndselSolver/MBDynItem.cpp @@ -164,7 +164,7 @@ FMatDsptr MbD::MBDynItem::readOrientation(std::vector& 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()); diff --git a/OndselSolver/MBDynMarker.cpp b/OndselSolver/MBDynMarker.cpp index 9c789a3..37fd175 100644 --- a/OndselSolver/MBDynMarker.cpp +++ b/OndselSolver/MBDynMarker.cpp @@ -21,7 +21,7 @@ void MbD::MBDynMarker::parseMBDyn(std::vector& 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); diff --git a/OndselSolver/MarkerFrame.cpp b/OndselSolver/MarkerFrame.cpp index 81c115e..72075d0 100644 --- a/OndselSolver/MarkerFrame.cpp +++ b/OndselSolver/MarkerFrame.cpp @@ -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); } } diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index a5acf7a..56401e2 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -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>(3); auto eigenvector = std::make_shared>(3); for (int i = 0; i < 3; i++) diff --git a/OndselSolver/Part.cpp b/OndselSolver/Part.cpp index 44e1ad0..701874c 100644 --- a/OndselSolver/Part.cpp +++ b/OndselSolver/Part.cpp @@ -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::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::pCTpEtimesColumn(a4J->timesFullColumn(aC->timesFullColumn(qEdot))); auto pCpEtimesqEdot = EulerParameters::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) diff --git a/OndselSolver/RackPinConstraintIqcJc.cpp b/OndselSolver/RackPinConstraintIqcJc.cpp index 3b4cebc..06bc5f7 100644 --- a/OndselSolver/RackPinConstraintIqcJc.cpp +++ b/OndselSolver/RackPinConstraintIqcJc.cpp @@ -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() diff --git a/OndselSolver/RackPinConstraintIqcJqc.cpp b/OndselSolver/RackPinConstraintIqcJqc.cpp index 144b81b..529855c 100644 --- a/OndselSolver/RackPinConstraintIqcJqc.cpp +++ b/OndselSolver/RackPinConstraintIqcJqc.cpp @@ -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() diff --git a/OndselSolver/ScrewConstraintIqcJc.cpp b/OndselSolver/ScrewConstraintIqcJc.cpp index 9249c97..7cb3a1d 100644 --- a/OndselSolver/ScrewConstraintIqcJc.cpp +++ b/OndselSolver/ScrewConstraintIqcJc.cpp @@ -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() diff --git a/OndselSolver/ScrewConstraintIqcJqc.cpp b/OndselSolver/ScrewConstraintIqcJqc.cpp index 18c9ce2..c56c15d 100644 --- a/OndselSolver/ScrewConstraintIqcJqc.cpp +++ b/OndselSolver/ScrewConstraintIqcJqc.cpp @@ -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() diff --git a/OndselSolver/TranslationConstraintIqcJc.cpp b/OndselSolver/TranslationConstraintIqcJc.cpp index db2ce00..429655c 100644 --- a/OndselSolver/TranslationConstraintIqcJc.cpp +++ b/OndselSolver/TranslationConstraintIqcJc.cpp @@ -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() diff --git a/OndselSolver/TranslationConstraintIqcJqc.cpp b/OndselSolver/TranslationConstraintIqcJqc.cpp index 02377a4..5659e02 100644 --- a/OndselSolver/TranslationConstraintIqcJqc.cpp +++ b/OndselSolver/TranslationConstraintIqcJqc.cpp @@ -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(); }