@@ -23,7 +23,9 @@ FOUR_C_NAMESPACE_OPEN
2323namespace Core ::LinAlg
2424{
2525 /* !
26- * \brief A wrapper around Teuchos::SerialDenseVector
26+ * \brief Composition wrapper for Teuchos::SerialDenseVector.
27+ *
28+ * Access to the underlying Trilinos object is explicit via base().
2729 */
2830 class SerialDenseVector
2931 {
@@ -32,46 +34,72 @@ namespace Core::LinAlg
3234 using scalarType = double ;
3335 using Base = Teuchos::SerialDenseVector<ordinalType, scalarType>;
3436
35- // --- constructors ---
37+ /* * \name Construction */
38+ // @{
3639 SerialDenseVector () = default ;
3740 SerialDenseVector (int length);
3841 SerialDenseVector (int length, bool zeroOut);
42+
43+ /* ! \brief Construct from user-provided storage.
44+ *
45+ * Behavior (view/copy) follows \p cv semantics of Teuchos::DataAccess.
46+ */
3947 SerialDenseVector (Teuchos::DataAccess cv, double * values, int length);
48+
49+ /* ! \brief Construct from underlying Trilinos vector.
50+ *
51+ * \note \p trans is accepted for API compatibility and validated.
52+ */
4053 SerialDenseVector (const Base& source, Teuchos::ETransp trans = Teuchos::NO_TRANS);
54+ // @}
4155
4256 // NOLINTBEGIN(readability-identifier-naming)
4357
44- // --- size queries ---
58+ /* * \name Size queries and norms */
59+ // @{
4560 [[nodiscard]] int length () const ;
4661 [[nodiscard]] int num_rows () const ;
4762 [[nodiscard]] int numRows () const ;
4863 [[nodiscard]] double normInf () const ;
4964 [[nodiscard]] double normOne () const ;
65+ [[nodiscard]] double norm2 () const ;
5066 [[nodiscard]] double normFrobenius () const ;
5167 [[nodiscard]] bool empty () const ;
68+ // @}
5269
53- // --- element access ---
70+ /* * \name Element access */
71+ // @{
5472 double & operator ()(int i) { return vec_ (i); }
5573 const double & operator ()(int i) const { return vec_ (i); }
5674 double & operator [](int i) { return vec_[i]; }
5775 const double & operator [](int i) const { return vec_[i]; }
76+ // @}
5877
59- // --- data access ---
60- // ! Returns a pointer to the raw data.
78+ /* * \name Raw data access */
79+ // @{
80+ /* ! \brief Returns pointer to contiguous vector storage.
81+ *
82+ * The const overload follows Teuchos semantics and returns mutable data.
83+ */
6184 double * values () const ;
62- // ! Returns a pointer to the raw data.
85+
86+ // ! Alias for values().
6387 double * data () const ;
88+ // @}
6489
65- // --- modifiers ---
90+ /* * \name Modifiers */
91+ // @{
6692 int size (int length);
6793 int Size (int length);
6894 int resize (int length);
6995 int scale (double alpha);
7096 int put_scalar (double val = 0.0 );
7197 int putScalar (double val = 0.0 );
7298 void assign (const SerialDenseVector& source);
99+ // @}
73100
74- // --- algebraic operations ---
101+ /* * \name Algebraic operations */
102+ // @{
75103 SerialDenseVector& operator +=(const SerialDenseVector& other);
76104 double dot (const SerialDenseVector& other) const ;
77105 int multiply (Teuchos::ETransp transa, Teuchos::ETransp transb, double alpha,
@@ -81,39 +109,52 @@ namespace Core::LinAlg
81109 const Teuchos::SerialDenseMatrix<ordinalType, scalarType>& A, const SerialDenseVector& B,
82110 double beta);
83111 void print (std::ostream& out) const ;
112+ // @}
84113
85114 // NOLINTEND(readability-identifier-naming)
86115
87- // --- access to underlying Trilinos object ---
116+ /* * \name Trilinos interoperability */
117+ // @{
118+ /* ! \brief Access the wrapped Trilinos vector for low-level interfaces. */
88119 Base& base ();
120+
121+ /* ! \brief Const access variant of base(). */
89122 const Base& base () const ;
123+ // @}
90124
91- /* *
92- * Get the vector as a std::span.
93- */
125+ /* * \name Span views */
126+ // @{
127+ // ! Returns a read-only span view over the current vector data.
94128 [[nodiscard]] std::span<const double > as_span () const { return std::span (values (), length ()); }
95129
96- /* *
97- * Get the vector as a std::span.
98- */
130+ // ! Returns a mutable span view over the current vector data.
99131 [[nodiscard]] std::span<double > as_span () { return std::span (values (), length ()); }
132+ // @}
100133
101134 private:
135+ /* ! \cond INTERNAL */
102136 Base vec_;
137+ /* ! \endcond */
103138 };
104139
105140 // type definition for serial integer vector
106141 using IntSerialDenseVector = Teuchos::SerialDenseVector<int , int >;
107142
143+ /* * \name Free vector utilities */
144+ // @{
145+
108146 /* !
109- \brief Update vector components with scaled values of a,
110- b = alpha*a + beta*b
147+ \brief Update vector components with scaled values.
148+
149+ Computes \p b = \p alpha * \p a + \p beta * \p b.
111150 */
112151 void update (double alpha, const SerialDenseVector& a, double beta, SerialDenseVector& b);
113152
114- // wrapper function to compute Norm of vector
153+ // ! Euclidean vector norm.
115154 double norm2 (const SerialDenseVector& v);
116155
156+ // @}
157+
117158 // output stream operator
118159 inline std::ostream& operator <<(std::ostream& out, const SerialDenseVector& vec)
119160 {
0 commit comments