14 #ifndef __UT_Matrix_H__
15 #define __UT_Matrix_H__
41 UT_MatrixT(
int nrl,
int nrh,
int ncl,
int nch);
42 UT_MatrixT(
int nrl,
int nrh,
int ncl,
int nch,
T *array);
48 void init(
int nrl,
int nrh,
int ncl,
int nch);
53 void resize(
int nrows,
int ncols);
57 void appendCol(
T *new_col=0);
58 void appendRow(
T *new_row=0);
66 int isInit()
const {
return myMatrix ? 1 : 0; }
71 int nrl,
int nrh,
int ncl,
int nch);
74 void submatrix(
T *array,
75 int nrl,
int nrh,
int ncl,
int nch,
int stride=-1);
79 void zero(
int nrl,
int nrh,
int ncl,
int nch);
81 {
zero(myNRL, myNRH, myNCL, myNCH); }
121 int rows()
const {
return myNRH - myNRL + 1; }
124 int columns()
const {
return myNCH - myNCL + 1; }
128 void changeNRLAndNCL(
int nrl,
int ncl);
143 return myMatrix[row*myStride + col];
149 return myMatrix[row*myStride + col];
172 template <
typename S>
175 template <
typename S>
177 { multVec(x, result); }
184 template <
typename S>
185 void outerproductUpdate(
T b,
195 void preMultGivensInPlace(
T c,
T s);
196 void postMultGivensInPlace(
T c,
T s);
198 template <
typename S>
202 T rowsL2dist(
int r1,
int r2,
int cl=-1,
int ch=-1)
const;
205 T normFrobenius()
const;
207 T normInfinite()
const;
220 return &myMatrix[i * myStride];
223 void clearAndDestroy();
225 int save(std::ostream &os,
int binary)
const;
228 friend std::ostream &operator<<(std::ostream &os, const UT_MatrixT<T> &m )
236 int64 mem = inclusive ?
sizeof(*this) : 0;
237 if (myOwnData && myMatrix)
238 mem += (myNRH - myNRL + 1)*(myNCH - myNCL + 1)*
sizeof(*myMatrix);
244 void outTo( std::ostream &os )
const;
247 int myNRL, myNRH, myNCL, myNCH;
249 int myStride, myOffset;
T & operator()(int row, int col)
void setShallowNCL(int ncl)
const GLuint GLenum const void * binary
void postMult(const UT_VectorT< S > &x, UT_VectorT< S > &result) const
void setShallowNRL(int nrl)
**But if you need a result
UT_MatrixT< fpreal > UT_MatrixR
GLsizei GLboolean transpose
GA_API const UT_StringHolder scale
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
void setShallowNCH(int nch)
GLint GLenum GLboolean GLsizei stride
UT_API size_t format(char *buffer, size_t buffer_size, const UT_MatrixT< T > &v)
GLboolean GLboolean GLboolean b
UT_MatrixT< fpreal64 > UT_MatrixD
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
bool isSymmetric(const MatType &m)
Determine if a matrix is symmetric.
LeafData & operator=(const LeafData &)=delete
UT_MatrixT< fpreal32 > UT_MatrixF
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
UT_MatrixT< fpreal64 > UT_Matrix
GLenum GLenum GLsizei void * row
T operator()(int row, int col) const
ImageBuf OIIO_API zero(ROI roi, int nthreads=0)
void setShallowNRH(int nrh)
int64 getMemoryUsage(bool inclusive) const